]> granicus.if.org Git - flex/commitdiff
refactor bison-nr test for new test suite layout
authorWill Estes <westes575@gmail.com>
Tue, 3 Jun 2014 21:49:50 +0000 (17:49 -0400)
committerWill Estes <westes575@gmail.com>
Wed, 12 Nov 2014 10:14:26 +0000 (05:14 -0500)
tests/.gitignore
tests/Makefile.am
tests/bison-nr-main.c [moved from tests/test-bison-nr/main.c with 95% similarity]
tests/bison-nr-parser.y [moved from tests/test-bison-nr/parser.y with 100% similarity]
tests/bison-nr-scanner.l [moved from tests/test-bison-nr/scanner.l with 93% similarity]
tests/bison-nr.txt [moved from tests/test-bison-nr/test.input with 100% similarity]
tests/test-bison-nr/.gitignore [deleted file]
tests/test-bison-nr/Makefile.am [deleted file]

index 2f3113abf1199381bf0764ee2cf1c32426e19c23..fd7c410c1d2adfb71c1074476f1fbc02a529f2fd 100644 (file)
@@ -1,4 +1,5 @@
 *.log
+*.trs
 *.o
 alloc-extra
 alloc-extra.c
@@ -10,3 +11,6 @@ basic-nr
 basic-nr.c
 basic-r
 basic-r.c
+bison-nr
+bison-nr-scanner.[ch]
+bison-nr-parser.[ch]
index 63bbadd4aeb24924bb0ea93140d15c61e82a6271..1d23e40f8dc1ae95ad4569ef7f8f1516f7539314 100644 (file)
@@ -24,18 +24,26 @@ TESTS = $(check_PROGRAMS)
 LOG_COMPILER = $(srcdir)/testwrapper.sh
 AM_LOG_FLAGS = $(srcdir)
 
+AM_YFLAGS = -d -p test
+
 check_PROGRAMS = \
        alloc-extra \
        array-nr \
        array-r \
        basic-nr \
-       basic-r
+       basic-r \
+       bison-nr
 
 alloc_extra_SOURCES = alloc-extra.l
 array_nr_SOURCES = array-nr.l
 array_r_SOURCES = array-r.l
 basic_nr_SOURCES = basic-nr.l
 basic_r_SOURCES = basic-r.l
+bison_nr_SOURCES = bison-nr-scanner.l bison-nr-parser.y bison-nr-main.c
+
+BUILT_SOURCES = \
+       bison-nr-scanner.h \
+       bison-nr-parser.h
 
 EXTRA_DIST = \
        README \
@@ -44,7 +52,9 @@ EXTRA_DIST = \
        array-nr.txt \
        array-r.txt \
 basic-nr.txt \
-       basic-r.txt
+       basic-r.txt \
+       bison-nr-scanner.h \
+       bison-nr.txt
 
 # specify how to process .l files in order to test the flex built by make all
 
@@ -52,3 +62,6 @@ FLEX = $(top_builddir)/src/flex
 
 .l.c:
        $(FLEX) -o $@ $<
+
+bison-nr-main($objext): bison-nr-parser.h bison-nr-scanner.h
+bison-nr-scanner.h: bison-nr-scanner.c
similarity index 95%
rename from tests/test-bison-nr/main.c
rename to tests/bison-nr-main.c
index 49dde7c69b1a116d872f67e0b1e8683d98cdbe3c..edc4d14f4892a82194c016eebe339c058250d365 100644 (file)
@@ -21,8 +21,8 @@
  * PURPOSE.
  */
 
-#include "parser.h"
-#include "scanner.h"
+#include "bison-nr-parser.h"
+#include "bison-nr-scanner.h"
 
 extern int testparse(void);
 
similarity index 93%
rename from tests/test-bison-nr/scanner.l
rename to tests/bison-nr-scanner.l
index 2510de6d624e117f6f56de090f3997e01bf56c21..4d35095dbf90978420fe2fa2a7625e4fe3a312ef 100644 (file)
 /* The scanner expects to link to bison yylval . */
 #include <stdio.h>
 #include <stdlib.h>
-#include "parser.h"
+#include "bison-nr-parser.h"
 #include "config.h"
 static char* STRDUP(char* s1);
 #define YY_EXTRA_TYPE int
 %}
 
-%option 8bit outfile="scanner.c" prefix="test"
+%option 8bit prefix="test"
 %option bison-locations yylineno
 %option nomain nounput noyy_top_state noyywrap nodefault warn
-%option prefix="test" header="scanner.h" yylineno
+%option prefix="test" header="bison-nr-scanner.h" yylineno
 
 
 %%
diff --git a/tests/test-bison-nr/.gitignore b/tests/test-bison-nr/.gitignore
deleted file mode 100644 (file)
index 6208bd5..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-Makefile
-Makefile.in
-parser.c
-parser.h
-scanner.c
-TEMPLATE
-OUTPUT
-.deps
-test-bison-nr
-scanner.h
diff --git a/tests/test-bison-nr/Makefile.am b/tests/test-bison-nr/Makefile.am
deleted file mode 100644 (file)
index 9bc8af3..0000000
+++ /dev/null
@@ -1,55 +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 parser.y test.input main.c
-CLEANFILES = scanner.c scanner.h parser.c parser.h $(testname)$(EXEEXT) $(OBJS) OUTPUT
-OBJS = scanner.o parser.o main.o
-
-AM_CPPFLAGS = -I$(srcdir) -I$(top_srcdir) -I$(top_builddir) -I$(builddir)
-#LDFLAGS = $(top_srcdir)/libfl.a 
-YFLAGS = --defines --output=parser.c --name-prefix="test"
-
-testname = test-bison-nr
-
-scanner.c: $(srcdir)/scanner.l
-       $(FLEX) $<
-scanner.h: scanner.c
-scanner.o: parser.h
-
-parser.c: $(srcdir)/parser.y
-       $(BISON) $(YFLAGS) $<
-parser.h: parser.c
-
-main.o: scanner.h parser.h
-
-$(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) $<