summaryrefslogtreecommitdiff
path: root/tests/Makefile.am
diff options
context:
space:
mode:
authorEric S. Raymond <esr@thyrsus.com>2020-10-18 18:17:58 -0400
committerEric S. Raymond <esr@thyrsus.com>2020-10-20 03:31:20 -0400
commit16f19cd7ae01e0fc097f5573d18994da02e88934 (patch)
tree85638cd949c33041206e396fed11b33096fb517e /tests/Makefile.am
parentc23d0161dc2ebf374e1066e5f39f2f9fe6a19fba (diff)
downloadflex-git-16f19cd7ae01e0fc097f5573d18994da02e88934.tar.gz
Introduce testmaker.m4 and testmaker.sh
The existing method of generating multiple tests from l4 files is not flexible enough to handle multilanguage - reliance on the C preprocessor prevents that. This commit creates replacement machinery that's more flexible and will greatly reduce the complexity of adding new back ends. The idea is to generate test .l files by combining a backend-independent ruleset with backend-dependent boilerplate for test mains and preambles. This commit creates the rules files, the m4 to template them into tests, and a shell wrapper to drive the m4 expansion. The autoconf integration works OK, but requires additional rules at the end of tests/Makefile.am that probably ought to be autogenerated. There was one other change forced by this. In order for the new testmaker to work, it needs to be possible to analyze test file names into stems and option modifiers. Having underscores in the stem would make the analysis slower and bug-prone. I wanted to change them to "-" rather than deleting them, but this gives autoconf fits - it seems to not like filenames with embedded dashes in certain contexts. At this commit, only one test - array_nr.l - is generated using the new system.
Diffstat (limited to 'tests/Makefile.am')
-rw-r--r--tests/Makefile.am20
1 files changed, 13 insertions, 7 deletions
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 22d6eba..a1e1607 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -98,8 +98,8 @@ simple_tests = \
prefix_nr \
prefix_r \
prefix_c99 \
- quote_in_comment_cpp \
- quote_in_comment_c99 \
+ quoteincomment_cpp \
+ quoteincomment_c99 \
quotes_cpp \
quotes_c99 \
string_nr \
@@ -136,8 +136,8 @@ ONE_TESTS = \
lineno_c99.one \
lineno_trailing.one
-quote_in_comment_cpp_SOURCES = quote_in_comment_cpp.l
-quote_in_comment_c99_SOURCES = quote_in_comment_c99.l
+quoteincomment_cpp_SOURCES = quoteincomment_cpp.l
+quoteincomment_c99_SOURCES = quoteincomment_c99.l
alloc_extra_cpp_SOURCES = alloc_extra_cpp.l
alloc_extra_c99_SOURCES = alloc_extra_c99.l
array_nr_SOURCES = array_nr.l
@@ -225,6 +225,7 @@ yyextra_c99_SOURCES = yyextra_c99.l
CLEANFILES = \
alloc_extra_cpp.c \
alloc_extra_c99.c \
+ array_nr.l \
array_nr.c \
array_r.c \
array_c99.c \
@@ -286,8 +287,8 @@ CLEANFILES = \
prefix_r.c \
prefix_c99.c \
pthread.c \
- quote_in_comment_cpp.c \
- quote_in_comment_c99.c \
+ quoteincomment_cpp.c \
+ quoteincomment_c99.c \
quotes_cpp.c \
reject_nr.reject.c \
reject_r.reject.c \
@@ -355,7 +356,7 @@ EXTRA_DIST = \
reject.txt \
rescan_nr.direct.txt \
rescan_r.direct.txt \
- quote_in_comment.txt \
+ quoteincomment.txt \
quotes.txt \
top.txt \
yyextra.txt \
@@ -550,3 +551,8 @@ tableopts_ver_r%.c: tableopts.l4 $(FLEX)
tableopts_ver_r%.$(OBJEXT): tableopts_ver_r%.c
$(AM_V_CC)$(COMPILE) -DTEST_HAS_TABLES_EXTERNAL -DTEST_IS_REENTRANT -c -o $@ $<
+
+# Rules for tests generated from rulesets start here
+
+array_nr.l: array.rules testmaker.m4
+ $(SHELL) testmaker.sh array_nr.l