tests: don't expect the shell to support 'local'

It doesn't work on Solaris 11.3 x86/64.
Reported by Kiyoshi Kanazawa.
http://lists.gnu.org/archive/html/bug-bison/2018-10/msg00051.html

* examples/test: Don't use 'local'.
This commit is contained in:
Akim Demaille
2018-10-30 19:04:31 +01:00
parent 5d07f4f726
commit ca8039e612

View File

@@ -45,7 +45,7 @@ fi
# ------- # -------
cleanup () cleanup ()
{ {
local status=$? status=$?
if test -z "$DEBUG"; then if test -z "$DEBUG"; then
cd $cwd cd $cwd
rm -rf $$.dir rm -rf $$.dir
@@ -61,22 +61,22 @@ cd $$.dir
# -noerr: ignore stderr, otherwise merge it into effective output. # -noerr: ignore stderr, otherwise merge it into effective output.
run () run ()
{ {
local noerr=false noerr=false
case $1 in case $1 in
(-noerr) noerr=true; shift;; (-noerr) noerr=true; shift;;
esac esac
# Expected exit status. # Expected exit status.
local sta_exp="$1" sta_exp=$1
shift shift
# Expected output. # Expected output.
local out_exp="$1" out_exp=$1
shift shift
# Effective exit status. # Effective exit status.
local sta_eff=0 sta_eff=0
$prog "$@" - <input >out_eff 2>err_eff || sta_eff=$? $prog "$@" - <input >out_eff 2>err_eff || sta_eff=$?
# Combine effective output and error streams. # Combine effective output and error streams.
local out_eff="$(cat out_eff && $noerr || sed -e 's/^/err: /g' err_eff)" out_eff=$(cat out_eff && $noerr || sed -e 's/^/err: /g' err_eff)
if test $sta_eff -eq $sta_exp; then if test $sta_eff -eq $sta_exp; then
if test "$out_eff" = "$out_exp"; then if test "$out_eff" = "$out_exp"; then
echo "$me: PASS: $number" echo "$me: PASS: $number"