mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-09 12:23:04 +00:00
tests: AT_SAVE_SPECIAL_FILES / AT_RESTORE_SPECIAL_FILES.
Some of our macros play with expout and other Autotest special files, which may break their callers (e.g., currently TESTSUITEFLAGS='248 BISON_TEST_XML=1' fails). There is already some support for this. Expand it to be ready to use it elsewhere. * tests/local.at (AT_RESTORE_SPECIAL_FILES, AT_SAVE_SPECIAL_FILES) (at_save_special_files, at_restore_special_files): New. (AT_BISON_CHECK_NO_XML): Use them.
This commit is contained in:
@@ -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
|
||||
]])
|
||||
])
|
||||
|
||||
Reference in New Issue
Block a user