summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--tests/.gitignore9
-rw-r--r--tests/Makefile.am65
-rw-r--r--tests/reject.l4 (renamed from tests/test-reject/scanner.l)0
-rw-r--r--tests/reject.txt (renamed from tests/test-reject/test.input)0
-rw-r--r--tests/test-reject/.gitignore9
-rw-r--r--tests/test-reject/Makefile.am80
-rwxr-xr-xtests/testwrapper.sh21
7 files changed, 88 insertions, 96 deletions
diff --git a/tests/.gitignore b/tests/.gitignore
index 08c3818..c5f2f20 100644
--- a/tests/.gitignore
+++ b/tests/.gitignore
@@ -1,6 +1,7 @@
*.log
*.trs
*.o
+*.tables
alloc_extra
alloc_extra.c
array_nr
@@ -60,6 +61,14 @@ prefix_nr
prefix_nr.c
prefix_r
prefix_r.c
+reject_nr.reject
+reject_nr.reject.c
+reject_r.reject
+reject_r.reject.c
+reject_ver.table
+reject_ver.table.c
+reject_ser.table
+reject_ser.table.c
string_nr
string_nr.c
string_r
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 5343af4..9f65c4e 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -21,12 +21,28 @@
TESTS = $(check_PROGRAMS)
+# The script testwrapper.sh will run most tests as is. A couple tests
+# in the suite end in .reject, .table and the like so that we can pass
+# different arguments to the test runner. We list those extensions so
+# automake knows how to distinguish between the various kinds of tests
+# we have.
+
+TEST_EXTENSIONS = .reject .table
+
LOG_COMPILER = $(srcdir)/testwrapper.sh
-AM_LOG_FLAGS = $(srcdir)
+AM_LOG_FLAGS = -d $(srcdir)
+
+REJECT_LOG_COMPILER = $(srcdir)/testwrapper.sh
+AM_REJECT_LOG_FLAGS = -d $(srcdir) -i reject.txt
+
+TABLE_LOG_COMPILER = $(srcdir)/testwrapper.sh
+AM_TABLE_LOG_FLAGS = -d $(srcdir) -i reject.txt -t
AM_YFLAGS = -d -p test
-check_PROGRAMS = \
+check_PROGRAMS = $(simple_tests) $(reject_tests) $(TABLE_TESTS)
+
+simple_tests = \
alloc_extra \
array_nr \
array_r \
@@ -60,6 +76,14 @@ string_r \
top \
yyextra
+reject_tests = \
+ reject_nr.reject \
+ reject_r.reject
+
+TABLE_TESTS = \
+ reject_ver.table \
+ reject_ser.table
+
alloc_extra_SOURCES = alloc_extra.l
array_nr_SOURCES = array_nr.l
array_r_SOURCES = array_r.l
@@ -88,6 +112,10 @@ posix_SOURCES = posix.l
posixly_correct_SOURCES = posixly_correct.l
prefix_nr_SOURCES = prefix_nr.l
prefix_r_SOURCES = prefix_r.l
+reject_nr_reject_SOURCES = reject.l4
+reject_r_reject_SOURCES = reject.l4
+reject_ver_table_SOURCES = reject.l4
+reject_ser_table_SOURCES = reject.l4
string_nr_SOURCES = string_nr.l
string_r_SOURCES = string_r.l
top_SOURCES = top.l top_main.c
@@ -108,6 +136,10 @@ BUILT_SOURCES = \
multiple_scanners_nr_2.h \
multiple_scanners_r_1.h \
multiple_scanners_r_2.h \
+ reject_nr.reject.c \
+ reject_r.reject.c \
+ reject_ver.table.c \
+reject_ser.table \
top.h
EXTRA_DIST = \
@@ -148,6 +180,11 @@ basic_nr.txt \
noansi_r.txt \
prefix_nr.txt \
prefix_r.txt \
+ reject.txt \
+ reject_nr.reject.c \
+ reject_r.reject.c \
+ reject_ver.table.c \
+ reject_ser.table.c \
top.h \
top.txt \
yyextra.txt
@@ -194,5 +231,29 @@ multiple_scanners_r_2.h: multiple_scanners_r_2.c
posixly_correct.c: posixly_correct.l
POSIXLY_CORRECT=1 $(FLEX) -o $@ $<
+reject_nr.reject.c: reject.l4
+ $(FLEX) -o $@ $<
+
+reject_nr.reject$(EXEEXT): reject_nr.reject.$(OBJEXT)
+ $(LINK) $^
+
+reject_r.reject.c: reject.l4
+ $(FLEX) --reentrant -o $@ $<
+
+reject_r.reject$(EXEEXT): reject_r.reject.$(OBJEXT)
+ $(LINK) $^
+
+reject_ver.table.c: reject.l4
+ $(FLEX) -o $@ --tables-verify --tables-file=$(*F).tables $<
+
+reject_ver.table$(EXEEXT): reject_ver.table.$(OBJEXT)
+ $(LINK) $^
+
+reject_ser.table.c: reject.l4
+ $(FLEX) -o $@ --tables-file=$(*F).tables $<
+
+reject_ser.table$(EXEEXT): reject_ser.table.$(OBJEXT)
+ $(LINK) $^
+
top_main$(objext): top.h
top.h: top.c
diff --git a/tests/test-reject/scanner.l b/tests/reject.l4
index 5e5208e..5e5208e 100644
--- a/tests/test-reject/scanner.l
+++ b/tests/reject.l4
diff --git a/tests/test-reject/test.input b/tests/reject.txt
index 7288a40..7288a40 100644
--- a/tests/test-reject/test.input
+++ b/tests/reject.txt
diff --git a/tests/test-reject/.gitignore b/tests/test-reject/.gitignore
deleted file mode 100644
index 6c2de30..0000000
--- a/tests/test-reject/.gitignore
+++ /dev/null
@@ -1,9 +0,0 @@
-Makefile
-Makefile.in
-parser.c
-parser.h
-scanner.c
-TEMPLATE
-OUTPUT
-.deps
-test-reject-*
diff --git a/tests/test-reject/Makefile.am b/tests/test-reject/Makefile.am
deleted file mode 100644
index 902d7be..0000000
--- a/tests/test-reject/Makefile.am
+++ /dev/null
@@ -1,80 +0,0 @@
-# This file is part of flex.
-
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-
-# 1. Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-# 2. Redistributions in binary form must reproduce the above copyright
-# notice, this list of conditions and the following disclaimer in the
-# documentation and/or other materials provided with the distribution.
-
-# Neither the name of the University nor the names of its contributors
-# may be used to endorse or promote products derived from this software
-# without specific prior written permission.
-
-# THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
-# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-# PURPOSE.
-
-
-FLEX = $(top_builddir)/flex
-
-EXTRA_DIST = scanner.l test.input
-CLEANFILES = scanner.c $(testname)$(EXEEXT)-* OUTPUT $(OBJS)
-OBJS = test-reject-nr.o test-reject-r.o test-reject-ver.o \
- test-reject-ser.o
-
-AM_CPPFLAGS = -I$(srcdir) -I$(top_srcdir) -I$(top_builddir)
-
-tests = test-reject-nr$(EXEEXT) test-reject-r$(EXEEXT) \
- test-reject-ser$(EXEEXT) test-reject-ver$(EXEEXT)
-testname = test-reject
-
-test-reject-nr.c: $(srcdir)/scanner.l
- $(FLEX) -o $@ $(LFLAGS) $<
-
-test-reject-ver.c: $(srcdir)/scanner.l
- $(FLEX) -o $@ --tables-verify --tables-file=`basename $@ .c`.tables $(LFLAGS) $<
-
-test-reject-ser.c: $(srcdir)/scanner.l
- $(FLEX) -o $@ --tables-file=`basename $@ .c`.tables $(LFLAGS) $<
-
-test-reject-r.c: $(srcdir)/scanner.l
- $(FLEX) --reentrant -o $@ $(LFLAGS) $<
-
-test-reject-nr$(EXEEXT): test-reject-nr.o
- $(CC) $(CFLAGS) -o $@ $(LDFLAGS) $< $(LOADLIBES)
-
-test-reject-ver$(EXEEXT): test-reject-ver.o
- $(CC) $(CFLAGS) -o $@ $(LDFLAGS) $< $(LOADLIBES)
-
-test-reject-ser$(EXEEXT): test-reject-ser.o
- $(CC) $(CFLAGS) -o $@ $(LDFLAGS) $< $(LOADLIBES)
-
-test-reject-r$(EXEEXT): test-reject-r.o
- $(CC) $(CFLAGS) -o $@ $(LDFLAGS) $< $(LOADLIBES)
-
-$(testname)$(EXEEXT): $(OBJS)
-
-test: $(tests)
- ./$(testname)-nr$(EXEEXT) < $(srcdir)/test.input
- ./$(testname)-r$(EXEEXT) < $(srcdir)/test.input
- ./$(testname)-ver$(EXEEXT) $(testname)-ver.tables < $(srcdir)/test.input
- ./$(testname)-ser$(EXEEXT) $(testname)-ser.tables < $(srcdir)/test.input
-
-test-reject-nr.o: test-reject-nr.c
- $(CC) -c -o $@ $(AM_CPPFLAGS) $(CPPFLAGS) $(CFLAGS) $<
-
-test-reject-ver.o: test-reject-ver.c
- $(CC) -c -o $@ $(AM_CPPFLAGS) $(CPPFLAGS) -DTEST_HAS_TABLES_EXTERNAL $(CFLAGS) $<
-
-test-reject-ser.o: test-reject-ser.c
- $(CC) -c -o $@ $(AM_CPPFLAGS) $(CPPFLAGS) -DTEST_HAS_TABLES_EXTERNAL $(CFLAGS) $<
-
-test-reject-r.o: test-reject-r.c
- $(CC) -c -o $@ $(AM_CPPFLAGS) $(CPPFLAGS) -DTEST_IS_REENTRANT $(CFLAGS) $<
-
-
diff --git a/tests/testwrapper.sh b/tests/testwrapper.sh
index f4ecff1..dd8c077 100755
--- a/tests/testwrapper.sh
+++ b/tests/testwrapper.sh
@@ -4,12 +4,23 @@
# Each test will exercise some feature or aspect of flex. Run the test with any input it may need.
-SRCDIR="$1"
-TESTNAME="$2"
-INPUTNAME=`basename $TESTNAME`.txt
+INPUT_DIRECTORY=""
+INPUT_NAME=""
-if [ -f $SRCDIR/$INPUTNAME ] ; then
- $TESTNAME < $SRCDIR/$INPUTNAME
+while getopts :d:i:t OPTION ; do
+ case $OPTION in
+ d) INPUT_DIRECTORY=$OPTARG ;;
+ i) INPUTNAME="$OPTARG" ;;
+ t) USE_TABLES=1 ;;
+ esac
+ done
+
+TESTNAME="${!$OPTIND}"
+
+INPUTNAME=${INPUT_NAME:-`basename $TESTNAME`.txt}
+
+if [ -f $INPUT_DIRECTORY/$INPUT_NAME ] ; then
+ $TESTNAME ${USE_TABLES:+${INPUT_DIRECTORY}${TESTNAME}} < $INPUT_DIRECTORY/$INPUT_NAME
else
$TESTNAME
fi