From a25c6733a0e78fd7aef28e560e027bcef9684e96 Mon Sep 17 00:00:00 2001 From: Stefano Lattarini Date: Sat, 25 Sep 2010 21:31:06 +0200 Subject: [PATCH] Testsuite: Use `$PATH_SEPARATOR', not `:', when extending PATH. * tests/compile2.test: Do no uselessly (implicitly) repeat the computation of PATH_SEPARATOR again. * tests/instmany-mans.test: Use `$PATH_SEPARATOR', not `:', when extending/redefining PATH. * tests/instmany-python.test: Likewise. * tests/instmany.test: Likewise. * tests/man4.test: Likewise. * tests/mkinst3.test: Likewise. * tests/mmodely.test: Likewise. * tests/multlib.test: Likewise. * tests/txinfo30.test: Likewise. * tests/README (Section "Writing test cases" subsection "Do"): Updated. * Makefile.am (sc_tests_PATH_SEPARATOR): New maintainer check. (syntax_check_rules): Updated. --- ChangeLog | 17 +++++++++++++++++ Makefile.am | 8 ++++++++ Makefile.in | 7 +++++++ tests/README | 3 +++ tests/compile2.test | 8 ++------ tests/instmany-mans.test | 5 +++-- tests/instmany-python.test | 4 ++-- tests/instmany.test | 4 ++-- tests/man4.test | 4 ++-- tests/mkinst3.test | 4 ++-- tests/mmodely.test | 5 +++-- tests/multlib.test | 2 +- tests/txinfo30.test | 4 ++-- 13 files changed, 54 insertions(+), 21 deletions(-) diff --git a/ChangeLog b/ChangeLog index b96918c..6855f9a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,22 @@ 2010-09-25 Stefano Lattarini + Testsuite: Use `$PATH_SEPARATOR', not `:', when extending PATH. + * tests/compile2.test: Do no uselessly (implicitly) repeat the + computation of PATH_SEPARATOR again. + * tests/instmany-mans.test: Use `$PATH_SEPARATOR', not `:', when + extending/redefining PATH. + * tests/instmany-python.test: Likewise. + * tests/instmany.test: Likewise. + * tests/man4.test: Likewise. + * tests/mkinst3.test: Likewise. + * tests/mmodely.test: Likewise. + * tests/multlib.test: Likewise. + * tests/txinfo30.test: Likewise. + * tests/README (Section "Writing test cases" subsection "Do"): + Updated. + * Makefile.am (sc_tests_PATH_SEPARATOR): New maintainer check. + (syntax_check_rules): Updated. + Testsuite: new variables `$PATH_SEPARATOR' and `$APIVERSION'. * tests/defs.in ($APIVERSION): New AC_SUBST'd variable. ($ACLOCAL, $AUTOMAKE): Use it. diff --git a/Makefile.am b/Makefile.am index 3aead75..d19d974 100644 --- a/Makefile.am +++ b/Makefile.am @@ -140,6 +140,7 @@ sc_tests_required_after_defs \ sc_tests_overriding_macros_on_cmdline \ sc_tests_plain_sleep \ sc_tests_plain_egrep_fgrep \ +sc_tests_PATH_SEPARATOR \ sc_mkdir_p \ sc_perl_at_substs \ sc_unquoted_DESTDIR \ @@ -409,6 +410,13 @@ sc_tests_plain_egrep_fgrep: exit 1; \ fi +## Using `:' as a PATH separator is not portable. +sc_tests_PATH_SEPARATOR: + @if grep -E '\bPATH=.*:.*' $(srcdir)/tests/*.test ; then \ + echo "Use \`$$PATH_SEPARATOR', not \`:', in PATH definitions above." 1>&2; \ + exit 1; \ + fi + sc_mkdir_p: @if grep 'mkdir_p' $(srcdir)/automake.in \ $(srcdir)/lib/am/*.am $(srcdir)/tests/*.test; then \ diff --git a/Makefile.in b/Makefile.in index 528b80e..649565b 100644 --- a/Makefile.in +++ b/Makefile.in @@ -298,6 +298,7 @@ sc_tests_required_after_defs \ sc_tests_overriding_macros_on_cmdline \ sc_tests_plain_sleep \ sc_tests_plain_egrep_fgrep \ +sc_tests_PATH_SEPARATOR \ sc_mkdir_p \ sc_perl_at_substs \ sc_unquoted_DESTDIR \ @@ -1090,6 +1091,12 @@ sc_tests_plain_egrep_fgrep: exit 1; \ fi +sc_tests_PATH_SEPARATOR: + @if grep -E '\bPATH=.*:.*' $(srcdir)/tests/*.test ; then \ + echo "Use \`$$PATH_SEPARATOR', not \`:', in PATH definitions above." 1>&2; \ + exit 1; \ + fi + sc_mkdir_p: @if grep 'mkdir_p' $(srcdir)/automake.in \ $(srcdir)/lib/am/*.am $(srcdir)/tests/*.test; then \ diff --git a/tests/README b/tests/README index a063348..93f9cbf 100644 --- a/tests/README +++ b/tests/README @@ -136,6 +136,9 @@ Do Use `Exit' rather than `exit' to abort a test. + Use `$PATH_SEPARATOR', not hard-coded `:', as the separator of + PATH's entries. + It's more important to make sure that a feature works, than make sure that Automake's output looks correct. It might look correct and still fail to work. In other words, prefer diff --git a/tests/compile2.test b/tests/compile2.test index fe4574a..334f154 100755 --- a/tests/compile2.test +++ b/tests/compile2.test @@ -1,5 +1,5 @@ #! /bin/sh -# Copyright (C) 2009 Free Software Foundation, Inc. +# Copyright (C) 2009, 2010 Free Software Foundation, Inc. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -66,11 +66,7 @@ test -f "$amtest_object" # Absolute w32 paths should be accepted. # Do not actually run this test on anything that could be w32. test -d "C:\\" && Exit 77 -# This test is taken from Autoconf's _AS_PATH_SEPARATOR_PREPARE. -(PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { - (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || - Exit 77 -} +case $PATH_SEPARATOR in ';'|':');; *) Exit 77;; esac amtest_source='C:\libltdl\libltdl\slist.c' amtest_object='C:\libltdl\libltdl\libltdl_libltdl_la-slist.obj' diff --git a/tests/instmany-mans.test b/tests/instmany-mans.test index fcee60b..fe55be4 100755 --- a/tests/instmany-mans.test +++ b/tests/instmany-mans.test @@ -1,5 +1,5 @@ #! /bin/sh -# Copyright (C) 2008, 2009 Free Software Foundation, Inc. +# Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -123,7 +123,7 @@ test `find "$instdir" -type f -print | wc -l` = 0 # Try whether we don't exceed the low limit. INSTALL='$(SHELL) $(top_builddir)/myinstall' $MAKE -e install -env save_PATH="$PATH" PATH="`pwd`/..:$PATH" $MAKE uninstall +env save_PATH="$PATH" PATH="`pwd`/..$PATH_SEPARATOR$PATH" $MAKE uninstall cd $subdir srcdir=../../$subdir @@ -146,4 +146,5 @@ for file in page3.man page$nfiles.man npage3.man npage$nfiles.man; do $MAKE install-man3 && Exit 1 chmod u+r $srcdir/$file done + : diff --git a/tests/instmany-python.test b/tests/instmany-python.test index 6831c9e..7648e1b 100755 --- a/tests/instmany-python.test +++ b/tests/instmany-python.test @@ -1,5 +1,5 @@ #! /bin/sh -# Copyright (C) 2008, 2009 Free Software Foundation, Inc. +# Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -113,7 +113,7 @@ test `find "$instdir" -type f -print | wc -l` = 0 # Try whether we don't exceed the low limit. INSTALL='$(SHELL) $(top_builddir)/myinstall' $MAKE -e install -env save_PATH="$PATH" PATH="`pwd`/..:$PATH" $MAKE uninstall +env save_PATH="$PATH" PATH="`pwd`/..$PATH_SEPARATOR$PATH" $MAKE uninstall cd $subdir srcdir=../../$subdir diff --git a/tests/instmany.test b/tests/instmany.test index a3b10cb..2de026d 100755 --- a/tests/instmany.test +++ b/tests/instmany.test @@ -1,5 +1,5 @@ #! /bin/sh -# Copyright (C) 2008, 2009 Free Software Foundation, Inc. +# Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -137,7 +137,7 @@ test `find "$instdir" -type f -print | wc -l` = 0 # Try whether we don't exceed the low limit. INSTALL='$(SHELL) $(top_builddir)/myinstall' $MAKE -e install -env save_PATH="$PATH" PATH="`pwd`/..:$PATH" $MAKE uninstall +env save_PATH="$PATH" PATH="`pwd`/..$PATH_SEPARATOR$PATH" $MAKE uninstall cd $subdir srcdir=../../$subdir diff --git a/tests/man4.test b/tests/man4.test index aa86a9e..de75f837 100755 --- a/tests/man4.test +++ b/tests/man4.test @@ -1,5 +1,5 @@ #! /bin/sh -# Copyright (C) 2008 Free Software Foundation, Inc. +# Copyright (C) 2008, 2010 Free Software Foundation, Inc. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -73,7 +73,7 @@ END chmod +x foo bar help2man save_PATH=$PATH -PATH=`pwd`:$PATH +PATH=`pwd`$PATH_SEPARATOR$PATH $ACLOCAL $AUTOMAKE diff --git a/tests/mkinst3.test b/tests/mkinst3.test index 18f18fb..20b9b04 100755 --- a/tests/mkinst3.test +++ b/tests/mkinst3.test @@ -1,5 +1,5 @@ #! /bin/sh -# Copyright (C) 2005, 2006 Free Software Foundation, Inc. +# Copyright (C) 2005, 2006, 2010 Free Software Foundation, Inc. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -52,7 +52,7 @@ EOF chmod +x bin/mkdir AM_PATH=$PATH export AM_PATH -PATH=`pwd`/bin:$PATH +PATH=`pwd`/bin$PATH_SEPARATOR$PATH export PATH # Test mkinstalldirs without mkdir -p. diff --git a/tests/mmodely.test b/tests/mmodely.test index 0f9bb3b..fc94d37 100755 --- a/tests/mmodely.test +++ b/tests/mmodely.test @@ -1,5 +1,6 @@ #! /bin/sh -# Copyright (C) 2004, 2006, 2007, 2009 Free Software Foundation, Inc. +# Copyright (C) 2004, 2006, 2007, 2009, 2010 Free Software Foundation, +# Inc. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -82,7 +83,7 @@ cat >mylex.sh <<'END' echo "$@" >lex.yy.c END chmod +x myyacc.sh mylex.sh -PATH="`pwd`:$PATH" +PATH="`pwd`$PATH_SEPARATOR$PATH" # make maintainer-clean; ./configure; make should always work, # per GNU Standard. diff --git a/tests/multlib.test b/tests/multlib.test index 5ff19d7..3f88be3 100755 --- a/tests/multlib.test +++ b/tests/multlib.test @@ -45,7 +45,7 @@ gcc ${1+"$@"} END chmod +x mycc -PATH=`pwd`:$PATH +PATH=`pwd`$PATH_SEPARATOR$PATH cat >Makefile.am <<'EOF' SUBDIRS = @subdirs@ diff --git a/tests/txinfo30.test b/tests/txinfo30.test index 8db42d9..296180d 100755 --- a/tests/txinfo30.test +++ b/tests/txinfo30.test @@ -1,5 +1,5 @@ #! /bin/sh -# Copyright (C) 2005 Free Software Foundation, Inc. +# Copyright (C) 2005, 2010 Free Software Foundation, Inc. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -41,7 +41,7 @@ EOF chmod +x makeinfo -PATH=`pwd`:$PATH +PATH=`pwd`$PATH_SEPARATOR$PATH export PATH $ACLOCAL -- 2.7.4