summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--tests/Makefile.in48
-rw-r--r--tests/README17
-rw-r--r--tests/TEMPLATE/Makefile.in3
-rw-r--r--tests/test-basic-nr/Makefile.in3
-rw-r--r--tests/test-basic-r/Makefile.in3
-rw-r--r--tests/test-bison-yylloc/Makefile.in13
-rw-r--r--tests/test-bison-yylval/Makefile.in12
-rw-r--r--tests/test-include-by-buffer/Makefile.in10
-rw-r--r--tests/test-include-by-reentrant/Makefile.in10
-rw-r--r--tests/test-prefix-nr/Makefile.in3
-rw-r--r--tests/test-prefix-r/Makefile.in3
-rw-r--r--tests/test-pthread/Makefile.in3
-rw-r--r--tests/test-string-nr/Makefile.in3
-rw-r--r--tests/test-string-r/Makefile.in3
-rw-r--r--tests/test-yyextra/Makefile.in4
15 files changed, 79 insertions, 59 deletions
diff --git a/tests/Makefile.in b/tests/Makefile.in
index 9f24f88..81cc7d7 100644
--- a/tests/Makefile.in
+++ b/tests/Makefile.in
@@ -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
diff --git a/tests/README b/tests/README
index 2936cc2..28b51d5 100644
--- a/tests/README
+++ b/tests/README
@@ -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
diff --git a/tests/TEMPLATE/Makefile.in b/tests/TEMPLATE/Makefile.in
index df0534e..67b1542 100644
--- a/tests/TEMPLATE/Makefile.in
+++ b/tests/TEMPLATE/Makefile.in
@@ -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
diff --git a/tests/test-basic-nr/Makefile.in b/tests/test-basic-nr/Makefile.in
index 5017f80..faf5b25 100644
--- a/tests/test-basic-nr/Makefile.in
+++ b/tests/test-basic-nr/Makefile.in
@@ -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)
diff --git a/tests/test-basic-r/Makefile.in b/tests/test-basic-r/Makefile.in
index c6e9a59..730bd83 100644
--- a/tests/test-basic-r/Makefile.in
+++ b/tests/test-basic-r/Makefile.in
@@ -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)
diff --git a/tests/test-bison-yylloc/Makefile.in b/tests/test-bison-yylloc/Makefile.in
index fc1dceb..99c65a9 100644
--- a/tests/test-bison-yylloc/Makefile.in
+++ b/tests/test-bison-yylloc/Makefile.in
@@ -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)
diff --git a/tests/test-bison-yylval/Makefile.in b/tests/test-bison-yylval/Makefile.in
index b1fc08d..b2507f1 100644
--- a/tests/test-bison-yylval/Makefile.in
+++ b/tests/test-bison-yylval/Makefile.in
@@ -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)
diff --git a/tests/test-include-by-buffer/Makefile.in b/tests/test-include-by-buffer/Makefile.in
index ac258ff..460d308 100644
--- a/tests/test-include-by-buffer/Makefile.in
+++ b/tests/test-include-by-buffer/Makefile.in
@@ -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:
diff --git a/tests/test-include-by-reentrant/Makefile.in b/tests/test-include-by-reentrant/Makefile.in
index 4fbf296..82957c8 100644
--- a/tests/test-include-by-reentrant/Makefile.in
+++ b/tests/test-include-by-reentrant/Makefile.in
@@ -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:
diff --git a/tests/test-prefix-nr/Makefile.in b/tests/test-prefix-nr/Makefile.in
index 201ca63..48266d7 100644
--- a/tests/test-prefix-nr/Makefile.in
+++ b/tests/test-prefix-nr/Makefile.in
@@ -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
diff --git a/tests/test-prefix-r/Makefile.in b/tests/test-prefix-r/Makefile.in
index 6c7e295..b00d5f3 100644
--- a/tests/test-prefix-r/Makefile.in
+++ b/tests/test-prefix-r/Makefile.in
@@ -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
diff --git a/tests/test-pthread/Makefile.in b/tests/test-pthread/Makefile.in
index 02485ea..cc13624 100644
--- a/tests/test-pthread/Makefile.in
+++ b/tests/test-pthread/Makefile.in
@@ -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)
diff --git a/tests/test-string-nr/Makefile.in b/tests/test-string-nr/Makefile.in
index efd6b29..356c261 100644
--- a/tests/test-string-nr/Makefile.in
+++ b/tests/test-string-nr/Makefile.in
@@ -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)
diff --git a/tests/test-string-r/Makefile.in b/tests/test-string-r/Makefile.in
index 52dcce1..c7984f9 100644
--- a/tests/test-string-r/Makefile.in
+++ b/tests/test-string-r/Makefile.in
@@ -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)
diff --git a/tests/test-yyextra/Makefile.in b/tests/test-yyextra/Makefile.in
index 86b2358..f42d8cd 100644
--- a/tests/test-yyextra/Makefile.in
+++ b/tests/test-yyextra/Makefile.in
@@ -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