Hi Bruno, > Le 3 mai 2020 à 21:32, Bruno Haible <[email protected]> a écrit : > > Akim Demaille wrote: >> "foo || bar" does not invoke bar on AIX 7.2 when foo does not exist. >> It just dies. > > That doesn't appear to be the cause. bison-3.5.93 still fails the same > test, in the same way: > > FAIL: examples/c/reccalc/reccalc.test > > FAIL examples/c/reccalc/reccalc.test (exit status: 127) > > When I add a 'set -x' statement in the second line of this test file, > I get: > > FAIL: examples/c/reccalc/reccalc > ================================ > > + 1> /dev/null 2>& 1 > + exit 77 > + cleanup > FAIL examples/c/reccalc/reccalc.test (exit status: 127) > > So, now, the 'exit 77' statement is indeed executed, but it is followed > by a 'cleanup' statement. 'cleanup' in defined in a different file. > > I don't really understand it.
The examples have local tests which are simple shell scripts. The shell is invoked for each one with examples/test prepended. examples/test provide the functions the *.test tests use. That's defined in examples/local.mk: TEST_LOG_COMPILER = $(SHELL) $(top_srcdir)/%D%/test whose semantics is close to that of a "%.log: %.test" recipe. Thanks for the report. I believe this time we nailed it. Cheers! commit a375ba2962fa5585903a770bb0e52d732ad43260 Author: Akim Demaille <[email protected]> Date: Mon May 4 06:25:04 2020 +0200 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. 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 <http://www.gnu.org/licenses/>. -(seq 0) >/dev/null 2>&1 || exit 77 +(seq 0) >/dev/null 2>&1 || skip "gimme one seq" cat >input <<EOF 1+2*3 diff --git a/examples/test b/examples/test index 02e59b3f..3bf6edd4 100755 --- a/examples/test +++ b/examples/test @@ -68,6 +68,20 @@ trap cleanup 0 1 2 13 15 mkdir $$.dir cd $$.dir + +# skip [MSG] +# ---------- +# Skip this test. +skip () +{ + if test x"$1" != x; then + echo "SKIP: $1" + fi + # See Autoconf's doc on 'trap'. + (exit 77); exit 77 +} + + # run [-noerr, -n] EXPECTED-EXIT-STATUS EXPECTED-OUTPUT [PARSER-OPTIONS] # ---------------------------------------------------------------------- # -noerr: ignore stderr, otherwise merge it into effective output.
