From 6135fdc15236947defa87db66e92b25559ee387d Mon Sep 17 00:00:00 2001 From: Akim Demaille Date: Mon, 4 May 2020 06:25:04 +0200 Subject: examples: beware of portability issues with sh's trap On AIX 7.2, when invoking "exit 77", we actually exit with 127. The "cleanup" function, called via trap, received an incorrect exit status, something described in Autoconf's doc. Reported by Bruno Haible. https://lists.gnu.org/archive/html/bug-bison/2020-05/msg00029.html https://lists.gnu.org/archive/html/bug-bison/2020-05/msg00047.html * examples/test (skip): New. * examples/c/bistromathic/bistromathic.test, * examples/c/reccalc/reccalc.test: Use it, to ensure $? is set to 77 when the trap is called. --- examples/c/bistromathic/bistromathic.test | 3 +-- examples/c/reccalc/reccalc.test | 2 +- examples/test | 14 ++++++++++++++ 3 files changed, 16 insertions(+), 3 deletions(-) (limited to 'examples') diff --git a/examples/c/bistromathic/bistromathic.test b/examples/c/bistromathic/bistromathic.test index d33b4e8f..0f0b7898 100755 --- a/examples/c/bistromathic/bistromathic.test +++ b/examples/c/bistromathic/bistromathic.test @@ -46,8 +46,7 @@ if diff perfect effective >/dev/null 2>&1; then elif diff ok effective >/dev/null 2>&1; then strip_prompt=true else - echo "SKIP: this is not the GNU Readline we expect" - exit 77 + skip "this is not the GNU Readline we expect" fi diff --git a/examples/c/reccalc/reccalc.test b/examples/c/reccalc/reccalc.test index 27716a24..124de6bc 100644 --- a/examples/c/reccalc/reccalc.test +++ b/examples/c/reccalc/reccalc.test @@ -15,7 +15,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -(seq 0) >/dev/null 2>&1 || exit 77 +(seq 0) >/dev/null 2>&1 || skip "gimme one seq" cat >input <