From be8efac78d067c138ad8dda03df4336e73f94887 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Frings-F=C3=BCrst?= Date: Sat, 8 Jan 2022 11:51:07 +0100 Subject: New upstream version 1.0 --- tests/test-select-out.sh | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100755 tests/test-select-out.sh (limited to 'tests/test-select-out.sh') diff --git a/tests/test-select-out.sh b/tests/test-select-out.sh new file mode 100755 index 00000000..dbeace50 --- /dev/null +++ b/tests/test-select-out.sh @@ -0,0 +1,35 @@ +#!/bin/sh +# Test select() on file descriptors opened for writing. + +tmpfiles="" +trap 'rm -fr $tmpfiles' 1 2 3 15 + +tmpfiles="$tmpfiles t-select-out.out t-select-out.tmp" + +# Regular files. + +rm -f t-select-out.tmp +${CHECKER} ./test-select-fd${EXEEXT} w 1 t-select-out.tmp > t-select-out.out +test `cat t-select-out.tmp` = "1" || exit 1 + +# Pipes. + +if false; then # This test fails on some platforms. + rm -f t-select-out.tmp + ( { echo abc; ${CHECKER} ./test-select-fd${EXEEXT} w 1 t-select-out.tmp; } | { sleep 1; cat; } ) > /dev/null + test `cat t-select-out.tmp` = "0" || exit 1 +fi + +rm -f t-select-out.tmp +( { sleep 1; echo abc; ${CHECKER} ./test-select-fd${EXEEXT} w 1 t-select-out.tmp; } | cat) > /dev/null +test `cat t-select-out.tmp` = "1" || exit 1 + +# Special files. + +rm -f t-select-out.tmp +${CHECKER} ./test-select-fd${EXEEXT} w 1 t-select-out.tmp > /dev/null +test `cat t-select-out.tmp` = "1" || exit 1 + +rm -fr $tmpfiles + +exit 0 -- cgit v1.2.3