bug-diffutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [bug-diffutils] [PATCH] tests: make test runner a script, not a shel


From: Stefano Lattarini
Subject: Re: [bug-diffutils] [PATCH] tests: make test runner a script, not a shell function
Date: Mon, 10 Oct 2011 23:25:07 +0200
User-agent: KMail/1.13.7 (Linux/2.6.30-2-686; KDE/4.6.5; i686; ; )

On Monday 10 October 2011, Stefano Lattarini wrote:
> All the test scripts in the diffutils testsuite are shell scripts,
> so the current definition of TESTS_ENVIRONMENT, which adaptively
> run tests using either perl or the shell depending on their kind,
> is an overkill.
> 
> Moreover, this change is required in order for the testsuite to
> continue to work with the new testsuite harness that is planned
> to be introduced in Automake 1.12 (which, as of the writing date,
> is still under development and in late alpha state).
> 
> See also related discussion on bug-coreutils:
>  <http://debbugs.gnu.org/cgi/bugreport.cgi?bug=8887>
> 
> * tests/Makefile.am (TESTS_ENVIRONMENT): Remove definition of the
> `shell_or_perl_' shell function, which is not really required.
> * tests/binary: Make executable.
> * tests/colliding-file-names: Likewise.
> * tests/excess-slash: Likewise.
> * tests/no-newline-at-eof: Likewise.
> ---
>
Oops, the patch wasn't exactly right, as it introduced a slight semantic
change by making the test scripts being executed by the system default
shell `/bin/sh' rather than by the shell `$(SHELL)' detected at configure
time.  On some systems (e.g., Solaris 10), the difference is quite
relevant, since /bin/sh might not be a POSIX-conforming shell.  So the
following diff should be squashed in:

  diff --git a/tests/Makefile.am b/tests/Makefile.am
  index 5e2944d..9835ab6 100644
  --- a/tests/Makefile.am
  +++ b/tests/Makefile.am
  @@ -42,6 +42,8 @@ TESTS_ENVIRONMENT =                           \
     PATH='$(abs_top_builddir)/src$(PATH_SEPARATOR)'"$$PATH" \
     ;
 
  +LOG_COMPILER= $(SHELL)
  +
   built_programs =                                                       \
     echo 'spy:;@echo $$(PROGRAMS)'                                       \
       | MAKEFLAGS= $(MAKE) -s -C $(builddir)/../src -f Makefile -f - spy \


Attached is an updated patch that fixes the issue.

Sorry for the noise,
  Stefano
From 5a45c31552df3b32810c92cf3502d8d1d6bfe9ce Mon Sep 17 00:00:00 2001
Message-Id: <address@hidden>
From: Stefano Lattarini <address@hidden>
Date: Mon, 10 Oct 2011 20:30:21 +0200
Subject: [PATCH] tests: make test runner a script, not a shell function

All the test scripts in the diffutils testsuite are shell scripts,
so the current definition of TESTS_ENVIRONMENT, which adaptively
run tests using either perl or the shell depending on their kind,
is an overkill.

Moreover, this change is required in order for the testsuite to
continue to work with the new testsuite harness that is planned
to be introduced in Automake 1.12 (which, as of the writing date,
is still under development and in late alpha state).

See also related discussion on bug-coreutils:
 <http://debbugs.gnu.org/cgi/bugreport.cgi?bug=8887>

* tests/Makefile.am (TESTS_ENVIRONMENT): Remove definition of the
`shell_or_perl_' shell function, which is not required anymore.
(LOG_COMPILER): New, define to `$(SHELL)'.
* tests/binary: Make executable.
* tests/colliding-file-names: Likewise.
* tests/excess-slash: Likewise.
* tests/no-newline-at-eof: Likewise.
---
 tests/Makefile.am          |   19 +++----------------
 1 files changed, 3 insertions(+), 16 deletions(-)
 mode change 100644 => 100755 tests/binary
 mode change 100644 => 100755 tests/colliding-file-names
 mode change 100644 => 100755 tests/excess-slash
 mode change 100644 => 100755 tests/no-newline-at-eof

diff --git a/tests/Makefile.am b/tests/Makefile.am
index 582f976..9835ab6 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -22,21 +22,6 @@ TESTS_ENVIRONMENT =                          \
   tmp__=$$TMPDIR; test -d "$$tmp__" || tmp__=.;        \
   TMPDIR=$$tmp__; export TMPDIR;               \
   exec 9>&2;                                   \
-  shell_or_perl_() {                           \
-    if grep '^\#!/usr/bin/perl' "$$1" > /dev/null; then                        
\
-      if $(PERL) -e 'use warnings' > /dev/null 2>&1; then              \
-       grep '^\#!/usr/bin/perl -T' "$$1" > /dev/null && T_=T || T_=;   \
-        $(PERL) -w$$T_ -I$(srcdir) -MCoreutils                         \
-             -M"CuTmpdir qw($$f)" -- "$$1";    \
-      else                                     \
-       echo 1>&2 "$$tst: configure did not find a usable version of Perl," \
-         "so skipping this test";              \
-       (exit 77);                              \
-      fi;                                      \
-    else                                       \
-      $(SHELL) "$$1";                          \
-    fi;                                                \
-  };                                           \
   export                                       \
   VERSION='$(VERSION)'                         \
   abs_top_builddir='$(abs_top_builddir)'       \
@@ -55,7 +40,9 @@ TESTS_ENVIRONMENT =                           \
   PREFERABLY_POSIX_SHELL='$(PREFERABLY_POSIX_SHELL)' \
   REPLACE_GETCWD=$(REPLACE_GETCWD)             \
   PATH='$(abs_top_builddir)/src$(PATH_SEPARATOR)'"$$PATH" \
-  ; shell_or_perl_
+  ;
+
+LOG_COMPILER= $(SHELL)
 
 built_programs =                                                       \
   echo 'spy:;@echo $$(PROGRAMS)'                                       \
diff --git a/tests/binary b/tests/binary
old mode 100644
new mode 100755
diff --git a/tests/colliding-file-names b/tests/colliding-file-names
old mode 100644
new mode 100755
diff --git a/tests/excess-slash b/tests/excess-slash
old mode 100644
new mode 100755
diff --git a/tests/no-newline-at-eof b/tests/no-newline-at-eof
old mode 100644
new mode 100755
-- 
1.7.2.3


reply via email to

[Prev in Thread] Current Thread [Next in Thread]