summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorWill Estes <westes575@gmail.com>2014-06-16 19:59:21 -0400
committerWill Estes <westes575@gmail.com>2014-11-12 05:14:27 -0500
commitdd021b412c7e5b5ce504857dc93c494c6c0569bd (patch)
tree618fa245a9fd49ee7ebd026391ae00f481f50750 /tests
parent43e17a87dbba400ec0b849de01d4c16c21e39f95 (diff)
Refactor rescan_nr test for new test suite layout.
Also add -r option to testwrapper.sh to support passing input file as a command line argument to the test scanner without using shell redirection.
Diffstat (limited to 'tests')
-rw-r--r--tests/.gitignore2
-rw-r--r--tests/Makefile.am16
-rw-r--r--tests/rescan_nr.l (renamed from tests/test-rescan-nr/scanner.l)2
-rw-r--r--tests/rescan_nr.txt (renamed from tests/test-rescan-nr/test.input)0
-rw-r--r--tests/test-rescan-nr/.gitignore9
-rw-r--r--tests/test-rescan-nr/Makefile.am47
-rwxr-xr-xtests/testwrapper.sh5
7 files changed, 18 insertions, 63 deletions
diff --git a/tests/.gitignore b/tests/.gitignore
index 788e118..bd38e11 100644
--- a/tests/.gitignore
+++ b/tests/.gitignore
@@ -69,6 +69,8 @@ reject_ver.table
reject_ver.table.c
reject_ser.table
reject_ser.table.c
+rescan_nr
+rescan_nr.c
quotes
quotes.c
string_nr
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 72b680b..0f170f0 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -27,20 +27,23 @@ TESTS = $(check_PROGRAMS)
# automake knows how to distinguish between the various kinds of tests
# we have.
-TEST_EXTENSIONS = .reject .table
+TEST_EXTENSIONS = .reject .table .direct
LOG_COMPILER = $(srcdir)/testwrapper.sh
-AM_LOG_FLAGS = -d $(srcdir)
+AM_LOG_FLAGS = -d $(srcdir) -r
REJECT_LOG_COMPILER = $(srcdir)/testwrapper.sh
-AM_REJECT_LOG_FLAGS = -d $(srcdir) -i reject.txt
+AM_REJECT_LOG_FLAGS = -d $(srcdir) -i reject.txt -r
TABLE_LOG_COMPILER = $(srcdir)/testwrapper.sh
AM_TABLE_LOG_FLAGS = -d $(srcdir) -i reject.txt -t
+DIRECT_LOG_COMPILER=$(srcdir)/testwrapper.sh
+AM_DIRECT_LOG_FLAGS = -d $(srcdir)
+
AM_YFLAGS = -d -p test
-check_PROGRAMS = $(simple_tests) $(reject_tests) $(TABLE_TESTS)
+check_PROGRAMS = $(simple_tests) $(reject_tests) $(TABLE_TESTS) $(DIRECT_TESTS)
simple_tests = \
alloc_extra \
@@ -85,6 +88,9 @@ TABLE_TESTS = \
reject_ver.table \
reject_ser.table
+DIRECT_TESTS = \
+ rescan_nr
+
alloc_extra_SOURCES = alloc_extra.l
array_nr_SOURCES = array_nr.l
array_r_SOURCES = array_r.l
@@ -118,6 +124,7 @@ reject_nr_reject_SOURCES = reject.l4
reject_r_reject_SOURCES = reject.l4
reject_ver_table_SOURCES = reject.l4
reject_ser_table_SOURCES = reject.l4
+rescan_nr_SOURCES = rescan_nr.l
string_nr_SOURCES = string_nr.l
string_r_SOURCES = string_r.l
top_SOURCES = top.l top_main.c
@@ -187,6 +194,7 @@ basic_nr.txt \
reject_r.reject.c \
reject_ver.table.c \
reject_ser.table.c \
+ rescan_nr.txt \
quotes.txt \
top.h \
top.txt \
diff --git a/tests/test-rescan-nr/scanner.l b/tests/rescan_nr.l
index a4ac521..18f29bb 100644
--- a/tests/test-rescan-nr/scanner.l
+++ b/tests/rescan_nr.l
@@ -27,7 +27,7 @@
#include <stdlib.h>
%}
-%option 8bit outfile="scanner.c" prefix="test"
+%option 8bit prefix="test"
%option nounput nomain noyywrap
%option warn stack never-interactive
%x STATE_1
diff --git a/tests/test-rescan-nr/test.input b/tests/rescan_nr.txt
index 7288a40..7288a40 100644
--- a/tests/test-rescan-nr/test.input
+++ b/tests/rescan_nr.txt
diff --git a/tests/test-rescan-nr/.gitignore b/tests/test-rescan-nr/.gitignore
deleted file mode 100644
index eb11008..0000000
--- a/tests/test-rescan-nr/.gitignore
+++ /dev/null
@@ -1,9 +0,0 @@
-Makefile
-Makefile.in
-parser.c
-parser.h
-scanner.c
-TEMPLATE
-OUTPUT
-.deps
-test-rescan-nr
diff --git a/tests/test-rescan-nr/Makefile.am b/tests/test-rescan-nr/Makefile.am
deleted file mode 100644
index 3d23a55..0000000
--- a/tests/test-rescan-nr/Makefile.am
+++ /dev/null
@@ -1,47 +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
-
-builddir = @builddir@
-
-EXTRA_DIST = scanner.l test.input
-CLEANFILES = scanner.c scanner.h $(testname)$(EXEEXT) OUTPUT $(OBJS)
-OBJS = scanner.o
-
-AM_CPPFLAGS = -I$(srcdir) -I$(builddir) -I$(top_srcdir) -I$(top_builddir)
-#LDFLAGS = $(top_srcdir)/libfl.a
-#LFLAGS = --header="scanner.h"
-#YFLAGS = --defines --output=parser.c
-
-testname = test-rescan-nr
-
-scanner.c: $(srcdir)/scanner.l
- $(FLEX) $(LFLAGS) $<
-
-$(testname)$(EXEEXT): $(OBJS)
- $(CC) $(CFLAGS) -o $@ $(LDFLAGS) $(OBJS) $(LOADLIBES)
-
-test: $(testname)$(EXEEXT)
- ./$(testname)$(EXEEXT) $(srcdir)/test.input
-
-.c.o:
- $(CC) -c -o $@ $(AM_CPPFLAGS) $(CPPFLAGS) $(CFLAGS) $<
diff --git a/tests/testwrapper.sh b/tests/testwrapper.sh
index dd8c077..24a209f 100755
--- a/tests/testwrapper.sh
+++ b/tests/testwrapper.sh
@@ -7,10 +7,11 @@
INPUT_DIRECTORY=""
INPUT_NAME=""
-while getopts :d:i:t OPTION ; do
+while getopts :d:i:rt OPTION ; do
case $OPTION in
d) INPUT_DIRECTORY=$OPTARG ;;
i) INPUTNAME="$OPTARG" ;;
+ r) USE_REDIRECT=1 ;;
t) USE_TABLES=1 ;;
esac
done
@@ -20,7 +21,7 @@ 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
+ $TESTNAME ${USE_TABLES:+${INPUT_DIRECTORY}${TESTNAME}} ${USE_REDIRECT:+'<'} $INPUT_DIRECTORY/$INPUT_NAME
else
$TESTNAME
fi