mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-09 04:13:03 +00:00
bistromathic: beware of portability issues of readline on AIX
Readline may emit escape sequences before the prompt. Reported by Bruno Haible. https://lists.gnu.org/r/platform-testers/2020-05/msg00001.html. * examples/c/bistromathic/bistromathic.test: Trust readline _only_ if we get what we expect on some reference computation.
This commit is contained in:
@@ -28,12 +28,24 @@
|
||||
#
|
||||
# On OpenBSD 6.5 the prompt is displayed, but the input is not
|
||||
# repeated (!). So input "1+2*3\n" gives "> 7\n> \n" as output.
|
||||
#
|
||||
# On AIX, you get some escaping sequence before the prompt:
|
||||
# "<ESC>[?1034h> 1+2*3". It appears to pass the terminfo capability
|
||||
# "smm", to put the terminal in "meta mode": as if the user had hit
|
||||
# META.
|
||||
|
||||
if ! echo '1-1' | prog | grep '>' >/dev/null; then
|
||||
# macOS.
|
||||
echo >perfect '> 0
|
||||
0
|
||||
> '
|
||||
|
||||
echo >ok '0'
|
||||
echo '0' | prog >effective
|
||||
|
||||
if diff perfect effective >/dev/null 2>&1; then
|
||||
# Alles ist gut.
|
||||
elif diff ok effective >/dev/null 2>&1; then
|
||||
strip_prompt=true
|
||||
elif ! echo '1-1' | prog | grep '1-1' >/dev/null; then
|
||||
# OpenBSD 6.5. I don't want to spend time on this.
|
||||
else
|
||||
echo "SKIP: this is not the GNU Readline we expect"
|
||||
exit 77
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user