]> git.ipfire.org Git - thirdparty/automake.git/commitdiff
* tests/gnits2.test: Use --program-prefix. Test for scripts too.
authorAlexandre Duret-Lutz <adl@gnu.org>
Sat, 20 Jul 2002 15:48:35 +0000 (15:48 +0000)
committerAlexandre Duret-Lutz <adl@gnu.org>
Sat, 20 Jul 2002 15:48:35 +0000 (15:48 +0000)
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.

ChangeLog
lib/am/progs.am
lib/am/scripts.am
tests/gnits2.test

index 2cd149636dc3d815035ff9276a8d6ba3451872ca..83cbbe86d515fa4f681e1be305ad8fd60bb6b322 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
 2002-07-20  Alexandre Duret-Lutz  <duret_g@epita.fr>
 
+       * 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.
index 66eecdf7f0aa8d5dc61aead6fe86c9aad36100a7..3c1c0e8cdb439af00f189a78cce1ed1136f72bb2 100644 (file)
@@ -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%
index b99ba6860f1b469a54969a7e79f38dc330de9e79..9f244869365138bbf5cd3f34cab7a0be16b51446 100644 (file)
@@ -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%
index 524f97493cb9521dcb51a9bce52f49d717488ef7..50a79d44118a0e6f5bce210d600a57571727c9bf 100755 (executable)
@@ -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 <stdio.h>
-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 <<EOF
+#!/bin/sh
+echo "Which version? Which usage?"
+EOF
+
+cat >sub/scriptnok.sh <<EOF
+#!/bin/sh
+:
+EOF
+
+chmod +x sub/scriptok.sh
+chmod +x sub/scriptnok.sh
 
 # Files required by Gnits.
 : > 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