diff options
| author | Sean Kurtz <seankurtz75@gmail.com> | 2026-11-18 07:44:04 -0600 |
|---|---|---|
| committer | Sean Kurtz <seankurtz75@gmail.com> | 2026-11-18 07:44:04 -0600 |
| commit | aaab60dfd632bd33dbefffd0782ca063b3797e32 (patch) | |
| tree | f1c783b93198af5bee1318e9bb5e7450ef370012 /tests | |
| parent | 4cad69899fd2ac172b1f706571b99afb62601540 (diff) | |
| download | zash-aaab60dfd632bd33dbefffd0782ca063b3797e32.tar.gz | |
tests/run.sh: GNU tools and quiet signals on z/OS
The .exp files were recorded on GNU userland. z/OS puts IBM tools
first on PATH, so sleep rejected 0.3, wc padded its counts, tr ignored
-c and od added a blank line. Prepend wrappers that pick the zopen GNU
copies, and drop what only z/OS prints: the LE signal banner and EDC
message ids inside strerror() text.
Diffstat (limited to 'tests')
| -rwxr-xr-x | tests/run.sh | 14 | ||||
| -rwxr-xr-x | tests/tools/zos-gnu/od | 8 | ||||
| -rwxr-xr-x | tests/tools/zos-gnu/sleep | 8 | ||||
| -rwxr-xr-x | tests/tools/zos-gnu/sort | 8 | ||||
| -rwxr-xr-x | tests/tools/zos-gnu/tr | 8 | ||||
| -rwxr-xr-x | tests/tools/zos-gnu/wc | 8 |
6 files changed, 53 insertions, 1 deletions
diff --git a/tests/run.sh b/tests/run.sh index c99ccff..2ef38c7 100755 --- a/tests/run.sh +++ b/tests/run.sh @@ -55,6 +55,18 @@ Linux) platform=linux ;; OS/390) platform=zos ;; *) platform=none ;; esac +# The .exp files were recorded with GNU tools. z/OS puts its own versions +# first on PATH, so give the tests the GNU ones where they differ. +if [ "$platform" = zos ]; then + PATH=$here/tools/zos-gnu:$PATH + export PATH +fi +# z/OS also adds to stderr what Linux never prints: the LE banner for every +# process killed by a signal, and EDC message ids inside strerror() text. +drop= +if [ "$platform" = zos ]; then + drop='/^CEE5[0-9][0-9][0-9]S The signal SIG.* was received\.$/d;s/EDC[0-9][0-9][0-9][0-9]I //g' +fi # "\101" is "A" only if the shell was built for ASCII. if [ "$("$shell" -c "printf '\\101'")" = A ]; then ascii=1 @@ -100,7 +112,7 @@ for t in "$here"/posix/*.sh "$here"/scripts/*.sh "$here"/zash/*.sh \ continue fi # Error messages name the shell and script; make them comparable. - sed -e "s|$t|SCRIPT|g" -e "s|$shell|SHELL|g" "$work/out" >"$work/got" + sed -e "s|$t|SCRIPT|g" -e "s|$shell|SHELL|g" -e "$drop" "$work/out" >"$work/got" if cmp -s "$work/got" "${t%.sh}.exp"; then pass=$((pass + 1)) [ "$verbose" = 1 ] && echo "ok $name" diff --git a/tests/tools/zos-gnu/od b/tests/tools/zos-gnu/od new file mode 100755 index 0000000..c721f79 --- /dev/null +++ b/tests/tools/zos-gnu/od @@ -0,0 +1,8 @@ +#!/bin/sh +# The tests' expected output was recorded with GNU tools. z/OS ships +# IBM versions first on PATH; the zopen package has GNU ones under a g +# prefix. Use those, and fall back to the system tool when there is no +# GNU copy. Copied under each name the tests need (see run.sh). +tool=${0##*/} +command -v "g$tool" >/dev/null 2>&1 && exec "g$tool" "$@" +exec "/bin/$tool" "$@" diff --git a/tests/tools/zos-gnu/sleep b/tests/tools/zos-gnu/sleep new file mode 100755 index 0000000..c721f79 --- /dev/null +++ b/tests/tools/zos-gnu/sleep @@ -0,0 +1,8 @@ +#!/bin/sh +# The tests' expected output was recorded with GNU tools. z/OS ships +# IBM versions first on PATH; the zopen package has GNU ones under a g +# prefix. Use those, and fall back to the system tool when there is no +# GNU copy. Copied under each name the tests need (see run.sh). +tool=${0##*/} +command -v "g$tool" >/dev/null 2>&1 && exec "g$tool" "$@" +exec "/bin/$tool" "$@" diff --git a/tests/tools/zos-gnu/sort b/tests/tools/zos-gnu/sort new file mode 100755 index 0000000..c721f79 --- /dev/null +++ b/tests/tools/zos-gnu/sort @@ -0,0 +1,8 @@ +#!/bin/sh +# The tests' expected output was recorded with GNU tools. z/OS ships +# IBM versions first on PATH; the zopen package has GNU ones under a g +# prefix. Use those, and fall back to the system tool when there is no +# GNU copy. Copied under each name the tests need (see run.sh). +tool=${0##*/} +command -v "g$tool" >/dev/null 2>&1 && exec "g$tool" "$@" +exec "/bin/$tool" "$@" diff --git a/tests/tools/zos-gnu/tr b/tests/tools/zos-gnu/tr new file mode 100755 index 0000000..c721f79 --- /dev/null +++ b/tests/tools/zos-gnu/tr @@ -0,0 +1,8 @@ +#!/bin/sh +# The tests' expected output was recorded with GNU tools. z/OS ships +# IBM versions first on PATH; the zopen package has GNU ones under a g +# prefix. Use those, and fall back to the system tool when there is no +# GNU copy. Copied under each name the tests need (see run.sh). +tool=${0##*/} +command -v "g$tool" >/dev/null 2>&1 && exec "g$tool" "$@" +exec "/bin/$tool" "$@" diff --git a/tests/tools/zos-gnu/wc b/tests/tools/zos-gnu/wc new file mode 100755 index 0000000..c721f79 --- /dev/null +++ b/tests/tools/zos-gnu/wc @@ -0,0 +1,8 @@ +#!/bin/sh +# The tests' expected output was recorded with GNU tools. z/OS ships +# IBM versions first on PATH; the zopen package has GNU ones under a g +# prefix. Use those, and fall back to the system tool when there is no +# GNU copy. Copied under each name the tests need (see run.sh). +tool=${0##*/} +command -v "g$tool" >/dev/null 2>&1 && exec "g$tool" "$@" +exec "/bin/$tool" "$@" |
