1
0
Fork 0
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:
Martijn Dekker 2021-02-13 00:29:19 +00:00
parent 6f6b22016a
commit 2c04a88b37
2 changed files with 12 additions and 14 deletions

View file

@ -168,7 +168,7 @@ function valxml
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
print "If not available, try script(1) to simulate a tty." >&2
exit 128