test: redirect STDIN from /dev/null

Without this stdin may be anything that parent process provided for it.

Test processes might have tried to read something from it, which would
have caused undeterministic behavior.

E.g. gdb(1) tries to do tty related ioctls on fd 0 (and fd 1 and fd 2,
but those are redirected to 'test.output' before test runs).
This commit is contained in:
Tomi Ollila 2019-05-21 23:17:02 +03:00 committed by David Bremner
parent 2669117ad7
commit f33053023b

View file

@ -55,6 +55,9 @@ done,*)
;;
esac
# STDIN from /dev/null. EOF for readers (and ENOTTY for tty related ioctls).
exec </dev/null
# Save STDOUT to fd 6 and STDERR to fd 7.
exec 6>&1 7>&2
# Make xtrace debugging (when used) use redirected STDERR, with verbose lead: