mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-22 02:33:03 +00:00
examples: beware of portability issue on Windows
Reported by Jannick. https://lists.gnu.org/r/bug-bison/2020-05/msg00040.html https://lists.gnu.org/r/bug-bison/2020-05/msg00066.html * examples/test (diff_opts): Use --strip-trailing-cr if supported, to avoid \n vs. \r\n issues. * examples/c/bistromathic/bistromathic.test: When on MSYS, don't try to check autocompletion.
This commit is contained in:
@@ -41,10 +41,11 @@ echo >perfect '> 0
|
|||||||
echo >ok '0'
|
echo >ok '0'
|
||||||
echo '0' | prog >effective
|
echo '0' | prog >effective
|
||||||
|
|
||||||
if diff perfect effective >/dev/null 2>&1; then
|
echo "checking for readline output"
|
||||||
|
if diff perfect effective; then
|
||||||
# Alles ist gut.
|
# Alles ist gut.
|
||||||
strip_prompt=false
|
strip_prompt=false
|
||||||
elif diff ok effective >/dev/null 2>&1; then
|
elif diff ok effective; then
|
||||||
strip_prompt=true
|
strip_prompt=true
|
||||||
else
|
else
|
||||||
skip "this is not the GNU Readline we expect"
|
skip "this is not the GNU Readline we expect"
|
||||||
@@ -257,14 +258,22 @@ err: Cleanup: popping nterm input (1.1-4: )' -p
|
|||||||
# From now on, the differences between versions of GNU Readline are
|
# From now on, the differences between versions of GNU Readline are
|
||||||
# too painful to try to cope with.
|
# too painful to try to cope with.
|
||||||
if $strip_prompt; then
|
if $strip_prompt; then
|
||||||
echo "SKIP: this is not the GNU Readline we expect"
|
echo "SKIP: this is not the GNU Readline we expect"
|
||||||
if $exit; then
|
exit $status
|
||||||
exit 0
|
|
||||||
else
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# On Windows10/MSYS2 the ^G coming from <tab> completion is not
|
||||||
|
# emitted the same way
|
||||||
|
# (https://lists.gnu.org/r/bug-bison/2020-05/msg00076.html).
|
||||||
|
echo "checking for kernel name"
|
||||||
|
case `uname -s` in
|
||||||
|
(MSYS*)
|
||||||
|
echo "SKIP: this is Windows/MSYS"
|
||||||
|
exit $status
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
|
||||||
# Check completion after an operator.
|
# Check completion after an operator.
|
||||||
sed -e 's/\\t/ /g' >input <<EOF
|
sed -e 's/\\t/ /g' >input <<EOF
|
||||||
(1+\t\t
|
(1+\t\t
|
||||||
|
|||||||
@@ -34,6 +34,13 @@ cwd=$(pwd)
|
|||||||
# See bistromathic.test.
|
# See bistromathic.test.
|
||||||
strip_prompt=false
|
strip_prompt=false
|
||||||
|
|
||||||
|
# If diff supports --strip-trailing-cr, use it, to avoid EOL issues
|
||||||
|
# when testing Java programs on Windows.
|
||||||
|
echo "checking for diff --strip-trailing-cr"
|
||||||
|
if diff --strip-trailing-cr "$1" "$1"; then
|
||||||
|
diff_opts=--strip-trailing-cr
|
||||||
|
fi
|
||||||
|
|
||||||
# The exercised program.
|
# The exercised program.
|
||||||
abs_medir=$cwd/examples/$medir
|
abs_medir=$cwd/examples/$medir
|
||||||
if test -x "$abs_medir/$me"; then
|
if test -x "$abs_medir/$me"; then
|
||||||
@@ -129,7 +136,7 @@ run ()
|
|||||||
} >eff
|
} >eff
|
||||||
|
|
||||||
if test $sta_eff -eq $sta_exp; then
|
if test $sta_eff -eq $sta_exp; then
|
||||||
if diff eff exp >/dev/null 2>&1; then
|
if diff $diff_opts eff exp >/dev/null 2>&1; then
|
||||||
echo "$me: PASS: $number"
|
echo "$me: PASS: $number"
|
||||||
else
|
else
|
||||||
echo "$me: FAIL: $number"
|
echo "$me: FAIL: $number"
|
||||||
@@ -140,7 +147,7 @@ run ()
|
|||||||
echo "$me: effective output:"
|
echo "$me: effective output:"
|
||||||
sed -e 's/^/ /' eff
|
sed -e 's/^/ /' eff
|
||||||
echo "$me: diff:"
|
echo "$me: diff:"
|
||||||
diff -u exp eff | sed -e 's/^/ /'
|
diff $diff_opts -u exp eff | sed -e 's/^/ /'
|
||||||
status=1
|
status=1
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
|
|||||||
Reference in New Issue
Block a user