]> granicus.if.org Git - flex/commitdiff
Cleaned up the output of the tests.
authorJohn Millaway <john43@users.sourceforge.net>
Sat, 4 Aug 2001 01:14:13 +0000 (01:14 +0000)
committerJohn Millaway <john43@users.sourceforge.net>
Sat, 4 Aug 2001 01:14:13 +0000 (01:14 +0000)
15 files changed:
tests/Makefile.in
tests/README
tests/TEMPLATE/Makefile.in
tests/test-basic-nr/Makefile.in
tests/test-basic-r/Makefile.in
tests/test-bison-yylloc/Makefile.in
tests/test-bison-yylval/Makefile.in
tests/test-include-by-buffer/Makefile.in
tests/test-include-by-reentrant/Makefile.in
tests/test-prefix-nr/Makefile.in
tests/test-prefix-r/Makefile.in
tests/test-pthread/Makefile.in
tests/test-string-nr/Makefile.in
tests/test-string-r/Makefile.in
tests/test-yyextra/Makefile.in

index 9f24f888cc889881344758871e226a07eec8dbdd..81cc7d7ba35f0b62db2b2b81ffacd0307200fadb 100644 (file)
@@ -5,24 +5,56 @@ TESTDIRS= @TESTDIRS@
 
 srcdir= @srcdir@
 
-all: check
 
-check: 
-       for dir in $(TESTDIRS) ; do \
-       (cd "$$dir" && $(MAKE) check ) || echo Test $$dir failed ; \
+all: build
+
+build:
+       @for dir in $(TESTDIRS) ; do \
+       (cd "$$dir" && $(MAKE) ) ; \
     done
+       @echo "Type 'make check' to run all tests."
+
+check:
+       @nok=0;\
+    nfail=0;\
+    nskip=0;\
+    for dir in $(TESTDIRS) ; do \
+       echo -n Executing "$$dir" ; \
+       dot=$$((30-$${#dir})); \
+       while (( dot )); do \
+           echo -n '.'; \
+           dot=$$((dot-1)); \
+       done; \
+       ( cd "$$dir" && $(MAKE) check  > OUTPUT 2>&1 ) ; \
+       case $$? in \
+            0)  echo OK.; \
+                 nok=$$((nok+1)) ; \
+                 continue; \
+                 ;; \
+            1)  echo "FAILED. See $$dir/OUTPUT for details." ; \
+                 nfail=$$((nfail+1)) ; \
+                 ;; \
+            2)  echo "SKIPPED. See $$dir/OUTPUT for details."; \
+                 nskip=$$((nskip+1)) ; \
+                 ;; \
+       esac; \
+    done ; \
+    echo "Results: "; \
+    echo "    Tests OK:        $$nok"; \
+    echo "    Tests SKIPPED:   $$nskip"; \
+    echo "    Tests FAILED:    $$nfail" ;
 
 distclean: clean
-       for dir in $(TESTDIRS) ; do \
+       @for dir in $(TESTDIRS) ; do \
        if test -f "$$dir/Makefile" ; then \
           (cd "$$dir" && $(MAKE) distclean ) ; \
-       fi \
+       fi; \
     done
        rm -f config.h config.status config.log Makefile
 
 clean:
-       for dir in $(TESTDIRS) ; do \
+       @for dir in $(TESTDIRS) ; do \
        if test -f "$$dir/Makefile" ; then \
            (cd "$$dir" && $(MAKE) clean ) ; \
-       fi \
+       fi \
     done
index 2936cc2a9b9dc4cc8b6966d6db84d3a33365269b..28b51d50adca396b6f39d805bc3812d68e7b9a69 100644 (file)
@@ -24,9 +24,8 @@ To build and execute all tests:
 
 To build and execute a single test:
 
-  $ cd tests/ #from the top level of the flex tree
-  $ cd test-pthread-nr # for example
-  $ make 
+  $ cd tests/ # from the top level of the flex tree.
+  $ cd test-pthread-nr
   $ make check
 
 HOW TO ADD A NEW TEST
@@ -40,11 +39,15 @@ HOW TO ADD A NEW TEST
    include your new test in the cvs tree.
 
  - On success, your test should return zero.
-   On error, your test should return non-zero and print a message
-   to stderr. Hopefullly, your error message will indicate something
-   helpful to explain why the test failed.
 
- - You must modify the last few lines of tests/Makefile.in
+ - On error, your test should return 1 (one) and print a message
+   to stdout or stderr, which have been redirected to the file
+   named, "OUTPUT", in your test's directory.
+
+ - If your test is skipped (e.g., bison not found), then the Makefile
+   rule should return 2 (two). See "test-bison-nr/Makefile.in" for details.
+
+ - You must modify the last few lines of tests/configure.in
    by adding your new test directory, and the Makefile target.
 
  - Each test assumes that the newly-built binary "flex" is in the 
index df0534e63e5d72bda31ea285799ce9a0cc6e4274..67b1542bd0702a3fd2c3103c7e64da44c763b406 100644 (file)
@@ -55,8 +55,7 @@ parser.o: parser.c
 test: check
 
 check: $(TESTNAME)
-       @echo "EXECUTING TEST: '$(TESTNAME)'"
-       ./$(TESTNAME) < $(srcdir)/test.input
+       ./$(TESTNAME) < $(srcdir)/test.input 
 
 distclean: clean
        rm -f Makefile
index 5017f80002e95917424af3039708a720e7eab58b..faf5b25169fa53de280d439b56f9e95505b27da2 100644 (file)
@@ -55,8 +55,7 @@ parser.o: parser.c
 test: check
 
 check: $(TESTNAME)
-       @echo "EXECUTING TEST: '$(TESTNAME)'"
-       ./$(TESTNAME) < $(srcdir)/test.input
+       ./$(TESTNAME) < $(srcdir)/test.input 
 
 clean:
        rm -f scanner.o scanner.c parser.o parser.c  parser.h $(TESTNAME)
index c6e9a590718ac094d354268b8e0f2b7d023d344b..730bd8336b9dd08524ff2a31e0f99edc497fc8f0 100644 (file)
@@ -55,8 +55,7 @@ parser.o: parser.c
 test: check
 
 check: $(TESTNAME)
-       @echo "EXECUTING TEST: '$(TESTNAME)'"
-       ./$(TESTNAME) < $(srcdir)/test.input
+       ./$(TESTNAME) < $(srcdir)/test.input 
 
 clean:
        rm -f scanner.o scanner.c parser.o parser.c  parser.h $(TESTNAME)
index fc1dceb8e1a147f05ec8accb63c017af3ed96448..99c65a98a5960cd5335088f6e1e788ec44202929 100644 (file)
@@ -43,19 +43,18 @@ $(TESTNAME): parser.y scanner.l
                $(CC) $(CPPFLAGS) $(CFLAGS) -c scanner.c ; \
                $(CC) $(CPPFLAGS) $(CFLAGS) -c parser.c ; \
                $(CC) $(CFLAGS) -o $(TESTNAME) scanner.o parser.o $(LDFLAGS) $(LIBS) ; \
-       else \
-               echo "SKIPPING TEST: '$(TESTNAME);' (bison not found)." ; \
        fi
 
 test: check
 
 check: $(TESTNAME)
        if test "$(YACC)" = "bison" ; then \
-               echo "EXECUTING TEST: '$(TESTNAME)'" ;\
-               ./$(TESTNAME) <$(srcdir)/test.input | ./$(TESTNAME) | diff $(srcdir)/test.input -; \
-       else \
-               echo "SKIPPING TEST: '$(TESTNAME);' (bison not found)." ; \
-       fi
+        ./$(TESTNAME) <$(srcdir)/test.input | ./$(TESTNAME) | \
+        diff $(srcdir)/test.input -  ; \
+    else \
+        echo "Test skipped because GNU bison was not detected by configure." ; \
+        exit 2;\
+    fi
 
 clean:
        rm -f scanner.o scanner.c parser.o parser.c  parser.h $(TESTNAME)
index b1fc08daa71bad25f91e3ab73c96fb865764d7a1..b2507f16b42404fdb6b499371756b18ca5d9650a 100644 (file)
@@ -43,19 +43,17 @@ $(TESTNAME): parser.y scanner.l
                $(CC) $(CPPFLAGS) $(CFLAGS) -c scanner.c ;\
                $(CC) $(CPPFLAGS) $(CFLAGS) -c parser.c ; \
                $(CC) $(CFLAGS) -o $(TESTNAME) scanner.o parser.o $(LDFLAGS) $(LIBS) ; \
-       else \
-               echo "SKIPPING TEST: '$(TESTNAME);' (bison not found)." ; \
        fi
 
 test: check
 
 check: $(TESTNAME)
        if test "$(YACC)" = "bison" ; then \
-               echo "EXECUTING TEST: '$(TESTNAME)'" ; \
-               ./$(TESTNAME) < $(srcdir)/test.input ; \
-       else \
-               echo "SKIPPING TEST: '$(TESTNAME);' (bison not found)." ; \
-       fi
+        ./$(TESTNAME) < $(srcdir)/test.input  ; \
+    else \
+        echo "Test skipped because GNU bison was not detected by configure." ;\
+        exit 2; \
+    fi
 
 clean:
        rm -f scanner.o scanner.c parser.o parser.c  parser.h $(TESTNAME)
index ac258ffc95bfb8fdad8661705249449f969937f1..460d308e9d650585dc45a842ac741d66cc9016a8 100644 (file)
@@ -55,13 +55,11 @@ parser.o: parser.c
 test: check
 
 check: $(TESTNAME)
-       @echo "EXECUTING TEST: '$(TESTNAME)'"
-       @echo Copying input files...
        for f in test-1.input test-2.input test-3.input ; do \
-               if test ! -f $$f ; then  \
-                       cp $(srcdir)/$$f . ; \
-               fi \
-       done 
+        if test ! -f $$f ; then  \
+            cp -f $(srcdir)/$$f . ; \
+        fi \
+    done 
        ./$(TESTNAME) test-1.input 
 
 clean:
index 4fbf29600d222e59769debe8b4938ad4646303ef..82957c8fa9dbe5bcff4dab576541b65ec4014d13 100644 (file)
@@ -55,13 +55,11 @@ parser.o: parser.c
 test: check
 
 check: $(TESTNAME)
-       @echo "EXECUTING TEST: '$(TESTNAME)'"
-       @echo Copying input files...
        for f in test-1.input test-2.input test-3.input ; do \
-               if test ! -f $$f ; then  \
-                       cp $(srcdir)/$$f . ; \
-               fi \
-       done 
+        if test ! -f $$f ; then  \
+            cp -f $(srcdir)/$$f . ; \
+        fi \
+    done 
        ./$(TESTNAME) test-1.input 
 
 clean:
index 201ca6331487f92d41eeaa606249bb43f5d58ced..48266d7ad3020e9af9b8268a573b3a368ecd31a2 100644 (file)
@@ -56,8 +56,7 @@ parser.o: parser.c
 test: check
 
 check: $(TESTNAME)
-       @echo "EXECUTING TEST: '$(TESTNAME)'"
-       ./$(TESTNAME) < $(srcdir)/test.input
+       ./$(TESTNAME) < $(srcdir)/test.input 
 
 distclean: clean
        rm -f Makefile
index 6c7e295a063b1e0daf6532ee35ff373c4b7fab37..b00d5f3b5d3be67556be2ce1e00f97808a595b3a 100644 (file)
@@ -56,8 +56,7 @@ parser.o: parser.c
 test: check
 
 check: $(TESTNAME)
-       @echo "EXECUTING TEST: '$(TESTNAME)'"
-       ./$(TESTNAME) < $(srcdir)/test.input
+       ./$(TESTNAME) < $(srcdir)/test.input 
 
 distclean: clean
        rm -f Makefile
index 02485ea4e1786c4c4937340fb27aaaa54a6cb7bc..cc1362428c925acd6201f6593e8a4efb4c791787 100644 (file)
@@ -55,8 +55,7 @@ parser.o: parser.c
 test: check
 
 check: $(TESTNAME)
-       @echo "EXECUTING TEST: '$(TESTNAME)'"
-       ./$(TESTNAME) $(srcdir)/test-*.input
+       ./$(TESTNAME) $(srcdir)/test-*.input 
 
 clean:
        rm -f scanner.o scanner.c parser.o parser.c  parser.h $(TESTNAME)
index efd6b291a5c17248d1aaf4e0c18ae9309b775415..356c261cf3df530be5a1ade31ab5bb5d3e578086 100644 (file)
@@ -55,8 +55,7 @@ parser.o: parser.c
 test: check
 
 check: $(TESTNAME)
-       @echo "EXECUTING TEST: '$(TESTNAME)'"
-       ./$(TESTNAME)
+       ./$(TESTNAME) 
 
 clean:
        rm -f scanner.o scanner.c parser.o parser.c  parser.h $(TESTNAME)
index 52dcce1ea56b15bccd2188e18313cee5b08e67aa..c7984f95097fabcd9017a10bc7aaf35bbcb92d79 100644 (file)
@@ -55,8 +55,7 @@ parser.o: parser.c
 test: check
 
 check: $(TESTNAME)
-       @echo "EXECUTING TEST: '$(TESTNAME)'"
-       ./$(TESTNAME)
+       ./$(TESTNAME) 
 
 clean:
        rm -f scanner.o scanner.c parser.o parser.c  parser.h $(TESTNAME)
index 86b2358eaf05f8b88b783dee1151fabf29a20288..f42d8cd369adecc002acc57831c781936ea2a45c 100644 (file)
@@ -55,8 +55,8 @@ parser.o: parser.c
 test: check
 
 check: $(TESTNAME)
-       @echo "EXECUTING TEST: '$(TESTNAME)'"
-       ./$(TESTNAME) < $(srcdir)/test.input | diff $(srcdir)/test.input -
+       ./$(TESTNAME) < $(srcdir)/test.input | \
+     diff $(srcdir)/test.input - 
 
 distclean: clean
        rm -f Makefile