X-Git-Url: https://git.saurik.com/bison.git/blobdiff_plain/bbaf618c3e9a5645c5d71bf2ea0de2bdeb8a4976..7fb72c6e53f25f2d0b10fc9e0b412b8c7cde9101:/tests/local.at diff --git a/tests/local.at b/tests/local.at index d651eb95..65e528f9 100644 --- a/tests/local.at +++ b/tests/local.at @@ -37,6 +37,33 @@ printf "$count\n";' $1], [0], [$3 ])]) +# AT_SAVE_SPECIAL_FILES / AT_RESTORE_SPECIAL_FILES +# ------------------------------------------------ +# Don't interfere with caller's files. +m4_divert_text([PREPARE_TESTS], +[at_save_special_files () +{ + for at_save_file in stderr experr expout + do + test ! -f $at_save_file || mv $at_save_file at-bison-check-$at_save_file.bak + done +} + +at_restore_special_files () +{ + for at_save_file in stderr experr expout + do + test ! -f at-bison-check-$at_save_file.bak || + mv at-bison-check-$at_save_file.bak $at_save_file + done +} +]) + +m4_define([AT_SAVE_SPECIAL_FILES], [at_save_special_files]) +m4_define([AT_RESTORE_SPECIAL_FILES], [at_restore_special_files]) + + + ## ------------------------------- ## ## Macros decoding Bison options. ## ## ------------------------------- ## @@ -283,10 +310,7 @@ m4_if(m4_bregexp([$4], [: warning: ]), [-1], [], # are added after the grammar file name, so skip these checks # in that case. if test -z "${POSIXLY_CORRECT+set}"; then - # Don't interfere with caller's files. - if test -f stderr; then mv stderr at-bison-check-stderr.bak; fi - if test -f experr; then mv experr at-bison-check-experr.bak; fi - if test -f expout; then mv expout at-bison-check-expout.bak; fi + ]AT_SAVE_SPECIAL_FILES[ # To avoid expanding it repeatedly, store specified stdout. ]AT_DATA([expout], [$3])[ @@ -338,16 +362,7 @@ m4_if(m4_bregexp([$4], [: warning: ]), [-1], [], ]AT_CHECK(AT_QUELL_VALGRIND[[ bison ]$1[ --warnings=none \ -Werror]], [[0]], [expout])[ - # Restore caller's files. - if test -f at-bison-check-expout.bak; then - mv at-bison-check-expout.bak expout - fi - if test -f at-bison-check-experr.bak; then - mv at-bison-check-experr.bak experr - fi - if test -f at-bison-check-stderr.bak; then - mv at-bison-check-stderr.bak stderr - fi + ]AT_RESTORE_SPECIAL_FILES[ fi ]]) ]) @@ -358,8 +373,9 @@ m4_if(m4_bregexp([$4], [: warning: ]), [-1], [], # 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] +[[if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then] + AT_SAVE_SPECIAL_FILES + [mkdir xml-tests] m4_pushdef([AT_BISON_ARGS], [m4_bpatsubsts([[$1]], [--report(-file)?=[^][ ]*], [], @@ -381,8 +397,9 @@ m4_define([AT_BISON_CHECK_XML], AT_CHECK([[$XSLTPROC \ `]]AT_QUELL_VALGRIND[[ bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml]], [[0]], [expout]) - [rm -rf xml-tests expout -fi]]) + [rm -rf xml-tests expout] + AT_RESTORE_SPECIAL_FILES +[fi]]) # AT_QUELL_VALGRIND # ----------------- @@ -461,17 +478,26 @@ m4_define([AT_FULL_COMPILE], [ ## Running a generated parser. ## ## ---------------------------- ## + # AT_PARSER_CHECK(COMMAND, EXIT-STATUS, EXPOUT, EXPERR, [PRE]) # ------------------------------------------------------------ # So that we can run `./testsuite PREPARSER='valgrind -q' for instance. +# +# Get rid of spurious messages when compiled with --coverage: +# +profiling:/[...]/lib/fprintf.gcda:Merge mismatch for summaries m4_define([AT_PARSER_CHECK], -[AT_CHECK([$5 $PREPARSER $1], [$2], [$3], [$4])]) +[AT_CHECK([$5 $PREPARSER $1], [$2], [$3], [stderr]) +AT_CHECK([sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr], + [0], [], [$4]) +]) + # AT_JAVA_PARSER_CHECK(COMMAND, EXIT-STATUS, EXPOUT, EXPERR, [PRE]) # ----------------------------------------------------------------- m4_define([AT_JAVA_PARSER_CHECK], [AT_CHECK([$5[ $SHELL ../../../javaexec.sh ]$1], [$2], [$3], [$4])]) + # AT_TEST_TABLES_AND_PARSE(TITLE, COND-VALUE, TEST-SPEC, # DECLS, GRAMMAR, INPUT, # BISON-STDERR, TABLES-OR-LAST-STATE,