]> thyrsus.com Git - intercal.git/commitdiff
Get -F working again, add a regression test for it
authorAlex Smith <ais523@bham.ac.uk>
Fri, 3 Sep 2010 01:08:31 +0000 (02:08 +0100)
committerAlex Smith <ais523@bham.ac.uk>
Fri, 3 Sep 2010 01:08:31 +0000 (02:08 +0100)
-F tends to break particularly often (it was broken by accident due to
changes to autoconf and to perpet.c); hopefully the regression test
(using beer.i) will catch problems with -F in future.

pit/Makefile
src/cooptsh.in
src/perpet.c

index 61b77db9c8063cf371e599d986b43edc0302c9b9..01f25a14c5f2fcef1aa3dc9800b4a7c5250fc105 100644 (file)
@@ -102,7 +102,8 @@ TARGETS = $(BASE2SOURCES:.i=) \
 
 # For instructions on test conventions, see the header comment of regresscheck
 test: $(TARGETS)
-       @$(PIT)/beer | $(PIT)/regresscheck $(PIT)/beer 
+       @$(PIT)/beer | $(PIT)/regresscheck $(PIT)/beer
+       @file $(PIT)/beer | grep -q 'shell script' || echo "Regression test of -F (using beer) FAILED."
        @cat $(PIT)/bubble.tst | $(PIT)/bubble | $(PIT)/regresscheck $(PIT)/bubble
        @cat $(PIT)/fft-delta.tst | $(PIT)/fft | $(PIT)/regresscheck $(PIT)/fft-delta
        @cat $(PIT)/fft-tophat.tst | $(PIT)/fft | $(PIT)/regresscheck $(PIT)/fft-tophat
@@ -134,7 +135,9 @@ test: $(TARGETS)
        @echo "Tests complete."
 
 
-# Some tests need options to compile extensions.
+# Some tests need options to compile extensions; some test extensions.
+$(PIT)/beer: $(PIT)/beer.i
+       $(ICK) -F $(PIT)/beer.i
 $(PIT)/pass: $(PIT)/pass.i
        $(ICK) -m $(PIT)/pass.i
 $(PIT)/tests/compucome: $(PIT)/tests/compucome.i
index 2b0622ccd630c9aaad7912895e1df3bd7707f5e7..b06cf12497cebcf1089a927aefcd7b56a622e589 100644 (file)
 #
 ###########################################################################
 
-rm icktemp.out >/dev/null 2>/dev/null
-if $1@EXEEXT@ +mystery >icktemp.out 2>/dev/null ; then : ; else
-rm icktemp.out ; exit 0 ; fi
-if grep 'ickoutTERM???!' icktemp.out ; then rm icktemp.out ; exit 0 ; fi
-echo 'ickoutTERM???!' >> icktemp.out
+rm -f icktemp.out >/dev/null 2>/dev/null
+if `readlink -f $1@EXEEXT@` +mystery >icktemp.out 2>/dev/null ; then : ; else
+echo Execution of $1@EXEEXT@ failed.
+rm -f icktemp.out ; exit 0 ; fi
 rm $1@EXEEXT@
-echo "#! /bin/sh
-cat <<'ickoutTERM???!'" | cat - icktemp.out > $1@EXEEXT@
+echo '#! /bin/sh
+tail -n+3 $0; exit 0' | cat - icktemp.out > $1@EXEEXT@
 chmod +x $1@EXEEXT@
-rm icktemp.out
 exit 0
index 18d2ae1462e5b7217fa9bbc97149eae57bbc7850..61fb0116d22eaea0a7c74e56e95bd0bdd69b75d2 100644 (file)
@@ -175,9 +175,11 @@ struct linerange_t {
     int start, end;
     char *libname;
 };
+/* Note! "syslib" must be last in this list, as other parts of perpet.c
+   care about whether syslib in particular was included. */
 struct linerange_t lineranges[] = {
-    {1000, 1999, "syslib"},    /* the system library */
     {5000, 5699, "floatlib"},  /* the floating-point support */
+    {1000, 1999, "syslib"},    /* the system library */
     {0, 0, NULL},
 };
 
@@ -1557,8 +1559,9 @@ static void run_coopt(/*@observer@*/ /*@null@*/ /*@unused@*/ const char* cooptsh
                       /*@observer@*/ /*@unused@*/ const char* binaryname)
 {
   /* Note: Params are marked unused because they may not be used if sh isn't supported. */
-#ifdef HAVE_PROG_SH
-# ifdef HAVE_SYS_INTERPRETER
+  /* Assume that sh exists if #! does; sh is needed to run autoconf, so this would
+     otherwise have to be set by hand anyway. */
+#ifdef HAVE_SYS_INTERPRETER
   if(coopt) /* AIS */
   {
     /* The constant-output optimizer is a form of post-processor.
@@ -1576,7 +1579,6 @@ static void run_coopt(/*@observer@*/ /*@null@*/ /*@unused@*/ const char* cooptsh
                                     neccesary */
     }
   }
-# endif
 #endif
 }