summaryrefslogtreecommitdiffhomepage
path: root/tests/tools/zos-stubs/run.sh
blob: a6539d168dceda950e1dce8a4db5e270fcca3f8b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#!/bin/sh
# Run the z/OS tests that need tso(1) and data sets on Linux, with the
# stand-ins in this directory, against the shell named:
#
#   sh tests/tools/zos-stubs/run.sh ./zash
#
# This checks the shell side of those tests (quoting, pipes, statuses,
# cleanup) before they reach a real system; it says nothing about z/OS.
here=$(cd "$(dirname "$0")" && pwd)
tests=$(cd "$here/../.." && pwd)
shell=$1
case $shell in /*) ;; *) shell=$PWD/$shell ;; esac
ZOS_STUB_STORE=${TMPDIR:-/tmp}/zos-stub-store.$$
export ZOS_STUB_STORE
work=${TMPDIR:-/tmp}/zos-stub-work.$$
trap 'rm -rf "$work" "$ZOS_STUB_STORE"' EXIT
status=0
for t in datasets tso; do
    rm -rf "$work"; mkdir -p "$work"
    (cd "$work" && PATH=$here:$PATH TSH=$shell "$shell" "$tests/zos/$t.sh" \
        >out 2>&1; echo "[status $?]" >>out)
    if diff "$tests/zos/$t.exp" "$work/out" >/dev/null; then
        echo "zos/$t: ok (stand-ins)"
    else
        echo "zos/$t: FAILED"; diff "$tests/zos/$t.exp" "$work/out" | sed 's/^/    /'
        status=1
    fi
done
exit $status