tests: automatic re-execution works for non-POSIX shells too
authorStefano Lattarini <stefano.lattarini@gmail.com>
Fri, 22 Jun 2012 09:40:39 +0000 (11:40 +0200)
committerStefano Lattarini <stefano.lattarini@gmail.com>
Fri, 22 Jun 2012 12:32:52 +0000 (14:32 +0200)
commit3a1a8c6d3cb46bfe65b715ddd8a3e0d7e27e1bf7
tree288395ba9e76fcf748ebbf56b0ab2c9f1d543be8
parent6e713425a0dcede167924e7691e95ab5e54e399c
tests: automatic re-execution works for non-POSIX shells too

Some inferior shells are too greedy in parsing their input.  If a
non-POSIX Bourne shell (like Solaris 10 /bin/sh) was used to launch
one of our test scripts, it would fail unconditionally, because it
unexpectedly saw some (by it) unsupported constructs, notwithstanding
such constructs being placed *after* the code implementing automatic
test re-execution with a better shell.  In conclusion, the shell
bailed out like this:

    $ /bin/sh t/ar.sh
    $ t/ar.sh: syntax error at line 257: `is_newest_files=$' unexpected

By moving all the potentially problematic code in a separate file, to
be sourced only after the code for automatic re-execution with a better
shell, we ensure that inferior shell cannot see such code by mistake.

* defs: All code after automatic shell re-execution moved out ...
* t/ax/test-init.sh: ... to this new file.
* syntax-checks.mk (xdefs): Add it.
* Makefile.am (dist_check_DATA): Add it.  Also move in 'defs' from
a less explicit 'check_DATA' declaration.
(nodist_check_DATA):  Move in 'defs-static' from a less explicit
'check_DATA' declaration.
(check_DATA): Remove.
* t/self-check-sanity.sh: Remove, it was actually too hacky and brittle,
sanity-checking situations we don0t actually care about.
* t/list-of-tests.mk: Adjust.
* t/self-check-explicit-skips.sh: Adjust, and fix a botched heading
comments while we are at it.
* t/self-check-reexec.tap: Adjust.
* t/self-check-cleanup.tap: Likewise.

Signed-off-by: Stefano Lattarini <stefano.lattarini@gmail.com>
Makefile.am
defs
syntax-checks.mk
t/ax/test-init.sh [new file with mode: 0644]
t/list-of-tests.mk
t/self-check-cleanup.tap
t/self-check-explicit-skips.sh
t/self-check-reexec.tap
t/self-check-sanity.sh [deleted file]