diff options
| author | Sean Kurtz <seankurtz75@gmail.com> | 2026-11-18 07:56:42 -0600 |
|---|---|---|
| committer | Sean Kurtz <seankurtz75@gmail.com> | 2026-11-18 07:56:42 -0600 |
| commit | 99cd9ce4119fa81dea0c2f7ea892420b331c778b (patch) | |
| tree | 3237dafae53121440901f1d9bbee13db26a63953 | |
| parent | d68247c661d27e506652474fb605dc3629762b6b (diff) | |
| download | zash-99cd9ce4119fa81dea0c2f7ea892420b331c778b.tar.gz | |
tests/run.sh: compare with the GNU cmp and diff on z/OS
IBM cmp calls any output holding a NUL byte binary and refuses to
compare it, so posix/printf-ext and zash/ash-differences failed whatever
the shell did. Both GNU tools read the tagged files through automatic
conversion and compare the text that was meant.
| -rwxr-xr-x | tests/run.sh | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/tests/run.sh b/tests/run.sh index a5c93f8..b88b143 100755 --- a/tests/run.sh +++ b/tests/run.sh @@ -68,11 +68,16 @@ if [ "$platform" = zos ]; then 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. +# process killed by a signal, and EDC message ids (with their full stop) in +# 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' + drop='/^CEE5[0-9][0-9][0-9]S The signal SIG.* was received\.$/d;/EDC[0-9][0-9][0-9][0-9]I /{s/EDC[0-9][0-9][0-9][0-9]I //;s/\.$//;}' fi +# IBM cmp and diff give up on output holding NUL bytes, which posix/printf-ext +# produces on purpose. +cmpcmd=$(command -v gcmp || echo cmp) +diffcmd=$(command -v gdiff || echo diff) # "\101" is "A" only if the shell was built for ASCII. if [ "$("$shell" -c "printf '\\101'")" = A ]; then ascii=1 @@ -119,13 +124,13 @@ for t in "$here"/posix/*.sh "$here"/scripts/*.sh "$here"/zash/*.sh \ fi # Error messages name the shell and script; make them comparable. 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 + if "$cmpcmd" -s "$work/got" "${t%.sh}.exp"; then pass=$((pass + 1)) [ "$verbose" = 1 ] && echo "ok $name" else fail=$((fail + 1)) echo "FAIL $name" >&2 - diff "${t%.sh}.exp" "$work/got" | sed 's/^/ /' >&2 + "$diffcmd" "${t%.sh}.exp" "$work/got" | sed 's/^/ /' >&2 fi done if [ "$fail" -gt 0 ]; then |
