bug-gnulib
[Top][All Lists]
Advanced

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

Re: [PATCH] add tests for vc-list-files


From: Jim Meyering
Subject: Re: [PATCH] add tests for vc-list-files
Date: Thu, 01 May 2008 21:08:39 +0200

Bruno Haible <address@hidden> wrote:

> Hi Jim,
>
>> * tests/test-vc-list-files-cvs.sh: New file.
>> * tests/test-vc-list-files-git.sh: New file.
>
> The two tests fail for me, on Linux, in a testdir created through
>   gnulib-tool --create-testdir --with-tests ...
>
> ./test-vc-list-files-cvs.sh: line 57: vc-list-files: command not found
> --- expected    2008-05-01 16:51:41.000000000 +0200
> +++ actual      2008-05-01 16:51:41.000000000 +0200
> @@ -1,3 +0,0 @@
> -b
> -c
> -d/a
> ./test-vc-list-files-cvs.sh: line 57: vc-list-files: command not found
> --- expected    2008-05-01 16:51:42.000000000 +0200
> +++ actual      2008-05-01 16:51:42.000000000 +0200
> @@ -1,3 +0,0 @@
> -b
> -c
> -d/a
> FAIL: test-vc-list-files-cvs.sh
> ./test-vc-list-files-git.sh: line 43: vc-list-files: command not found
> FAIL: test-vc-list-files-git.sh

Thanks for testing that.

> The reason is that
>
>   1) The scripts make use of an environment variable abs_top_srcdir.
>      But such an environment variable is not set. You need to augment
>      TESTS_ENVIRONMENT.
>
>      TESTS_ENVIRONMENT += abs_top_srcdir=`cd '$(top_srcdir)' && pwd`

Actually, $(abs_top_srcdir) is an automake variable, and it is always
defined, assuming a reasonably modern version of automake.
However, it has a value I didn't expect, since $(abs_top_srcdir)/build-aux
does not exist.  build-aux/ is one level about $(abs_top_srcdir),
so this gets it: $(abs_top_srcdir)/../build-aux

>   2) It uses build-aux, assuming the user has not used the gnulib-tool
>      --aux-dir option. The fix is to use $ac_aux_dir instead of build-aux.

With the change below, my test succeeds.
I.e., this runs and passes the tests:

  /gnulib/gnulib-tool --with-tests --test vc-list-files

diff --git a/modules/vc-list-files-tests b/modules/vc-list-files-tests
index d0a4234..611d43e 100644
--- a/modules/vc-list-files-tests
+++ b/modules/vc-list-files-tests
@@ -9,4 +9,4 @@ configure.ac:
 Makefile.am:
 TESTS += test-vc-list-files-git.sh
 TESTS += test-vc-list-files-cvs.sh
-TESTS_ENVIRONMENT += abs_top_srcdir='$(abs_top_srcdir)'
+TESTS_ENVIRONMENT += PATH='$(abs_top_srcdir)/../build-aux':"$$PATH"
diff --git a/tests/test-vc-list-files-cvs.sh b/tests/test-vc-list-files-cvs.sh
index 91bdeac..febd13b 100755
--- a/tests/test-vc-list-files-cvs.sh
+++ b/tests/test-vc-list-files-cvs.sh
@@ -16,9 +16,6 @@
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.  */

-PATH="$abs_top_srcdir/build-aux":$PATH
-export PATH
-
 tmpdir=vc-cvs-$$
 trap 'st=$?; cd '"`pwd`"' && rm -rf $tmpdir; exit $st' 0
 trap '(exit $?); exit $?' 1 2 13 15
diff --git a/tests/test-vc-list-files-git.sh b/tests/test-vc-list-files-git.sh
index 7fffc83..5b8d94f 100755
--- a/tests/test-vc-list-files-git.sh
+++ b/tests/test-vc-list-files-git.sh
@@ -16,9 +16,6 @@
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.  */

-PATH="$abs_top_srcdir/build-aux":$PATH
-export PATH
-
 if ( diff --version < /dev/null 2>&1 | grep GNU ) 2>&1 > /dev/null; then
   compare() { diff -u "$@"; }
 elif ( cmp --version < /dev/null 2>&1 | grep GNU ) 2>&1 > /dev/null; then

----------------------------------------------------------
But that failed with the test you suggested:

  /gnulib/gnulib-tool --aux-dir=foo --with-tests --test vc-list-files

so I made this change instead:

>From 50f8b70f0dba1bfa3242c6de9991fdd04457ca04 Mon Sep 17 00:00:00 2001
From: Jim Meyering <address@hidden>
Date: Thu, 1 May 2008 21:01:36 +0200
Subject: [PATCH] vc-list-files: make the stand-alone gnulib test work

* modules/vc-list-files-tests (configure.ac):
Define and AC_SUBST abs_aux_dir.
(Makefile.am) [TESTS_ENVIRONMENT]: Rather than passing
$(abs_top_srcdir) to each script and having each of them
duplicate the work of setting PATH, set PATH here, using
the new variable, abs_aux_dir instead.
* tests/test-vc-list-files-cvs.sh: Don't set PATH here.
* tests/test-vc-list-files-git.sh: Likewise.
Reported by Bruno Haible.

Signed-off-by: Jim Meyering <address@hidden>
---
 ChangeLog                       |   13 +++++++++++++
 modules/vc-list-files-tests     |    4 +++-
 tests/test-vc-list-files-cvs.sh |    3 ---
 tests/test-vc-list-files-git.sh |    3 ---
 4 files changed, 16 insertions(+), 7 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index f3b5bf9..b39f3b0 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,16 @@
+2008-05-01  Jim Meyering  <address@hidden>
+
+       vc-list-files: make the stand-alone gnulib test work
+       * modules/vc-list-files-tests (configure.ac):
+       Define and AC_SUBST abs_aux_dir.
+       (Makefile.am) [TESTS_ENVIRONMENT]: Rather than passing
+       $(abs_top_srcdir) to each script and having each of them
+       duplicate the work of setting PATH, set PATH here, using
+       the new variable, abs_aux_dir instead.
+       * tests/test-vc-list-files-cvs.sh: Don't set PATH here.
+       * tests/test-vc-list-files-git.sh: Likewise.
+       Reported by Bruno Haible.
+
 2008-05-01  Bruno Haible  <address@hidden>

        * lib/getndelim2.c (getndelim2): Fix newsize computation during
diff --git a/modules/vc-list-files-tests b/modules/vc-list-files-tests
index d0a4234..2650c44 100644
--- a/modules/vc-list-files-tests
+++ b/modules/vc-list-files-tests
@@ -5,8 +5,10 @@ tests/test-vc-list-files-cvs.sh
 Depends-on:

 configure.ac:
+abs_aux_dir=`cd "$ac_aux_dir"; pwd`
+AC_SUBST([abs_aux_dir])

 Makefile.am:
 TESTS += test-vc-list-files-git.sh
 TESTS += test-vc-list-files-cvs.sh
-TESTS_ENVIRONMENT += abs_top_srcdir='$(abs_top_srcdir)'
+TESTS_ENVIRONMENT += PATH='$(abs_aux_dir)':"$$PATH"
diff --git a/tests/test-vc-list-files-cvs.sh b/tests/test-vc-list-files-cvs.sh
index 91bdeac..febd13b 100755
--- a/tests/test-vc-list-files-cvs.sh
+++ b/tests/test-vc-list-files-cvs.sh
@@ -16,9 +16,6 @@
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.  */

-PATH="$abs_top_srcdir/build-aux":$PATH
-export PATH
-
 tmpdir=vc-cvs-$$
 trap 'st=$?; cd '"`pwd`"' && rm -rf $tmpdir; exit $st' 0
 trap '(exit $?); exit $?' 1 2 13 15
diff --git a/tests/test-vc-list-files-git.sh b/tests/test-vc-list-files-git.sh
index 7fffc83..5b8d94f 100755
--- a/tests/test-vc-list-files-git.sh
+++ b/tests/test-vc-list-files-git.sh
@@ -16,9 +16,6 @@
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.  */

-PATH="$abs_top_srcdir/build-aux":$PATH
-export PATH
-
 if ( diff --version < /dev/null 2>&1 | grep GNU ) 2>&1 > /dev/null; then
   compare() { diff -u "$@"; }
 elif ( cmp --version < /dev/null 2>&1 | grep GNU ) 2>&1 > /dev/null; then
--
1.5.5.1.117.ga349




reply via email to

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