]> granicus.if.org Git - flex/commitdiff
refactor cxx_yywrap test for new test suite layout
authorWill Estes <westes575@gmail.com>
Tue, 24 Jun 2014 18:01:53 +0000 (14:01 -0400)
committerWill Estes <westes575@gmail.com>
Wed, 12 Nov 2014 10:14:28 +0000 (05:14 -0500)
tests/.gitignore
tests/Makefile.am
tests/cxx_yywrap.ll [moved from tests/test-c++-yywrap/scanner.l with 97% similarity]
tests/cxx_yywrap.txt [moved from tests/test-c++-yywrap/test.input with 100% similarity]
tests/test-c++-yywrap/.gitignore [deleted file]
tests/test-c++-yywrap/Makefile.am [deleted file]
tests/testwrapper.sh

index 5e1c54090f6f5bce4279c348f0f74e84243c0ace..43248bf719871d96bc22c63a95c07589e1295e3a 100644 (file)
@@ -31,6 +31,8 @@ cxx_basic
 cxx_basic.cc
 cxx_multiple_scanners
 cxx_multiple_scanners_[12].cc
+cxx_yywrap.i3
+cxx_yywrap.cc
 debug_nr
 debug_nr.c
 debug_r
index 6ebafefd05d8c0726c15a27dcfe3ad780de15713..346ed10fdb2ded3ad35bdb24ec5254d9f98f7f92 100644 (file)
@@ -27,7 +27,7 @@ TESTS = $(check_PROGRAMS) options.cn
 # automake knows how to distinguish between the various kinds of tests
 # we have.
 
-TEST_EXTENSIONS = .reject .table .direct .cn
+TEST_EXTENSIONS = .reject .table .direct .cn .i3
 
 LOG_COMPILER = $(srcdir)/testwrapper.sh
 AM_LOG_FLAGS = -d $(srcdir) -r
@@ -44,9 +44,12 @@ AM_DIRECT_LOG_FLAGS = -d $(srcdir)
 CN_LOG_COMPILER=$(srcdir)/options.cn
 AM_CN_LOG_FLAGS=$(FLEX)
 
+I3_LOG_COMPILER=$(srcdir)/testwrapper.sh
+AM_I3_LOG_FLAGS=-i $(srcdir)/cxx_yywrap.txt -i $(srcdir)/cxx_yywrap.txt -i $(srcdir)/cxx_yywrap.txt
+
 AM_YFLAGS = -d -p test
 
-check_PROGRAMS = $(simple_tests) $(reject_tests) $(TABLE_TESTS) $(DIRECT_TESTS)
+check_PROGRAMS = $(simple_tests) $(reject_tests) $(TABLE_TESTS) $(DIRECT_TESTS) $(I3_TESTS)
 
 simple_tests = \
        alloc_extra \
@@ -96,6 +99,9 @@ DIRECT_TESTS = \
        rescan_nr.direct \
        rescan_r.direct
 
+ I3_TESTS = \
+       cxx_yywrap.i3
+
 alloc_extra_SOURCES = alloc_extra.l
 array_nr_SOURCES = array_nr.l
 array_r_SOURCES = array_r.l
@@ -109,6 +115,7 @@ c_cxx_r_SOURCES = c_cxx_r.lll
 ccl_SOURCES = ccl.l
 cxx_basic_SOURCES = cxx_basic.ll
 cxx_multiple_scanners_SOURCES = cxx_multiple_scanners_main.cc cxx_multiple_scanners_1.ll cxx_multiple_scanners_2.ll
+cxx_yywrap_i3_SOURCES = cxx_yywrap.ll
 debug_nr_SOURCES = debug_nr.l
 debug_r_SOURCES = debug_r.l
 extended_SOURCES = extended.l
@@ -181,6 +188,7 @@ basic_nr.txt \
        ccl.txt \
        cxx_basic.txt \
        cxx_multiple_scanners.txt \
+       cxx_yywrap.txt \
        debug_nr.txt \
        debug_r.txt \
        extended.txt \
similarity index 97%
rename from tests/test-c++-yywrap/scanner.l
rename to tests/cxx_yywrap.ll
index 433ad084b8a22b137edef174402835155821b4a5..0947cecb15597e090d0c6eacee4683f23c1614bc 100644 (file)
@@ -28,7 +28,7 @@
 
 %}
 
-%option 8bit outfile="scanner.cpp" prefix="test"
+%option 8bit prefix="test"
 %option nounput nomain
 %option warn c++
 
diff --git a/tests/test-c++-yywrap/.gitignore b/tests/test-c++-yywrap/.gitignore
deleted file mode 100644 (file)
index 31ef089..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-Makefile
-Makefile.in
-scanner.cpp
-OUTPUT
-.deps
-test-c++-yywrap
diff --git a/tests/test-c++-yywrap/Makefile.am b/tests/test-c++-yywrap/Makefile.am
deleted file mode 100644 (file)
index 014452b..0000000
+++ /dev/null
@@ -1,45 +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.cpp scanner.h $(testname)$(EXEEXT) OUTPUT $(OBJS)
-OBJS = scanner.o
-
-AM_CPPFLAGS = -I$(srcdir) -I$(top_srcdir) -I$(top_builddir)
-LFLAGS = -+
-#LDFLAGS = 
-
-testname = test-c++-yywrap
-
-scanner.cpp: $(srcdir)/scanner.l
-       $(FLEX) $(LFLAGS) $<
-
-$(testname)$(EXEEXT): $(OBJS)
-       $(CXX) $(CXXFLAGS) -o $@ $(LDFLAGS) $(OBJS)
-
-test: $(testname)$(EXEEXT)
-       ./$(testname)$(EXEEXT) $(srcdir)/test.input $(srcdir)/test.input $(srcdir)/test.input
-
-.cpp.o:
-       $(CXX) $(CXXFLAGS) -c -o $@ $(AM_CPPFLAGS) $(CPPFLAGS) $<
index 97f2a88c573e0cb4f5ec99c89810765c63554274..2d0b7b77455ada044007cd70209aa662c79f429f 100755 (executable)
@@ -6,12 +6,20 @@
 
 INPUT_DIRECTORY=""
 INPUT_NAME=""
+INPUT_COUNT=0
 USE_REDIRECT=0
 
 while getopts :d:i:rt OPTION ; do
     case $OPTION in
         d) INPUT_DIRECTORY=$OPTARG ;;
-        i) INPUT_NAME="$OPTARG" ;;
+        i)
+            if [ "$INPUT_NAME" == "" ] ; then
+                INPUT_NAME="$OPTARG"
+            else
+                INPUT_NAME="$INPUT_NAME $OPTARG"
+            fi
+            INPUT_COUNT=$(($INPUT_COUNT+1))
+            ;;
         r) USE_REDIRECT=1 ;;
         t) USE_TABLES=1 ;;
     esac
@@ -21,6 +29,11 @@ TESTNAME="${!OPTIND}"
 
 INPUT_NAME=${INPUT_NAME:-`basename $TESTNAME`.txt}
 
+if [ $INPUT_COUNT -gt 1 ] ; then
+    $TESTNAME ${USE_TABLES:+${INPUT_DIRECTORY}/${TESTNAME}.tables} ${INPUT_NAME}
+    exit $?
+    fi
+
 if [ -f ${INPUT_DIRECTORY}/${INPUT_NAME} ] ; then
     if [ $USE_REDIRECT == 1 ] ; then
         $TESTNAME ${USE_TABLES:+${INPUT_DIRECTORY}/${TESTNAME}.tables} < $INPUT_DIRECTORY/$INPUT_NAME