summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorWill Estes <westes575@gmail.com>2014-06-03 17:49:50 -0400
committerWill Estes <westes575@gmail.com>2014-11-12 05:14:26 -0500
commitbb00ab6892df1799c25790cf2f48c9260f4ff059 (patch)
tree09bb3f216dfa59b54bae8fbc5217ed7f1df915d0 /tests
parentce15230f4796ddd57c8de075aece398f7fa96f2e (diff)
refactor bison-nr test for new test suite layout
Diffstat (limited to 'tests')
-rw-r--r--tests/.gitignore4
-rw-r--r--tests/Makefile.am17
-rw-r--r--tests/bison-nr-main.c (renamed from tests/test-bison-nr/main.c)4
-rw-r--r--tests/bison-nr-parser.y (renamed from tests/test-bison-nr/parser.y)0
-rw-r--r--tests/bison-nr-scanner.l (renamed from tests/test-bison-nr/scanner.l)6
-rw-r--r--tests/bison-nr.txt (renamed from tests/test-bison-nr/test.input)0
-rw-r--r--tests/test-bison-nr/.gitignore10
-rw-r--r--tests/test-bison-nr/Makefile.am55
8 files changed, 24 insertions, 72 deletions
diff --git a/tests/.gitignore b/tests/.gitignore
index 2f3113a..fd7c410 100644
--- a/tests/.gitignore
+++ b/tests/.gitignore
@@ -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]
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 63bbadd..1d23e40 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -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
diff --git a/tests/test-bison-nr/main.c b/tests/bison-nr-main.c
index 49dde7c..edc4d14 100644
--- a/tests/test-bison-nr/main.c
+++ b/tests/bison-nr-main.c
@@ -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);
diff --git a/tests/test-bison-nr/parser.y b/tests/bison-nr-parser.y
index 2cbf9aa..2cbf9aa 100644
--- a/tests/test-bison-nr/parser.y
+++ b/tests/bison-nr-parser.y
diff --git a/tests/test-bison-nr/scanner.l b/tests/bison-nr-scanner.l
index 2510de6..4d35095 100644
--- a/tests/test-bison-nr/scanner.l
+++ b/tests/bison-nr-scanner.l
@@ -25,16 +25,16 @@
/* 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/test.input b/tests/bison-nr.txt
index 94adcb2..94adcb2 100644
--- a/tests/test-bison-nr/test.input
+++ b/tests/bison-nr.txt
diff --git a/tests/test-bison-nr/.gitignore b/tests/test-bison-nr/.gitignore
deleted file mode 100644
index 6208bd5..0000000
--- a/tests/test-bison-nr/.gitignore
+++ /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
index 9bc8af3..0000000
--- a/tests/test-bison-nr/Makefile.am
+++ /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) $<