From 1c7b143a798a41e549cd1aceb532dfd08ab5e0e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C3=A1draig=20Brady?= Date: Tue, 12 Apr 2022 12:31:01 +0100 Subject: [PATCH] tests: cygwin: handle ENOENT from execvp(".") * tests/misc/env.sh: Verify with another command that execvp() doesn not return ENOENT, before testing the exit code from the command in question. * tests/misc/nice-fail.sh: Likewise. * tests/misc/stdbuf.sh: Likewise. * tests/misc/timeout-parameters.sh: Likewise. --- tests/misc/env.sh | 4 ++-- tests/misc/nice-fail.sh | 4 ++-- tests/misc/stdbuf.sh | 4 ++-- tests/misc/timeout-parameters.sh | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/tests/misc/env.sh b/tests/misc/env.sh index 3e10899d5..5a63f347c 100755 --- a/tests/misc/env.sh +++ b/tests/misc/env.sh @@ -18,7 +18,7 @@ . "${srcdir=.}/tests/init.sh"; path_prepend_ ./src -print_ver_ env pwd +print_ver_ env pwd nice # A simple shebang program to call "echo" from symlinks like "./-u" or "./--". echo "#!$abs_top_builddir/src/echo simple_echo" > simple_echo \ @@ -46,7 +46,7 @@ compare exp out || fail=1 returns_ 125 env --- || fail=1 # unknown option returns_ 125 env -u || fail=1 # missing option argument returns_ 2 env sh -c 'exit 2' || fail=1 # exit status propagation -returns_ 126 env . || fail=1 # invalid command +returns_ 126 nice . && { returns_ 126 env . || fail=1; } # invalid command returns_ 127 env no_such || fail=1 # no such command # POSIX is clear that environ may, but need not be, sorted. diff --git a/tests/misc/nice-fail.sh b/tests/misc/nice-fail.sh index 3303662d1..5fdd9c315 100755 --- a/tests/misc/nice-fail.sh +++ b/tests/misc/nice-fail.sh @@ -18,7 +18,7 @@ . "${srcdir=.}/tests/init.sh"; path_prepend_ ./src -print_ver_ nice +print_ver_ nice env # These tests verify exact status of internal failure. @@ -26,7 +26,7 @@ returns_ 125 nice -n 1 || fail=1 # missing command returns_ 125 nice --- || fail=1 # unknown option returns_ 125 nice -n 1a || fail=1 # invalid adjustment returns_ 2 nice sh -c 'exit 2' || fail=1 # exit status propagation -returns_ 126 nice . || fail=1 # invalid command +returns_ 126 env . && { returns_ 126 nice . || fail=1; } # invalid command returns_ 127 nice no_such || fail=1 # no such command Exit $fail diff --git a/tests/misc/stdbuf.sh b/tests/misc/stdbuf.sh index e07ad02d7..6a21592a7 100755 --- a/tests/misc/stdbuf.sh +++ b/tests/misc/stdbuf.sh @@ -17,7 +17,7 @@ # along with this program. If not, see . . "${srcdir=.}/tests/init.sh"; path_prepend_ ./src -print_ver_ stdbuf +print_ver_ stdbuf env getlimits_ @@ -52,7 +52,7 @@ returns_ 125 stdbuf -o$SIZE_OFLOW true || fail=1 # size too large returns_ 125 stdbuf -iL true || fail=1 # line buffering stdin disallowed returns_ 125 stdbuf true || fail=1 # a buffering mode must be specified stdbuf -i0 -o0 -e0 true || fail=1 #check all files -returns_ 126 stdbuf -o1 . || fail=1 # invalid command +returns_ 126 env . && { returns_ 126 stdbuf -o1 . || fail=1; } # invalid command returns_ 127 stdbuf -o1 no_such || fail=1 # no such command # Terminate any background processes diff --git a/tests/misc/timeout-parameters.sh b/tests/misc/timeout-parameters.sh index fc9c8392f..8c8c29b97 100755 --- a/tests/misc/timeout-parameters.sh +++ b/tests/misc/timeout-parameters.sh @@ -17,7 +17,7 @@ # along with this program. If not, see . . "${srcdir=.}/tests/init.sh"; path_prepend_ ./src -print_ver_ timeout +print_ver_ timeout env getlimits_ @@ -42,7 +42,7 @@ timeout 9.999999999 sleep 0 || fail=1 returns_ 125 timeout --signal=invalid 1 sleep 0 || fail=1 # invalid command -returns_ 126 timeout 10 . || fail=1 +returns_ 126 env . && { returns_ 126 timeout 10 . || fail=1; } # no such command returns_ 127 timeout 10 no_such || fail=1 -- 2.26.2