From aaab60dfd632bd33dbefffd0782ca063b3797e32 Mon Sep 17 00:00:00 2001 From: Sean Kurtz Date: Wed, 18 Nov 2026 07:44:04 -0600 Subject: 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. --- tests/run.sh | 14 +++++++++++++- tests/tools/zos-gnu/od | 8 ++++++++ tests/tools/zos-gnu/sleep | 8 ++++++++ tests/tools/zos-gnu/sort | 8 ++++++++ tests/tools/zos-gnu/tr | 8 ++++++++ tests/tools/zos-gnu/wc | 8 ++++++++ 6 files changed, 53 insertions(+), 1 deletion(-) create mode 100755 tests/tools/zos-gnu/od create mode 100755 tests/tools/zos-gnu/sleep create mode 100755 tests/tools/zos-gnu/sort create mode 100755 tests/tools/zos-gnu/tr create mode 100755 tests/tools/zos-gnu/wc 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" "$@" -- cgit