From: Alexandre Duret-Lutz Date: Sat, 20 Jul 2002 15:48:35 +0000 (+0000) Subject: * tests/gnits2.test: Use --program-prefix. Test for scripts too. X-Git-Tag: Release-1-6b~8 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0e1a92342585385b2fd8e4484fdbdd3fcc5ad021;p=thirdparty%2Fautomake.git * tests/gnits2.test: Use --program-prefix. Test for scripts too. Replace the sed script by calls to grep, easier to debug. * lib/am/progs.am (installcheck-%DIR%PROGRAMS): Honor nobase and $(transform). * lib/am/scripts.am (installcheck-%DIR%SCRIPTS): Likewise. --- diff --git a/ChangeLog b/ChangeLog index 2cd149636..83cbbe86d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,11 @@ 2002-07-20 Alexandre Duret-Lutz + * tests/gnits2.test: Use --program-prefix. Test for scripts too. + Replace the sed script by calls to grep, easier to debug. + * lib/am/progs.am (installcheck-%DIR%PROGRAMS): Honor nobase + and $(transform). + * lib/am/scripts.am (installcheck-%DIR%SCRIPTS): Likewise. + * lib/am/progs.am (install-%DIR%PROGRAMS, uninstall-%DIR%PROGRAMS): Always strip the directory part before applying $(transform), even for nobase_ targets. diff --git a/lib/am/progs.am b/lib/am/progs.am index 66eecdf7f..3c1c0e8cd 100644 --- a/lib/am/progs.am +++ b/lib/am/progs.am @@ -109,11 +109,16 @@ if %?CK-OPTS% .PHONY installcheck-am: installcheck-%DIR%PROGRAMS installcheck-%DIR%PROGRAMS: $(%DIR%_PROGRAMS) bad=0; pid=$$$$; list="$(%DIR%_PROGRAMS)"; for p in $$list; do \ +## Strip the directory and $(EXEEXT) before applying $(transform). + f=`echo "$$p" | \ + sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \ +## Insert the directory back if nobase_ is used. +?!BASE? f=`echo "$$p" | sed 's|[^/]*$$||'`"$$f"; \ for opt in --help --version; do \ - if $(DESTDIR)$(%NDIR%dir)/$$p $$opt > c$${pid}_.out 2> c$${pid}_.err \ + if $(DESTDIR)$(%NDIR%dir)/$$f $$opt > c$${pid}_.out 2> c$${pid}_.err \ && test -n "`cat c$${pid}_.out`" \ && test -z "`cat c$${pid}_.err`"; then :; \ - else echo "$$p does not support $$opt" 1>&2; bad=1; fi; \ + else echo "$$f does not support $$opt" 1>&2; bad=1; fi; \ done; \ done; rm -f c$${pid}_.???; exit $$bad endif %?CK-OPTS% diff --git a/lib/am/scripts.am b/lib/am/scripts.am index b99ba6860..9f2448693 100644 --- a/lib/am/scripts.am +++ b/lib/am/scripts.am @@ -88,11 +88,15 @@ if %?CK-OPTS% .PHONY installcheck-am: installcheck-%DIR%SCRIPTS installcheck-%DIR%SCRIPTS: $(%DIR%_SCRIPTS) bad=0; pid=$$$$; list="$(%DIR%_SCRIPTS)"; for p in $$list; do \ +## Strip any leading directory before applying $(transform). + f=`echo "$$p" | sed 's,^.*/,,;$(transform)'`; \ +## Insert the directory back if nobase_ is used. +?!BASE? f=`echo "$$p" | sed 's|[^/]*$$||'`"$$f"; \ for opt in --help --version; do \ - if $(DESTDIR)$(%NDIR%dir)/$$p $$opt > c$${pid}_.out 2> c$${pid}_.err \ + if $(DESTDIR)$(%NDIR%dir)/$$f $$opt > c$${pid}_.out 2> c$${pid}_.err \ && test -n "`cat c$${pid}_.out`" \ && test -z "`cat c$${pid}_.err`"; then :; \ - else echo "$$p does not support $$opt" 1>&2; bad=1; fi; \ + else echo "$$f does not support $$opt" 1>&2; bad=1; fi; \ done; \ done; rm -f c$${pid}_.???; exit $$bad endif %?CK-OPTS% diff --git a/tests/gnits2.test b/tests/gnits2.test index 524f97493..50a79d441 100755 --- a/tests/gnits2.test +++ b/tests/gnits2.test @@ -13,45 +13,41 @@ END cat > Makefile.am << 'END' AUTOMAKE_OPTIONS = gnits noinst_PROGRAMS = fubar2 -bin_PROGRAMS = fubar fine +bin_PROGRAMS = fubar sub/fine +nobase_bin_PROGRAMS = sub/fubar3 fubar_SOURCES = fubar.c -fubar2_SOURCES = fubar2.c -fine_SOURCES = fine.c +fubar2_SOURCES = fubar.c +sub_fubar3_SOURCES = fubar.c +sub_fine_SOURCES = fine.c +bin_SCRIPTS = sub/scriptok.sh sub/scriptnok.sh END -echo 'main(int argc, char **argv) { exit(0); }' > fubar.c -echo 'main(int argc, char **argv) { exit(0); }' > fubar2.c +echo 'int main () { return 0; }' > fubar.c cat > fine.c << 'END' #include -main(int argc, char **argv) { +int +main () +{ puts ("Which version? Which usage?"); - exit(0); + return 0; } END -cat > check.sed << 'END' -/fubar does not/ { - s/.*/0/ - H -} -/fubar2 does not/ { - s/.*/1/ - H -} -/fine does not/ { - s/.*/1/ - H -} -$!d +mkdir sub -g -/^\n0\n0$/! { - s/.*/1/ - q -} -s/.*/0/ -END +cat >sub/scriptok.sh <sub/scriptnok.sh < INSTALL @@ -68,11 +64,20 @@ $ACLOCAL $AUTOCONF $AUTOMAKE -a -mkdir sub -cd sub +mkdir build +cd build -../configure --prefix=`pwd`/../inst-dir +# Use --program-prefix to make sure the std-options check honors it. +../configure --prefix=`pwd`/../inst-dir --program-prefix=p $MAKE all $MAKE install -exit `$MAKE installcheck 2>&1 | sed -f ../check.sed` - +test -f ../inst-dir/bin/pfine +test ! -f ../inst-dir/bin/fine +$MAKE -k installcheck 2>stderr && exit 1 +cat stderr +grep 'pfubar does not support' stderr +grep 'pfubar3 does not support' stderr +grep 'pscriptnok.sh does not support' stderr +# Only three failures please. +test `grep 'does not support --help' stderr | wc -l` = 3 +test `grep 'does not support --version' stderr | wc -l` = 3