mirror of
git://git.code.sf.net/p/cdesktopenv/code
synced 2025-03-09 15:50:02 +00:00
shtests: actually test /dev/tty instead of checking for existence
The GitHub runners apparently provide a non-working /dev/tty. To avoid failures and confusion, shtests shold refuse to run the tests and tell people to use script(1) to simulate a tty. On Linux, it goes like this: script -q -e -c 'bin/shtests --your-options-here' On macOS and FreeBSD, the invocation is: script -q /dev/null bin/shtests --your-options-here The NetBSD and OpenBSD variants of script(1) need different invocations again. They also don't pass down the command's exit status, so would need a workaround for that. It would be nice if we could use pty for this as this comes with the distribution, so would work the same on every OS, but it seems to be broken for this use case. src/cmd/ksh93/tests/shtest: - Use 'test -t 1' with stdout (fd 1) redirected to /dev/tty to ensure the tty is actually on a terminal. src/cmd/ksh93/tests/basic.sh: - Remove superflous check for tty. All tests run through shtests. Resolves: https://github.com/ksh93/ksh/pull/171
This commit is contained in:
parent
6f6b22016a
commit
2c04a88b37
2 changed files with 12 additions and 14 deletions
|
@ -670,8 +670,7 @@ eu=$(
|
||||||
# ======
|
# ======
|
||||||
# Test for bug in ksh binaries that use posix_spawn() while job control is active.
|
# Test for bug in ksh binaries that use posix_spawn() while job control is active.
|
||||||
# See discussion at: https://github.com/ksh93/ksh/issues/79
|
# See discussion at: https://github.com/ksh93/ksh/issues/79
|
||||||
if test -t 1 2>/dev/null 1>/dev/tty # this test only works if we have a tty
|
actual=$(
|
||||||
then actual=$(
|
|
||||||
"$SHELL" -i <<-\EOF 2>/dev/tty
|
"$SHELL" -i <<-\EOF 2>/dev/tty
|
||||||
printf '%s\n' 1 2 3 4 5 | while read
|
printf '%s\n' 1 2 3 4 5 | while read
|
||||||
do ls /dev/null
|
do ls /dev/null
|
||||||
|
@ -682,7 +681,6 @@ then actual=$(
|
||||||
expect=$'/dev/null\n/dev/null\n/dev/null\n/dev/null\n/dev/null'
|
expect=$'/dev/null\n/dev/null\n/dev/null\n/dev/null\n/dev/null'
|
||||||
[[ $actual == "$expect" ]] || err_exit 'Race condition while launching external commands' \
|
[[ $actual == "$expect" ]] || err_exit 'Race condition while launching external commands' \
|
||||||
"(expected $(printf %q "$expect"), got $(printf %q "$actual"))"
|
"(expected $(printf %q "$expect"), got $(printf %q "$actual"))"
|
||||||
fi
|
|
||||||
|
|
||||||
# ======
|
# ======
|
||||||
# Expansion of multibyte characters after expansion of single-character names $1..$9, $?, $!, $-, etc.
|
# Expansion of multibyte characters after expansion of single-character names $1..$9, $?, $!, $-, etc.
|
||||||
|
|
|
@ -168,7 +168,7 @@ function valxml
|
||||||
return $errors
|
return $errors
|
||||||
}
|
}
|
||||||
|
|
||||||
if [[ ! -c /dev/tty || ! -w /dev/tty ]]
|
if ! test -t 1 2>/dev/null 1>/dev/tty
|
||||||
then print "The regression tests require a functioning /dev/tty." >&2
|
then print "The regression tests require a functioning /dev/tty." >&2
|
||||||
print "If not available, try script(1) to simulate a tty." >&2
|
print "If not available, try script(1) to simulate a tty." >&2
|
||||||
exit 128
|
exit 128
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue