From da730230ce159265f4380daa456e3e3c5f9422f4 Mon Sep 17 00:00:00 2001 From: "Joel E. Denny" Date: Sat, 22 Dec 2007 18:35:03 +0000 Subject: [PATCH] Automate regression testing of the XML/XSLT implementation. Discussed starting at . * configure.ac (XSLTPROC): New substitution. * Makefile.am (maintainer-xml-check): New phony target invoking... * tests/Makefile.am (maintainer-xml-check): ... this new phony target invoking make maintainer-check with BISON_TEST_XML=1. * tests/atlocal.in (XSLTPROC): New. * tests/local.at (AT_BISON_CHECK): New macro to (1) instruct Valgrind not to report reachable memory when Bison is expected to have a non-zero exit status and (2) to compare XML/XSLT output with --graph and --report=all output for every working grammar when BISON_TEST_XML=1. (AT_BISON_CHECK_NO_XML): Likewise, but skip XML checks. (AT_BISON_CHECK_XML): New. (AT_QUELL_VALGRIND): New. * tests/testsuite.at (ORIGINAL_AT_CHECK): Remove this and... (AT_CHECK): ... don't redefine this since this was the old way to quell Valgrind. * tests/actions.at: Rewrite all AT_CHECK invocations for bison as AT_BISON_CHECK invocations. * tests/c++.at: Likewise. * tests/calc.at: Likewise. * tests/conflicts.at: Likewise. * tests/cxx-type.at: Likewise. * tests/existing.at: Likewise. * tests/glr-regression.at: Likewise. * tests/headers.at: Likewise. * tests/input.at: Likewise. * tests/java.at: Likewise. * tests/output.at: Likewise. * tests/push.at: Likewise. * tests/reduce.at: Likewise. * tests/regression.at: Likewise. * tests/sets.at: Likewise. * tests/skeletons.at: Likewise. * tests/synclines.at: Likewise. * tests/torture.at: Likewise. (Big triangle): Use AT_BISON_CHECK_NO_XML instead since this grammar tends to hang xsltproc. (Big horizontal): Likewise. --- ChangeLog | 44 +++++++++++++++++++++++++ Makefile.am | 4 +++ configure.ac | 2 ++ tests/Makefile.am | 4 +++ tests/actions.at | 22 ++++++------- tests/atlocal.in | 3 ++ tests/c++.at | 4 +-- tests/calc.at | 4 +-- tests/conflicts.at | 32 +++++++++--------- tests/cxx-type.at | 2 +- tests/existing.at | 6 ++-- tests/glr-regression.at | 36 ++++++++++---------- tests/headers.at | 8 ++--- tests/input.at | 58 ++++++++++++++++---------------- tests/java.at | 2 +- tests/local.at | 73 +++++++++++++++++++++++++++++++++++++++++ tests/output.at | 8 ++--- tests/push.at | 6 ++-- tests/reduce.at | 14 ++++---- tests/regression.at | 48 +++++++++++++-------------- tests/sets.at | 10 +++--- tests/skeletons.at | 24 +++++++------- tests/synclines.at | 4 +-- tests/testsuite.at | 12 ------- tests/torture.at | 8 ++--- 25 files changed, 278 insertions(+), 160 deletions(-) diff --git a/ChangeLog b/ChangeLog index 558cfee8..9aa34470 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,47 @@ +2007-12-22 Joel E. Denny + + Automate regression testing of the XML/XSLT implementation. Discussed + starting at + . + * configure.ac (XSLTPROC): New substitution. + * Makefile.am (maintainer-xml-check): New phony target invoking... + * tests/Makefile.am (maintainer-xml-check): ... this new phony target + invoking make maintainer-check with BISON_TEST_XML=1. + * tests/atlocal.in (XSLTPROC): New. + * tests/local.at (AT_BISON_CHECK): New macro to (1) instruct Valgrind + not to report reachable memory when Bison is expected to have a + non-zero exit status and (2) to compare XML/XSLT output with --graph + and --report=all output for every working grammar when + BISON_TEST_XML=1. + (AT_BISON_CHECK_NO_XML): Likewise, but skip XML checks. + (AT_BISON_CHECK_XML): New. + (AT_QUELL_VALGRIND): New. + * tests/testsuite.at (ORIGINAL_AT_CHECK): Remove this and... + (AT_CHECK): ... don't redefine this since this was the old way to + quell Valgrind. + * tests/actions.at: Rewrite all AT_CHECK invocations for bison as + AT_BISON_CHECK invocations. + * tests/c++.at: Likewise. + * tests/calc.at: Likewise. + * tests/conflicts.at: Likewise. + * tests/cxx-type.at: Likewise. + * tests/existing.at: Likewise. + * tests/glr-regression.at: Likewise. + * tests/headers.at: Likewise. + * tests/input.at: Likewise. + * tests/java.at: Likewise. + * tests/output.at: Likewise. + * tests/push.at: Likewise. + * tests/reduce.at: Likewise. + * tests/regression.at: Likewise. + * tests/sets.at: Likewise. + * tests/skeletons.at: Likewise. + * tests/synclines.at: Likewise. + * tests/torture.at: Likewise. + (Big triangle): Use AT_BISON_CHECK_NO_XML instead since this grammar + tends to hang xsltproc. + (Big horizontal): Likewise. + 2007-12-08 Joel E. Denny In XML output, remove redundant class attribute on symbol element. diff --git a/Makefile.am b/Makefile.am index 7c90ef7f..bd91aff4 100644 --- a/Makefile.am +++ b/Makefile.am @@ -38,3 +38,7 @@ maintainer-check: .PHONY: maintainer-push-check maintainer-push-check: cd tests && $(MAKE) $(AM_MAKEFLAGS) $@ + +.PHONY: maintainer-xml-check +maintainer-xml-check: + cd tests && $(MAKE) $(AM_MAKEFLAGS) $@ diff --git a/configure.ac b/configure.ac index ecdb662e..5e4da1ff 100644 --- a/configure.ac +++ b/configure.ac @@ -92,6 +92,8 @@ if test x"$ac_cv_prog_gnu_m4" != xyes; then fi AC_DEFINE_UNQUOTED([M4], ["$M4"], [Define to the GNU M4 executable name.]) AM_MISSING_PROG([HELP2MAN], [help2man]) +AC_PATH_PROG([XSLTPROC], [xsltproc]) +AC_SUBST([XSLTPROC]) # Checks for header files. AC_CHECK_HEADERS_ONCE([locale.h]) diff --git a/tests/Makefile.am b/tests/Makefile.am index d6a9c5a4..ab15a76a 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -97,3 +97,7 @@ maintainer-check: maintainer-check-posix maintainer-check-valgrind maintainer-ch .PHONY: maintainer-push-check maintainer-push-check: BISON_USE_PUSH_FOR_PULL=1 $(MAKE) $(AM_MAKEFLAGS) maintainer-check + +.PHONY: maintainer-xml-check +maintainer-xml-check: + BISON_TEST_XML=1 $(MAKE) $(AM_MAKEFLAGS) maintainer-check diff --git a/tests/actions.at b/tests/actions.at index e17f7003..602eac8c 100644 --- a/tests/actions.at +++ b/tests/actions.at @@ -74,7 +74,7 @@ main (void) } ]]) -AT_CHECK([bison -d -v -o input.c input.y]) +AT_BISON_CHECK([-d -v -o input.c input.y]) AT_COMPILE([input]) AT_PARSER_CHECK([./input], 0, [[0123456789 @@ -152,7 +152,7 @@ main (void) } ]]) -AT_CHECK([bison -d -v -o input.c input.y], 0) +AT_BISON_CHECK([-d -v -o input.c input.y], 0) AT_COMPILE([input]) AT_PARSER_CHECK([./input], 0, [[15 @@ -368,9 +368,9 @@ main (int argc, const char *argv[]) ]]) AT_LALR1_CC_IF( - [AT_CHECK([bison -o input.cc input.y]) + [AT_BISON_CHECK([-o input.cc input.y]) AT_COMPILE_CXX([input])], - [AT_CHECK([bison -o input.c input.y]) + [AT_BISON_CHECK([-o input.c input.y]) AT_COMPILE([input])]) @@ -663,7 +663,7 @@ main (void) } ]]) -AT_CHECK([bison -o input.c input.y]) +AT_BISON_CHECK([-o input.c input.y]) AT_COMPILE([input]) AT_PARSER_CHECK([./input], 1, [[<> destructor for 'd' @ 4. @@ -788,7 +788,7 @@ main (void) } ]]) -AT_CHECK([bison -o input.c input.y]) +AT_BISON_CHECK([-o input.c input.y]) AT_COMPILE([input]) AT_PARSER_CHECK([./input], 1, [[<*>//e destructor. @@ -923,7 +923,7 @@ main (void) } ]]) -AT_CHECK([bison -o input$1.c input$1.y]) +AT_BISON_CHECK([-o input$1.c input$1.y]) AT_COMPILE([input$1]) AT_PARSER_CHECK([./input$1], 0, [[<]]kind[[> for 'E' @ 1. @@ -1023,7 +1023,7 @@ main (void) } ]]) -AT_CHECK([bison -o input.c input.y]) +AT_BISON_CHECK([-o input.c input.y]) AT_COMPILE([input]) AT_PARSER_CHECK([./input], [1], [], [[Starting parse @@ -1134,7 +1134,7 @@ main (void) } ]]) -AT_CHECK([bison -o input.c input.y]) +AT_BISON_CHECK([-o input.c input.y]) AT_COMPILE([input]) AT_CLEANUP @@ -1202,7 +1202,7 @@ main (void) } ]]) -AT_CHECK([bison -o input.c input.y], 0,, +AT_BISON_CHECK([-o input.c input.y], 0,, [[input.y:33.3-23: warning: unset value: $$ input.y:30.3-35.37: warning: unused value: $3 ]]) @@ -1296,7 +1296,7 @@ main (void) } ]]) -AT_CHECK([[bison -o input.c input.y]]) +AT_BISON_CHECK([[-o input.c input.y]]) AT_COMPILE([[input]]) AT_CLEANUP]) diff --git a/tests/atlocal.in b/tests/atlocal.in index e0ec0388..9fd930e5 100644 --- a/tests/atlocal.in +++ b/tests/atlocal.in @@ -36,3 +36,6 @@ CONF_JAVAC='@CONF_JAVAC@' # Empty if no Java VM was found CONF_JAVA='@CONF_JAVA@' + +# Empty if no xsltproc was found +XSLTPROC='@XSLTPROC@' diff --git a/tests/c++.at b/tests/c++.at index 631e063e..3e742ee2 100644 --- a/tests/c++.at +++ b/tests/c++.at @@ -42,7 +42,7 @@ yy::parser::error (const location& l, const std::string& m) } ]]) -AT_CHECK([bison -o input.cc input.yy], 0) +AT_BISON_CHECK([-o input.cc input.yy], 0) AT_DATA([Doxyfile], [# The PROJECT_NAME tag is a single word (or a sequence of words @@ -148,7 +148,7 @@ main (void) } ]]) -AT_CHECK([[bison -o input.cc input.y]]) +AT_BISON_CHECK([[-o input.cc input.y]]) m4_if([$#], [1], [AT_COMPILE_CXX([[input]], [[input.cc]]) diff --git a/tests/calc.at b/tests/calc.at index 2fb4d72b..189b5b35 100644 --- a/tests/calc.at +++ b/tests/calc.at @@ -455,9 +455,9 @@ AT_BISON_OPTION_PUSHDEFS([$1]) AT_DATA_CALC_Y([$1]) AT_SKEL_CC_IF( - [AT_CHECK([bison -o calc.cc calc.y]) + [AT_BISON_CHECK([-o calc.cc calc.y]) AT_COMPILE_CXX([calc])], - [AT_CHECK([bison -o calc.c calc.y]) + [AT_BISON_CHECK([-o calc.c calc.y]) AT_COMPILE([calc])]) # Test the priorities. diff --git a/tests/conflicts.at b/tests/conflicts.at index 8032256e..866b9441 100644 --- a/tests/conflicts.at +++ b/tests/conflicts.at @@ -36,7 +36,7 @@ exp: e 'e'; e: 'e' | /* Nothing. */; ]]) -AT_CHECK([bison -o input.c input.y], 0, [], +AT_BISON_CHECK([-o input.c input.y], 0, [], [[input.y:4.9: warning: rule useless in parser due to conflicts: e: /* empty */ ]]) @@ -94,7 +94,7 @@ main (int argc, const char *argv[]) ]]) # Specify the output files to avoid problems on different file systems. -AT_CHECK([bison -o input.c input.y]) +AT_BISON_CHECK([-o input.c input.y]) AT_COMPILE([input]) AT_PARSER_CHECK([./input '0<0']) @@ -132,7 +132,7 @@ AT_DATA([input.y], exp: exp OP exp | NUM; ]]) -AT_CHECK([bison -o input.c --report=all input.y], 0, [], +AT_BISON_CHECK([-o input.c --report=all input.y], 0, [], [input.y: conflicts: 1 shift/reduce ]) @@ -240,7 +240,7 @@ AT_DATA([input.y], exp: exp OP exp | NUM; ]]) -AT_CHECK([bison -o input.c --report=all input.y]) +AT_BISON_CHECK([-o input.c --report=all input.y]) # Check the contents of the report. AT_CHECK([cat input.output], [], @@ -362,7 +362,7 @@ id : '0'; %% ]]) -AT_CHECK([bison -o input.c --report=all input.y], 0, [], +AT_BISON_CHECK([-o input.c --report=all input.y], 0, [], [[input.y: conflicts: 1 reduce/reduce input.y:4.6-8: warning: rule useless in parser due to conflicts: id: '0' ]]) @@ -479,7 +479,7 @@ AT_DATA([input.y], exp: exp OP exp | NUM; ]]) -AT_CHECK([bison -o input.c input.y], 1, [], +AT_BISON_CHECK([-o input.c input.y], 1, [], [input.y: conflicts: 1 shift/reduce input.y: expected 0 shift/reduce conflicts ]) @@ -499,7 +499,7 @@ AT_DATA([input.y], exp: exp OP exp | NUM; ]]) -AT_CHECK([bison -o input.c input.y]) +AT_BISON_CHECK([-o input.c input.y]) AT_CLEANUP @@ -516,7 +516,7 @@ AT_DATA([input.y], exp: exp OP exp | NUM; ]]) -AT_CHECK([bison -o input.c input.y], 1, [], +AT_BISON_CHECK([-o input.c input.y], 1, [], [input.y: conflicts: 1 shift/reduce input.y: expected 2 shift/reduce conflicts ]) @@ -536,7 +536,7 @@ program: a 'a' | a a; a: 'a'; ]]) -AT_CHECK([bison -o input.c input.y], 1, [], +AT_BISON_CHECK([-o input.c input.y], 1, [], [input.y: conflicts: 1 reduce/reduce input.y: expected 0 reduce/reduce conflicts ]) @@ -563,7 +563,7 @@ e: e '+' e ; ]]) -AT_CHECK([bison -o input.c input.y], 0, [], +AT_BISON_CHECK([-o input.c input.y], 0, [], [[input.y: conflicts: 4 shift/reduce ]]) AT_CLEANUP @@ -589,7 +589,7 @@ e: e '+' e %prec '+' ; ]]) -AT_CHECK([bison -o input.c input.y]) +AT_BISON_CHECK([-o input.c input.y]) AT_CLEANUP @@ -613,7 +613,7 @@ e: e '+' e ; ]]) -AT_CHECK([bison -o input.c input.y]) +AT_BISON_CHECK([-o input.c input.y]) AT_CLEANUP @@ -665,7 +665,7 @@ reported_conflicts: ]]) -AT_CHECK([[bison --report=all input.y]], 0, [], +AT_BISON_CHECK([[--report=all input.y]], 0, [], [[input.y: conflicts: 1 shift/reduce, 1 reduce/reduce input.y:12.5-20: warning: rule useless in parser due to conflicts: resolved_conflict: 'a' unreachable1 input.y:20.5-20: warning: rule useless in parser due to conflicts: unreachable1: 'a' unreachable2 @@ -817,7 +817,7 @@ AT_DATA([[input-keep.y]], ]]) AT_CHECK([[cat input.y >> input-keep.y]]) -AT_CHECK([[bison input-keep.y]], 0, [], +AT_BISON_CHECK([[input-keep.y]], 0, [], [[input-keep.y: conflicts: 2 shift/reduce, 2 reduce/reduce input-keep.y:22.4: warning: rule useless in parser due to conflicts: unreachable1: /* empty */ input-keep.y:26.16: warning: rule useless in parser due to conflicts: unreachable2: /* empty */ @@ -858,7 +858,7 @@ empty_c1: %prec 'c' ; empty_c2: %prec 'c' ; empty_c3: %prec 'd' ; ]]) -AT_CHECK([[bison --report=all -o input.c input.y]], 0, [], [ignore]) +AT_BISON_CHECK([[--report=all -o input.c input.y]], 0, [], [ignore]) AT_CHECK([[cat input.output | sed -n '/^state 0$/,/^state 1$/p']], 0, [[state 0 @@ -934,7 +934,7 @@ empty_c2: %prec 'c' ; empty_c3: %prec 'c' ; ]]) -AT_CHECK([[bison --report=all -o input.c input.y]], 0, [], [ignore]) +AT_BISON_CHECK([[--report=all -o input.c input.y]], 0, [], [ignore]) AT_CHECK([[cat input.output | sed -n '/^state 0$/,/^state 1$/p']], 0, [[state 0 diff --git a/tests/cxx-type.at b/tests/cxx-type.at index cb378284..0725bfc1 100644 --- a/tests/cxx-type.at +++ b/tests/cxx-type.at @@ -345,7 +345,7 @@ z + q; This is total garbage, but it should be ignored. ]]) -AT_CHECK([bison -o types.c types.y], 0, [], ignore) +AT_BISON_CHECK([-o types.c types.y], 0, [], ignore) AT_COMPILE([types]) AT_BISON_OPTION_POPDEFS ]) diff --git a/tests/existing.at b/tests/existing.at index 9b519b2b..ba2c40cb 100644 --- a/tests/existing.at +++ b/tests/existing.at @@ -351,7 +351,7 @@ comma : ',' opt_nls # Pass plenty of options, to exercise plenty of code, even if we # don't actually check the output. But SEGV is watching us, and # so might do dmalloc. -AT_CHECK([[bison --verbose --defines input.y]]) +AT_BISON_CHECK([[--verbose --defines input.y]]) AT_CLEANUP @@ -953,7 +953,7 @@ ARGUMENT_LIST : EXPRESSION # Pass plenty of options, to exercise plenty of code, even if we # don't actually check the output. But SEGV is watching us, and # so might do dmalloc. -AT_CHECK([[bison --verbose --defines input.y]], 0, [], +AT_BISON_CHECK([[--verbose --defines input.y]], 0, [], [[input.y: conflicts: 78 shift/reduce, 10 reduce/reduce ]]) @@ -1518,7 +1518,7 @@ expr: # Pass plenty of options, to exercise plenty of code, even if we # don't actually check the output. But SEGV is watching us, and # so might do dmalloc. -AT_CHECK([[bison --verbose --defines input.y]], 0, [], +AT_BISON_CHECK([[--verbose --defines input.y]], 0, [], [[input.y:453.11-48: warning: rule useless in parser due to conflicts: path: ORDINAL LAST object_type relative_path ]]) diff --git a/tests/glr-regression.at b/tests/glr-regression.at index cdd1de2b..2f719260 100644 --- a/tests/glr-regression.at +++ b/tests/glr-regression.at @@ -93,7 +93,7 @@ yylex (void) } ]]) -AT_CHECK([[bison -o glr-regr1.c glr-regr1.y]], 0, [], +AT_BISON_CHECK([[-o glr-regr1.c glr-regr1.y]], 0, [], [glr-regr1.y: conflicts: 1 shift/reduce ]) AT_COMPILE([glr-regr1]) @@ -211,7 +211,7 @@ main (int argc, char **argv) } ]]) -AT_CHECK([[bison -o glr-regr2a.c glr-regr2a.y]], 0, [], +AT_BISON_CHECK([[-o glr-regr2a.c glr-regr2a.y]], 0, [], [glr-regr2a.y: conflicts: 2 shift/reduce ]) AT_COMPILE([glr-regr2a]) @@ -325,7 +325,7 @@ int main(int argc, char* argv[]) { } ]]) -AT_CHECK([[bison -o glr-regr3.c glr-regr3.y]], 0, [], +AT_BISON_CHECK([[-o glr-regr3.c glr-regr3.y]], 0, [], [glr-regr3.y: conflicts: 1 shift/reduce, 1 reduce/reduce ]) AT_COMPILE([glr-regr3]) @@ -429,7 +429,7 @@ yyerror (char const *msg) } ]]) -AT_CHECK([[bison -o glr-regr4.c glr-regr4.y]], 0, [], +AT_BISON_CHECK([[-o glr-regr4.c glr-regr4.y]], 0, [], [glr-regr4.y: conflicts: 1 reduce/reduce ]) AT_COMPILE([glr-regr4]) @@ -502,7 +502,7 @@ main (void) } ]]) -AT_CHECK([[bison -o glr-regr5.c glr-regr5.y]], 0, [], +AT_BISON_CHECK([[-o glr-regr5.c glr-regr5.y]], 0, [], [glr-regr5.y: conflicts: 1 reduce/reduce ]) AT_COMPILE([glr-regr5]) @@ -567,7 +567,7 @@ main (void) } ]]) -AT_CHECK([[bison -o glr-regr6.c glr-regr6.y]], 0, [], +AT_BISON_CHECK([[-o glr-regr6.c glr-regr6.y]], 0, [], [glr-regr6.y: conflicts: 1 reduce/reduce ]) AT_COMPILE([glr-regr6]) @@ -659,7 +659,7 @@ main (void) } ]]) -AT_CHECK([[bison -o glr-regr7.c glr-regr7.y]], 0, [], +AT_BISON_CHECK([[-o glr-regr7.c glr-regr7.y]], 0, [], [glr-regr7.y: conflicts: 2 reduce/reduce ]) AT_COMPILE([glr-regr7]) @@ -757,7 +757,7 @@ main (void) } ]]) -AT_CHECK([[bison -o glr-regr8.c glr-regr8.y]], 0, [], +AT_BISON_CHECK([[-o glr-regr8.c glr-regr8.y]], 0, [], [glr-regr8.y: conflicts: 1 reduce/reduce ]) AT_COMPILE([glr-regr8]) @@ -840,7 +840,7 @@ main (void) } ]]) -AT_CHECK([[bison -o glr-regr9.c glr-regr9.y]], 0, [], +AT_BISON_CHECK([[-o glr-regr9.c glr-regr9.y]], 0, [], [glr-regr9.y: conflicts: 1 reduce/reduce ]) AT_COMPILE([glr-regr9]) @@ -907,7 +907,7 @@ main (void) } ]]) -AT_CHECK([[bison -o glr-regr10.c glr-regr10.y]], 0, [], +AT_BISON_CHECK([[-o glr-regr10.c glr-regr10.y]], 0, [], [glr-regr10.y: conflicts: 1 reduce/reduce ]) AT_COMPILE([glr-regr10]) @@ -976,7 +976,7 @@ main (void) } ]]) -AT_CHECK([[bison -o glr-regr11.c glr-regr11.y]], 0, [], +AT_BISON_CHECK([[-o glr-regr11.c glr-regr11.y]], 0, [], [glr-regr11.y: conflicts: 1 reduce/reduce ]) AT_COMPILE([glr-regr11]) @@ -1107,7 +1107,7 @@ main (void) } ]]) -AT_CHECK([[bison -o glr-regr12.c glr-regr12.y]], 0, [], +AT_BISON_CHECK([[-o glr-regr12.c glr-regr12.y]], 0, [], [glr-regr12.y: conflicts: 1 shift/reduce, 1 reduce/reduce ]) AT_COMPILE([glr-regr12]) @@ -1236,7 +1236,7 @@ main (void) } ]]) -AT_CHECK([[bison -o glr-regr13.c glr-regr13.y]], 0, [], []) +AT_BISON_CHECK([[-o glr-regr13.c glr-regr13.y]], 0, [], []) AT_COMPILE([glr-regr13]) AT_PARSER_CHECK([[./glr-regr13]], 0, @@ -1452,7 +1452,7 @@ main (void) } ]]) -AT_CHECK([[bison -o glr-regr14.c glr-regr14.y]], 0, [], +AT_BISON_CHECK([[-o glr-regr14.c glr-regr14.y]], 0, [], [glr-regr14.y: conflicts: 3 reduce/reduce ]) AT_COMPILE([glr-regr14]) @@ -1556,7 +1556,7 @@ main (void) } ]]) -AT_CHECK([[bison -o glr-regr15.c glr-regr15.y]], 0, [], +AT_BISON_CHECK([[-o glr-regr15.c glr-regr15.y]], 0, [], [glr-regr15.y: conflicts: 2 reduce/reduce ]) AT_COMPILE([glr-regr15]) @@ -1625,7 +1625,7 @@ main (void) } ]]) -AT_CHECK([[bison -o glr-regr16.c glr-regr16.y]], 0, [], +AT_BISON_CHECK([[-o glr-regr16.c glr-regr16.y]], 0, [], [glr-regr16.y: conflicts: 1 reduce/reduce ]) AT_COMPILE([glr-regr16]) @@ -1712,7 +1712,7 @@ main (void) } ]]) -AT_CHECK([[bison -o glr-regr17.c glr-regr17.y]], 0, [], +AT_BISON_CHECK([[-o glr-regr17.c glr-regr17.y]], 0, [], [glr-regr17.y: conflicts: 3 reduce/reduce ]) AT_COMPILE([glr-regr17]) @@ -1778,7 +1778,7 @@ main (void) } ]]) -AT_CHECK([[bison -o glr-regr18.c glr-regr18.y]], 1, [], +AT_BISON_CHECK([[-o glr-regr18.c glr-regr18.y]], 1, [], [glr-regr18.y:26.18-24: result type clash on merge function `merge': != glr-regr18.y:25.18-24: previous declaration glr-regr18.y:27.13-19: result type clash on merge function `merge': != diff --git a/tests/headers.at b/tests/headers.at index 02911b78..8d70b35e 100644 --- a/tests/headers.at +++ b/tests/headers.at @@ -1,5 +1,5 @@ # Bison Parser Headers. -*- Autotest -*- -# Copyright (C) 2001, 2002, 2006 Free Software Foundation, Inc. +# Copyright (C) 2001, 2002, 2006, 2007 Free Software Foundation, Inc. # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -34,7 +34,7 @@ AT_DATA([input.y], exp: {}; ]) -AT_CHECK([bison --defines input.y]) +AT_BISON_CHECK([--defines input.y]) AT_CLEANUP @@ -65,7 +65,7 @@ dummy:; #include <$1.h> ]) -AT_CHECK([bison --defines=$1.h --output=y.tab.c $1.y]) +AT_BISON_CHECK([--defines=$1.h --output=y.tab.c $1.y]) AT_COMPILE([y.tab.o], [-I. -c y.tab.c]) @@ -109,7 +109,7 @@ my_error (const char *msg) exp:; ]) -AT_CHECK([bison --defines -o input.c input.y]) +AT_BISON_CHECK([--defines -o input.c input.y]) # YYLTYPE should be defined, and MY_LLOC declared. AT_DATA([caller.c], diff --git a/tests/input.at b/tests/input.at index da52f71c..8bf61faa 100644 --- a/tests/input.at +++ b/tests/input.at @@ -32,7 +32,7 @@ exp: { $$ = $1 ; }; exp: { @$ = @1 ; }; ]]) -AT_CHECK([bison input.y], [1], [], +AT_BISON_CHECK([input.y], [1], [], [[input.y:2.13-14: integer out of range: `$1' input.y:3.13-14: integer out of range: `@1' ]]) @@ -57,7 +57,7 @@ exp: foo { $$; } foo { $2; } foo ; ]]) -AT_CHECK([bison input.y], [1], [], +AT_BISON_CHECK([input.y], [1], [], [[input.y:5.12-13: $$ for the midrule at $2 of `exp' has no declared type input.y:5.24-25: $2 of `exp' has no declared type input.y:5.6-32: warning: type clash on default action: != <> @@ -117,7 +117,7 @@ l: INT | INT { $$ = $1; } INT { $$ = $2 + $< _AT_UNUSED_VALUES_DECLARATIONS]) ) -AT_CHECK([bison]m4_ifval($2, [ --warnings=midrule-values ])[ input.y], [0], [], +AT_BISON_CHECK(m4_ifval($2, [ --warnings=midrule-values ])[ input.y], [0], [], [[input.y:11.10-32: warning: unset value: $]$[ input.y:11.10-32: warning: unused value: $]1[ input.y:11.10-32: warning: unused value: $]3[ @@ -204,7 +204,7 @@ start: ; %printer { destroy ($$); } <>; ]]) -AT_CHECK([bison input.y], [1], [], +AT_BISON_CHECK([input.y], [1], [], [[input.y:1.13-29: redeclaration for default tagged %destructor input.y:1.13-29: previous declaration input.y:2.10-26: redeclaration for default tagged %printer @@ -255,7 +255,7 @@ start: ; %printer { destroy ($$); } ; ]]) -AT_CHECK([bison input.y], [1], [], +AT_BISON_CHECK([input.y], [1], [], [[input.y:4.13-29: %destructor redeclaration for input.y:1.13-29: previous declaration input.y:4.13-29: %destructor redeclaration for @@ -294,7 +294,7 @@ end: { } ; tagged: { } ; ]]) -AT_CHECK([bison input.y], [0], [], +AT_BISON_CHECK([input.y], [0], [], [[input.y:6.8-45: warning: unset value: $$ input.y:6.8-45: warning: unused value: $2 input.y:7.6-8: warning: unset value: $$ @@ -311,7 +311,7 @@ end: { } ; tagged: { } ; ]]) -AT_CHECK([bison input.y], [0], [], +AT_BISON_CHECK([input.y], [0], [], [[input.y:6.8-45: warning: unused value: $4 input.y:8.9-11: warning: unset value: $$ ]]) @@ -335,7 +335,7 @@ start: end end { $1; } ; end: { } ; ]]) -AT_CHECK([bison input.y], [0], [], +AT_BISON_CHECK([input.y], [0], [], [[input.y:6.8-22: warning: unset value: $$ input.y:6.8-22: warning: unused value: $2 input.y:7.6-8: warning: unset value: $$ @@ -367,7 +367,7 @@ AT_DATA([input.y], exp: foo; ]]) -AT_CHECK([bison input.y], [1], [], +AT_BISON_CHECK([input.y], [1], [], [[input.y:8.7-11: %type redeclaration for foo input.y:3.7-11: previous declaration input.y:10.13-17: %destructor redeclaration for foo @@ -393,7 +393,7 @@ AT_SETUP([Torturing the Scanner]) AT_DATA([input.y], []) -AT_CHECK([bison input.y], [1], [], +AT_BISON_CHECK([input.y], [1], [], [[input.y:1.1: syntax error, unexpected end of file ]]) @@ -401,7 +401,7 @@ AT_CHECK([bison input.y], [1], [], AT_DATA([input.y], [{} ]) -AT_CHECK([bison input.y], [1], [], +AT_BISON_CHECK([input.y], [1], [], [[input.y:1.1-2: syntax error, unexpected {...} ]]) @@ -537,7 +537,7 @@ main (void) } ]]) -AT_CHECK([bison -d -v -o input.c input.y]) +AT_BISON_CHECK([-d -v -o input.c input.y]) AT_COMPILE([input.o], [-c input.c]) AT_COMPILE([main.o], [-c main.c]) AT_COMPILE([input], [input.o main.o]) @@ -568,7 +568,7 @@ exp: "MY TOKEN"; %% ]]) -AT_CHECK([bison -o input.c input.y]) +AT_BISON_CHECK([-o input.c input.y]) AT_CLEANUP @@ -584,7 +584,7 @@ AT_DATA_GRAMMAR([input.y], %% empty_file:; ]]) -AT_CHECK([bison -o input.c input.y], $2, [], ignore) +AT_BISON_CHECK([-o input.c input.y], $2, [], ignore) AT_CLEANUP ]) @@ -610,7 +610,7 @@ start: 'a'; %% ]]) -AT_CHECK([bison -o input.c input.y]) +AT_BISON_CHECK([-o input.c input.y]) AT_CLEANUP @@ -648,7 +648,7 @@ start: ; %destructor { free ($$) ]]) -AT_CHECK([bison -o input.c input.y], 1, [], +AT_BISON_CHECK([-o input.c input.y], 1, [], [[input.y:1.10-2.0: missing `"' at end of line input.y:4.10-5.0: missing `'' at end of line input.y:14.11-15.0: missing `'' at end of line @@ -676,7 +676,7 @@ start: false_start ; %start start; ]]) -AT_CHECK([bison -o input.c input.y]) +AT_BISON_CHECK([-o input.c input.y]) AT_CLEANUP @@ -695,7 +695,7 @@ start: PREC %prec PREC ; PREC: ; ]]) -AT_CHECK([bison input.y], [1], [], +AT_BISON_CHECK([input.y], [1], [], [[input.y:3.1-4: rule given for PREC, which is a token ]]) @@ -716,7 +716,7 @@ AT_DATA([input-c.y], %% start: ; ]]) -AT_CHECK([[bison input-c.y]], [0], [], +AT_BISON_CHECK([[input-c.y]], [0], [], [[input-c.y:1.7: warning: %code qualifier `q' is not used input-c.y:2.7-9: warning: %code qualifier `bad' is not used input-c.y:3.7-9: warning: %code qualifier `bad' is not used @@ -730,7 +730,7 @@ AT_DATA([input-c-glr.y], %% start: ; ]]) -AT_CHECK([[bison input-c-glr.y]], [0], [], +AT_BISON_CHECK([[input-c-glr.y]], [0], [], [[input-c-glr.y:1.7: warning: %code qualifier `q' is not used input-c-glr.y:2.7-9: warning: %code qualifier `bad' is not used input-c-glr.y:3.8-10: warning: %code qualifier `bad' is not used @@ -743,7 +743,7 @@ AT_DATA([input-c++.y], %% start: ; ]]) -AT_CHECK([[bison input-c++.y]], [0], [], +AT_BISON_CHECK([[input-c++.y]], [0], [], [[input-c++.y:1.7: warning: %code qualifier `q' is not used input-c++.y:2.7-9: warning: %code qualifier `bad' is not used input-c++.y:3.8: warning: %code qualifier `q' is not used @@ -756,7 +756,7 @@ AT_DATA([input-c++-glr.y], %% start: ; ]]) -AT_CHECK([[bison input-c++-glr.y]], [0], [], +AT_BISON_CHECK([[input-c++-glr.y]], [0], [], [[input-c++-glr.y:1.7-9: warning: %code qualifier `bad' is not used input-c++-glr.y:2.7: warning: %code qualifier `q' is not used input-c++-glr.y:3.7: warning: %code qualifier `q' is not used @@ -769,7 +769,7 @@ AT_DATA([special-char-@@.y], %% start: ; ]]) -AT_CHECK([[bison special-char-@@.y]], [0], [], +AT_BISON_CHECK([[special-char-@@.y]], [0], [], [[special-char-@@.y:1.7-9: warning: %code qualifier `bad' is not used special-char-@@.y:2.7: warning: %code qualifier `q' is not used special-char-@@.y:3.7: warning: %code qualifier `q' is not used @@ -782,7 +782,7 @@ AT_DATA([special-char-@:>@.y], %% start: ; ]]) -AT_CHECK([[bison special-char-@:>@.y]], [0], [], +AT_BISON_CHECK([[special-char-@:>@.y]], [0], [], [[special-char-@:>@.y:1.7-9: warning: %code qualifier `bad' is not used special-char-@:>@.y:2.7: warning: %code qualifier `q' is not used special-char-@:>@.y:3.7: warning: %code qualifier `q' is not used @@ -807,7 +807,7 @@ AT_DATA([input.y], start: ; ]]) -AT_CHECK([[bison input.y]], [0], [], +AT_BISON_CHECK([[input.y]], [0], [], [[input.y:2.9-11: warning: %define variable `var' redefined input.y:1.9-11: warning: previous definition input.y:3.10-12: warning: %define variable `var' redefined @@ -835,7 +835,7 @@ AT_DATA([Input.y], start: ; ]]) -AT_CHECK([[bison Input.y]], [1], [], +AT_BISON_CHECK([[Input.y]], [1], [], [[Input.y:2.9-14: invalid value for %define Boolean variable `public' ]]) @@ -853,7 +853,7 @@ AT_DATA([[input.y]], start: ; ]]) -AT_CHECK([[bison input.y]], [1], [], +AT_BISON_CHECK([[input.y]], [1], [], [[input.y:1.9-21: invalid value for %define variable `api.push_pull': `neither' ]]) @@ -878,7 +878,7 @@ AT_DATA([[input.y]], start: ; ]]) -AT_CHECK([[bison input.y]], [0], [], +AT_BISON_CHECK([[input.y]], [0], [], [[input.y:1.9-16: warning: %define variable `api.pure' is not used ]]) ]) @@ -911,7 +911,7 @@ AT_DATA([[input.y]], start: ; ]]) -AT_CHECK([[bison input.y]], [1], [], +AT_BISON_CHECK([[input.y]], [1], [], [m4_foreach([b4_arg], m4_dquote(m4_shift($@)), [[input.y:3.9-17: ]b4_arg[ ]])]) diff --git a/tests/java.at b/tests/java.at index b6348810..0dbaebc7 100644 --- a/tests/java.at +++ b/tests/java.at @@ -288,7 +288,7 @@ AT_DATA_JAVA_CALC_Y([$1 $2 }]) -AT_CHECK([bison -o Calc.java Calc.y]) +AT_BISON_CHECK([-o Calc.java Calc.y]) AT_JAVA_COMPILE([Calc.java]) # Test the priorities. diff --git a/tests/local.at b/tests/local.at index d4864148..ad0cf8e5 100644 --- a/tests/local.at +++ b/tests/local.at @@ -169,6 +169,79 @@ m4_define([AT_DATA_GRAMMAR], $2]) ]) +# AT_BISON_CHECK(BISON_ARGS, [OTHER_AT_CHECK_ARGS]) +# ------------------------------------------------- +# Check Bison by invoking `bison BISON_ARGS'. OTHER_AT_CHECK_ARGS are the +# usual remaining arguments to AT_CHECK: STATUS, STDOUT, etc. +# +# This macro or AT_BISON_CHECK_NO_XML should always be used whenever invoking +# Bison in the test suite. For now it ensures that: +# +# 1. Valgrind doesn't report reachable memory when Bison is expected to have +# a non-zero exit status since Bison doesn't always try to free all memory +# in that case. +# +# 2. In the case of maintainer-xml-check, XML/XSLT output is compared with +# --graph and --report=all output for every working grammar. +m4_define([AT_BISON_CHECK], +[m4_if(m4_quote($2), [0], [AT_BISON_CHECK_XML($@)], + m4_quote($2), [], [AT_BISON_CHECK_XML($@)]) +AT_BISON_CHECK_NO_XML($@)]) + +# AT_BISON_CHECK_NO_XML(BISON_ARGS, [OTHER_AT_CHECK_ARGS]) +# -------------------------------------------------------- +# Same as AT_BISON_CHECK except don't perform XML/XSLT checks. This is useful +# when a tortured grammar's XML is known to be too large for xsltproc to +# handle. +m4_define([AT_BISON_CHECK_NO_XML], +[AT_CHECK(m4_if(m4_quote($2), [0], [], m4_quote($2), [], [], + [AT_QUELL_VALGRIND ])[[bison ]]$@)]) + +# AT_BISON_CHECK_XML(BISON_ARGS, [OTHER_AT_CHECK_ARGS]) +# ----------------------------------------------------- +# Run AT_BISON_CHECK's XML/XSLT checks if $BISON_TEST_XML=1 and $XSLTPROC is +# defined. It doesn't make sense to invoke this macro if Bison is expected to +# have a non-zero exit status. +m4_define([AT_BISON_CHECK_XML], +[[if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then] + mkdir xml-tests + m4_pushdef([AT_BISON_ARGS], + [m4_bpatsubsts([[$1]], + [--report(-file)?=[^][ ]*], [], + [--graph=[^][ ]*], [], + [--xml=[^][ ]*], [])])dnl + # Don't combine these Bison invocations since we want to be sure that + # --report=all isn't required to get the full XML file. + AT_CHECK([[bison --report=all --report-file=xml-tests/test.output \ + --graph=xml-tests/test.dot ]]AT_BISON_ARGS, + [[0]], [ignore], [ignore]) + AT_CHECK([[bison --xml=xml-tests/test.xml ]]AT_BISON_ARGS, + [[0]], [ignore], [ignore]) + m4_popdef([AT_BISON_ARGS])dnl + cp xml-tests/test.output expout + AT_CHECK([[$XSLTPROC \ + `]]AT_QUELL_VALGRIND[[ bison --print-datadir`/xslt/xml2text.xsl \ + xml-tests/test.xml]], [[0]], [expout]) + cp xml-tests/test.dot expout + AT_CHECK([[$XSLTPROC \ + `]]AT_QUELL_VALGRIND[[ bison --print-datadir`/xslt/xml2dot.xsl \ + xml-tests/test.xml]], [[0]], [expout]) + rm -rf xml-tests expout +[fi]]) + +# AT_QUELL_VALGRIND +# ----------------- +# Put this before a Bison invocation to keep Valgrind from complaining about +# reachable memory. +# +# Do not quote invocations of this macro within the first argument of AT_CHECK. +# The triple quoting below will cause test cases to fail if you do. If you do +# so anyway but also decrease the quoting below to avoid that problem, AT_CHECK +# will then fail to shell-escape its contents when attempting to print them. +# The testsuite verbose output, at least, will be incorrect, but nothing may +# fail to make sure you notice. +m4_define([AT_QUELL_VALGRIND], +[[[VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS;]]]) ## ------------------------ ## ## Compiling C, C++ Files. ## diff --git a/tests/output.at b/tests/output.at index 8aae22c4..28ed0526 100644 --- a/tests/output.at +++ b/tests/output.at @@ -32,7 +32,7 @@ AT_DATA([$1], foo: {}; ]]) -AT_CHECK([bison $3 $1 $5], 0) +AT_BISON_CHECK([$3 $1 $5], 0) AT_CHECK([ls $4], [], [ignore]) $6 AT_CLEANUP @@ -130,7 +130,7 @@ AT_DATA([$1], foo: {}; ]]) -AT_CHECK([bison $3 $1], 0, [], [$4]) +AT_BISON_CHECK([$3 $1], 0, [], [$4]) AT_CLEANUP ]) @@ -164,7 +164,7 @@ AT_DATA_GRAMMAR([glr.y], %% start: {}; ]]) -AT_CHECK([bison -o "AS_ESCAPE([$1.c])" --defines="AS_ESCAPE([$1.h])" glr.y]) +AT_BISON_CHECK([-o "AS_ESCAPE([$1.c])" --defines="AS_ESCAPE([$1.h])" glr.y]) AT_CHECK([ls "AS_ESCAPE([$1.c])" "AS_ESCAPE([$1.h])"], [], [ignore]) AT_COMPILE([glr.o], [-c "AS_ESCAPE([$1.c])"]) $2 @@ -175,7 +175,7 @@ AT_DATA_GRAMMAR([cxx.y], %% start: {}; ]]) -AT_CHECK([bison -o "AS_ESCAPE([$1.c])" --defines="AS_ESCAPE([$1.h])" cxx.y]) +AT_BISON_CHECK([-o "AS_ESCAPE([$1.c])" --defines="AS_ESCAPE([$1.h])" cxx.y]) AT_CHECK([ls "AS_ESCAPE([$1.c])" "AS_ESCAPE([$1.h])"], [], [ignore]) AT_COMPILE_CXX([cxx.o], [-c "AS_ESCAPE([$1.c])"]) $2 diff --git a/tests/push.at b/tests/push.at index 6e2bd8b6..53b20b7d 100644 --- a/tests/push.at +++ b/tests/push.at @@ -71,7 +71,7 @@ main (void) } ]]) -AT_CHECK([[bison -o input.c input.y]]) +AT_BISON_CHECK([[-o input.c input.y]]) AT_COMPILE([[input]]) AT_PARSER_CHECK([[./input]]) @@ -135,7 +135,7 @@ main (void) } ]]) -AT_CHECK([[bison -o input.c input.y]]) +AT_BISON_CHECK([[-o input.c input.y]]) AT_COMPILE([[input]]) AT_PARSER_CHECK([[./input]], 0, [], [[cannot allocate multiple impure push-parser instances @@ -163,7 +163,7 @@ AT_DATA([[input.y]], start: ; ]]) -AT_CHECK([[bison input.y]], [0], [], +AT_BISON_CHECK([[input.y]], [0], [], [[input.y:2.9-21: warning: %define variable `api.push_pull' is not used ]]) diff --git a/tests/reduce.at b/tests/reduce.at index 9e5246af..c7ca3266 100644 --- a/tests/reduce.at +++ b/tests/reduce.at @@ -42,7 +42,7 @@ AT_DATA([[input.y]], exp: useful; ]]) -AT_CHECK([[bison input.y]]) +AT_BISON_CHECK([[input.y]]) AT_CHECK([[sed -n '/^Grammar/q;/^$/!p' input.output]], 0, [[Terminals unused in grammar @@ -86,7 +86,7 @@ AT_DATA([[input.y]], exp: useful; ]]) -AT_CHECK([[bison input.y]], 0, [], +AT_BISON_CHECK([[input.y]], 0, [], [[input.y: warning: 9 nonterminals useless in grammar input.y:4.8-15: warning: nonterminal useless in grammar: useless1 input.y:5.8-15: warning: nonterminal useless in grammar: useless2 @@ -141,7 +141,7 @@ useless8: '8'; useless9: '9'; ]]) -AT_CHECK([[bison input.y]], 0, [], +AT_BISON_CHECK([[input.y]], 0, [], [[input.y: warning: 9 nonterminals and 9 rules useless in grammar input.y:6.1-8: warning: nonterminal useless in grammar: useless1 input.y:7.1-8: warning: nonterminal useless in grammar: useless2 @@ -236,7 +236,7 @@ non_productive: non_productive useless_token %% ]]) -AT_CHECK([[bison not-reduced.y]], 0, [], +AT_BISON_CHECK([[not-reduced.y]], 0, [], [[not-reduced.y: warning: 2 nonterminals and 3 rules useless in grammar not-reduced.y:14.1-13: warning: nonterminal useless in grammar: not_reachable not-reduced.y:11.6-19: warning: nonterminal useless in grammar: non_productive @@ -282,7 +282,7 @@ exp: useful { /* A useful action. */ } %% ]]) -AT_CHECK([[bison reduced.y]]) +AT_BISON_CHECK([[reduced.y]]) # Comparing the parsers. cp reduced.c expout @@ -310,7 +310,7 @@ underivable: indirection; indirection: underivable; ]]) -AT_CHECK([[bison input.y]], 0, [], +AT_BISON_CHECK([[input.y]], 0, [], [[input.y: warning: 2 nonterminals and 3 rules useless in grammar input.y:5.15-25: warning: nonterminal useless in grammar: underivable input.y:6.14-24: warning: nonterminal useless in grammar: indirection @@ -345,7 +345,7 @@ AT_DATA([[input.y]], exp: exp; ]]) -AT_CHECK([[bison input.y]], 1, [], +AT_BISON_CHECK([[input.y]], 1, [], [[input.y: warning: 2 nonterminals and 2 rules useless in grammar input.y:3.1-3: fatal error: start symbol exp does not derive any sentence ]]) diff --git a/tests/regression.at b/tests/regression.at index 3b3272f3..48136d87 100644 --- a/tests/regression.at +++ b/tests/regression.at @@ -1,6 +1,6 @@ # Bison Regressions. -*- Autotest -*- -# Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006 Free Software +# Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007 Free Software # Foundation, Inc. # This program is free software: you can redistribute it and/or modify @@ -39,7 +39,7 @@ int yylex (void); program: 'x'; ]]) -AT_CHECK([bison -o input.c input.y]) +AT_BISON_CHECK([-o input.c input.y]) AT_COMPILE([input.o], [-c input.c]) AT_COMPILE([input.o], [-DYYDEBUG -c input.c]) @@ -67,7 +67,7 @@ typedef union { char const *val; } YYSTYPE; program: { $$ = ""; }; ]]) -AT_CHECK([bison -o input.c input.y]) +AT_BISON_CHECK([-o input.c input.y]) AT_COMPILE([input.o], [-c input.c]) AT_CLEANUP @@ -105,7 +105,7 @@ exp: MY_TOKEN; %% ]]) -AT_CHECK([bison -y -o input.c input.y]) +AT_BISON_CHECK([-y -o input.c input.y]) AT_COMPILE([input.o], [-c input.c]) AT_CLEANUP @@ -148,7 +148,7 @@ exp: MY_TOKEN; %% ]]) -AT_CHECK([bison -o input.c input.y]) +AT_BISON_CHECK([-o input.c input.y]) AT_COMPILE([input.o], [-c input.c]) AT_CLEANUP @@ -170,7 +170,7 @@ exp: { tests = {{{{{{{{{{}}}}}}}}}}; }; %% ]]) -AT_CHECK([bison -v -o input.c input.y]) +AT_BISON_CHECK([-v -o input.c input.y]) AT_CHECK([grep 'tests = {{{{{{{{{{}}}}}}}}}};' input.c], 0, [ignore]) @@ -197,7 +197,7 @@ exp: '(' exp ')' | NUM ; %% ]]) -AT_CHECK([bison -v -o input.c input.y], 0, [], +AT_BISON_CHECK([-v -o input.c input.y], 0, [], [[input.y:6.8-14: warning: symbol `"<="' used more than once as a literal string ]]) @@ -242,7 +242,7 @@ expr: }; ]]) -AT_CHECK([bison -o input.c -v input.y]) +AT_BISON_CHECK([-o input.c -v input.y]) # Check the contents of the report. AT_CHECK([cat input.output], [], @@ -364,7 +364,7 @@ exp: ; %% ]]) -AT_CHECK([bison -v -o input.c input.y]) +AT_BISON_CHECK([-v -o input.c input.y]) AT_CLEANUP @@ -387,7 +387,7 @@ default: 'a' } %{ ]]) -AT_CHECK([bison input.y], [1], [], +AT_BISON_CHECK([input.y], [1], [], [[input.y:2.1: invalid character: `?' input.y:3.14: invalid character: `}' input.y:4.1: invalid character: `%' @@ -414,7 +414,7 @@ AT_DATA([input.y], %union ]]) -AT_CHECK([bison input.y], [1], [], +AT_BISON_CHECK([input.y], [1], [], [[input.y:3.1-15: syntax error, unexpected %initial-action, expecting {...} ]]) @@ -469,7 +469,7 @@ main (void) } ]]) -AT_CHECK([bison -o input.c input.y]) +AT_BISON_CHECK([-o input.c input.y]) AT_COMPILE([input]) AT_DATA([experr], [[syntax error, unexpected "\\'?\"\a\b\f\n\r\t\v\001\201\001\201?\?!", expecting a @@ -500,7 +500,7 @@ exp: ]]) # Pacify font-lock-mode: " -AT_CHECK([bison -o input.c input.y]) +AT_BISON_CHECK([-o input.c input.y]) AT_COMPILE([input.o], [-c input.c]) AT_CLEANUP @@ -540,7 +540,7 @@ CONST_DEC: %% ]]) -AT_CHECK([bison -v input.y]) +AT_BISON_CHECK([-v input.y]) AT_CHECK([cat input.output], 0, [[Grammar @@ -705,7 +705,7 @@ else: "else" statement; %% ]]) -AT_CHECK([bison -v -o input.c input.y]) +AT_BISON_CHECK([-v -o input.c input.y]) # Check only the tables. [sed -n 's/ *$//;/^static const.*\[\] =/,/^}/p' input.c >tables.c] @@ -925,11 +925,11 @@ m4_define([AT_CHECK_DANCER], [AT_SETUP([Dancer $1]) AT_BISON_OPTION_PUSHDEFS([$1]) _AT_DATA_DANCER_Y([$1]) -AT_CHECK([bison -o dancer.c dancer.y]) +AT_BISON_CHECK([-o dancer.c dancer.y]) AT_LALR1_CC_IF( - [AT_CHECK([bison -o dancer.cc dancer.y]) + [AT_BISON_CHECK([-o dancer.cc dancer.y]) AT_COMPILE_CXX([dancer])], - [AT_CHECK([bison -o dancer.c dancer.y]) + [AT_BISON_CHECK([-o dancer.c dancer.y]) AT_COMPILE([dancer])]) AT_PARSER_CHECK([./dancer], 1, [], [syntax error, unexpected ':' @@ -1025,11 +1025,11 @@ m4_define([AT_CHECK_EXPECT2], [AT_SETUP([Expecting two tokens $1]) AT_BISON_OPTION_PUSHDEFS([$1]) _AT_DATA_EXPECT2_Y([$1]) -AT_CHECK([bison -o expect2.c expect2.y]) +AT_BISON_CHECK([-o expect2.c expect2.y]) AT_LALR1_CC_IF( - [AT_CHECK([bison -o expect2.cc expect2.y]) + [AT_BISON_CHECK([-o expect2.cc expect2.y]) AT_COMPILE_CXX([expect2])], - [AT_CHECK([bison -o expect2.c expect2.y]) + [AT_BISON_CHECK([-o expect2.c expect2.y]) AT_COMPILE([expect2])]) AT_PARSER_CHECK([./expect2], 1, [], [syntax error, unexpected '+', expecting A or B @@ -1096,7 +1096,7 @@ main (void) } ]]) -AT_CHECK([bison -t -o input.c input.y]) +AT_BISON_CHECK([-t -o input.c input.y]) AT_COMPILE([input]) AT_PARSER_CHECK([./input], 0, [[Bison would once convert this action to a midrule because of the subsequent braced code. @@ -1137,7 +1137,7 @@ start: 'a' "A" 'b'; %token 'a' "A"; ]]) -AT_CHECK([bison -t -o input.c input.y]) +AT_BISON_CHECK([-t -o input.c input.y]) AT_CLEANUP @@ -1162,7 +1162,7 @@ start: a | 'a' a 'a' ; a: 'a' ; ]]) -AT_CHECK([[bison --report=all input.y]]) +AT_BISON_CHECK([[--report=all input.y]]) AT_CHECK([[sed -n '/^state 1$/,/^state 2$/p' input.output]], [[0]], [[state 1 diff --git a/tests/sets.at b/tests/sets.at index d17c9931..165dabac 100644 --- a/tests/sets.at +++ b/tests/sets.at @@ -1,5 +1,5 @@ # Exercising Bison Grammar Sets. -*- Autotest -*- -# Copyright (C) 2001, 2002, 2005 Free Software Foundation, Inc. +# Copyright (C) 2001, 2002, 2005, 2007 Free Software Foundation, Inc. # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -76,7 +76,7 @@ AT_DATA([[input.y]], e: 'e' | /* Nothing */; ]]) -AT_CHECK([[bison --trace=sets input.y]], [], [], [stderr]) +AT_BISON_CHECK([[--trace=sets input.y]], [], [], [stderr]) AT_EXTRACT_SETS([stderr], [sets]) AT_CHECK([[cat sets]], [], [[DERIVES @@ -160,7 +160,7 @@ g: h; h: 'h'; ]]) -AT_CHECK([[bison --trace=sets input.y]], [], [], [stderr]) +AT_BISON_CHECK([[--trace=sets input.y]], [], [], [stderr]) AT_CHECK([[sed -n 's/[ ]*$//;/^RTC: Firsts Output BEGIN/,/^RTC: Firsts Output END/p' stderr]], [], [[RTC: Firsts Output BEGIN @@ -206,7 +206,7 @@ exp: ; ]]) -AT_CHECK([[bison --trace=sets input.y]], [], [], [stderr]) +AT_BISON_CHECK([[--trace=sets input.y]], [], [], [stderr]) AT_EXTRACT_SETS([stderr], [sets]) AT_CHECK([[cat sets]], [], [[DERIVES @@ -276,7 +276,7 @@ input: ; ]]) -AT_CHECK([[bison -v -o input.c input.y]]) +AT_BISON_CHECK([[-v -o input.c input.y]]) # Get the final state in the parser. AT_CHECK([[sed -n 's/.*define YYFINAL *\([0-9][0-9]*\)/final state \1/p' input.c]], diff --git a/tests/skeletons.at b/tests/skeletons.at index ca0cbb84..3845d3dd 100644 --- a/tests/skeletons.at +++ b/tests/skeletons.at @@ -58,17 +58,17 @@ AT_DATA([[tmp/input-cmd-line.y]], start: ; ]]) -AT_CHECK([[bison tmp/input-gram.y]]) +AT_BISON_CHECK([[tmp/input-gram.y]]) AT_CHECK([[cat input-gram.tab.c]], [[0]], [[Hello World ]]) -AT_CHECK([[bison input-gram.y]]) +AT_BISON_CHECK([[input-gram.y]]) AT_CHECK([[cat input-gram.tab.c]], [[0]], [[Hello World -- Local ]]) -AT_CHECK([[bison --skeleton=tmp/skel.c tmp/input-cmd-line.y]]) +AT_BISON_CHECK([[--skeleton=tmp/skel.c tmp/input-cmd-line.y]]) AT_CHECK([[cat input-cmd-line.tab.c]], [[0]], [[Hello World ]]) @@ -124,13 +124,13 @@ AT_DATA([[input-gram.y]], [[%skeleton "yacc.c"] AT_GRAM]) -AT_CHECK([[bison --skeleton=yacc.c -o input-cmd-line.c input-cmd-line.y]]) +AT_BISON_CHECK([[--skeleton=yacc.c -o input-cmd-line.c input-cmd-line.y]]) AT_COMPILE([[input-cmd-line]]) AT_PARSER_CHECK([[./input-cmd-line]], [[1]], [], [[syntax error, unexpected 'a', expecting $end ]]) -AT_CHECK([[bison -o input-gram.c input-gram.y]]) +AT_BISON_CHECK([[-o input-gram.c input-gram.y]]) AT_COMPILE([[input-gram]]) AT_PARSER_CHECK([[./input-gram]], [[1]], [], [[syntax error, unexpected 'a', expecting $end @@ -158,7 +158,7 @@ AT_DATA([[input.y]], start: ; ]]) -AT_CHECK([[bison input.y]], [[1]], [[]], +AT_BISON_CHECK([[input.y]], [[1]], [[]], [[[Bison:b4_percent_define_default]:1.0: invalid value for %define Boolean variable `foo' ]]) @@ -192,7 +192,7 @@ AT_DATA([[input1.y]], start: ; ]]) -AT_CHECK([[bison input1.y]], [[1]], [[]], +AT_BISON_CHECK([[input1.y]], [[1]], [[]], [[input1.y: warning: foow fubar foow.y:2.3-5.3: warning: foowat fubar input1.y: fooc fubar @@ -212,7 +212,7 @@ AT_DATA([[input2.y]], start: ; ]]) -AT_CHECK([[bison input2.y]], [[1]], [[]], +AT_BISON_CHECK([[input2.y]], [[1]], [[]], [[foof.y:12.11-100.122: fatal error: foofat fubar ]]) @@ -226,7 +226,7 @@ AT_DATA([[input3.y]], start: ; ]]) -AT_CHECK([[bison input3.y]], [[1]], [[]], +AT_BISON_CHECK([[input3.y]], [[1]], [[]], [[input3.y: fatal error: undefined %define variable `bogus' passed to b4_percent_define_get_loc ]]) @@ -240,7 +240,7 @@ AT_DATA([[input4.y]], start: ; ]]) -AT_CHECK([[bison input4.y]], [[1]], [[]], +AT_BISON_CHECK([[input4.y]], [[1]], [[]], [[input4.y: fatal error: undefined %define variable `bogus' passed to b4_percent_define_get_syncline ]]) @@ -265,7 +265,7 @@ AT_DATA([[input1.y]], start: ; ]]) -AT_CHECK([[bison input1.y]], [[1]], [[]], +AT_BISON_CHECK([[input1.y]], [[1]], [[]], [[input1.y: non-fatal error input1.y: fatal error: M4 should exit immediately here ]]) @@ -282,7 +282,7 @@ AT_DATA([[input2.y]], start: ; ]]) -AT_CHECK([[bison input2.y]], [[1]], [[]], +AT_BISON_CHECK([[input2.y]], [[1]], [[]], [[input2.y: warning: morning foo.y:1.5-6: fatal error: M4 should exit immediately here ]]) diff --git a/tests/synclines.at b/tests/synclines.at index 428a1c51..d971e546 100644 --- a/tests/synclines.at +++ b/tests/synclines.at @@ -1,5 +1,5 @@ # Executing Actions. -*- Autotest -*- -# Copyright (C) 2002, 2004, 2005 Free Software Foundation, Inc. +# Copyright (C) 2002, 2004, 2005, 2007 Free Software Foundation, Inc. # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -68,7 +68,7 @@ AT_SYNCLINES_COMPILE([syncline.c]) AT_CHECK([[test "`cat stdout`" = 'syncline.c:1: @%:@error "1"' || exit 77]]) AT_DATA([[input.y]], [$2]) -AT_CHECK([bison -o input.c input.y]) +AT_BISON_CHECK([-o input.c input.y]) AT_SYNCLINES_COMPILE([input.c]) AT_CHECK([cat stdout], 0, [$3]) AT_CLEANUP diff --git a/tests/testsuite.at b/tests/testsuite.at index 90fb2d63..fa7d7482 100644 --- a/tests/testsuite.at +++ b/tests/testsuite.at @@ -17,15 +17,6 @@ # along with this program. If not, see . -# Bison often leaks memory when its exit status is non-zero, so set -# --leak-check=summary for Valgrind in that case. -m4_pushdef([ORIGINAL_AT_CHECK], m4_defn([AT_CHECK])) -m4_pushdef([AT_CHECK], -[ORIGINAL_AT_CHECK( - m4_if(m4_index(m4_quote($1), [bison ]), 0, - m4_if(m4_quote($2), [0], [], m4_quote($2), [], [], - [[VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; ]]))$@)]) - # Testing resistance to user bugs. m4_include([input.at]) @@ -80,6 +71,3 @@ m4_include([glr-regression.at]) # Push parsing specific tests. m4_include([push.at]) - -m4_popdef([AT_CHECK]) -m4_popdef([ORIGINAL_AT_CHECK]) diff --git a/tests/torture.at b/tests/torture.at index cf87f26f..753fc919 100644 --- a/tests/torture.at +++ b/tests/torture.at @@ -143,7 +143,7 @@ AT_SETUP([Big triangle]) # With 500 and the new parser, which consume far too much memory, # it gets killed too. Of course the parser is to be cleaned. AT_DATA_TRIANGULAR_GRAMMAR([input.y], [200]) -AT_CHECK([bison -v -o input.c input.y]) +AT_BISON_CHECK_NO_XML([-v -o input.c input.y]) AT_COMPILE([input]) AT_PARSER_CHECK([./input]) @@ -249,7 +249,7 @@ AT_DATA_HORIZONTAL_GRAMMAR([input.y], [1000]) # Ask for 200 MiB, which should be plenty even on a 64-bit host. AT_INCREASE_DATA_SIZE(204000) -AT_CHECK([bison -v -o input.c input.y]) +AT_BISON_CHECK_NO_XML([-v -o input.c input.y]) AT_COMPILE([input]) AT_PARSER_CHECK([./input]) @@ -377,7 +377,7 @@ AT_DATA_LOOKAHEAD_TOKENS_GRAMMAR([input.y], [1000]) # Ask for 200 MiB, which should be plenty even on a 64-bit host. AT_INCREASE_DATA_SIZE(204000) -AT_CHECK([bison -v -o input.c input.y]) +AT_BISON_CHECK([-v -o input.c input.y]) AT_COMPILE([input]) AT_PARSER_CHECK([./input]) @@ -461,7 +461,7 @@ main (int argc, const char **argv) } } ]]) -AT_CHECK([bison -o input.c input.y]) +AT_BISON_CHECK([-o input.c input.y]) AT_COMPILE([input]) ]) -- 2.45.2