From d26d10ad6c78482860921254df3540c27bbde774 Mon Sep 17 00:00:00 2001 From: Akim Demaille Date: Thu, 7 May 2020 08:00:17 +0200 Subject: [PATCH] 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. --- examples/c/bistromathic/bistromathic.test | 25 +++++++++++++++-------- examples/test | 11 ++++++++-- 2 files changed, 26 insertions(+), 10 deletions(-) diff --git a/examples/c/bistromathic/bistromathic.test b/examples/c/bistromathic/bistromathic.test index 495146bd..2ef8bc03 100755 --- a/examples/c/bistromathic/bistromathic.test +++ b/examples/c/bistromathic/bistromathic.test @@ -41,10 +41,11 @@ echo >perfect '> 0 echo >ok '0' 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. strip_prompt=false -elif diff ok effective >/dev/null 2>&1; then +elif diff ok effective; then strip_prompt=true else 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 # too painful to try to cope with. if $strip_prompt; then - echo "SKIP: this is not the GNU Readline we expect" - if $exit; then - exit 0 - else - exit 1 - fi + echo "SKIP: this is not the GNU Readline we expect" + exit $status fi +# On Windows10/MSYS2 the ^G coming from 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. sed -e 's/\\t/ /g' >input <eff 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" else echo "$me: FAIL: $number" @@ -140,7 +147,7 @@ run () echo "$me: effective output:" sed -e 's/^/ /' eff echo "$me: diff:" - diff -u exp eff | sed -e 's/^/ /' + diff $diff_opts -u exp eff | sed -e 's/^/ /' status=1 fi else