diff options
Diffstat (limited to 'gl/tests/test-select-out.sh')
-rwxr-xr-x | gl/tests/test-select-out.sh | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/gl/tests/test-select-out.sh b/gl/tests/test-select-out.sh new file mode 100755 index 0000000000..f83beeb1f5 --- /dev/null +++ b/gl/tests/test-select-out.sh @@ -0,0 +1,29 @@ +#!/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. + +./test-select-fd${EXEEXT} w 1 > t-select-out.out 2> t-select-out.tmp +test `cat t-select-out.tmp` = "1" || exit 1 + +# Pipes. + +( { echo abc; ./test-select-fd${EXEEXT} w 1; } | { sleep 1; cat; } ) > /dev/null 2> t-select-out.tmp +test `cat t-select-out.tmp` = "0" || exit 1 + +( { sleep 1; echo abc; ./test-select-fd${EXEEXT} w 1; } | cat) > /dev/null 2> t-select-out.tmp +test `cat t-select-out.tmp` = "1" || exit 1 + +# Special files. + +./test-select-fd${EXEEXT} w 1 > /dev/null 2> t-select-out.tmp +test `cat t-select-out.tmp` = "1" || exit 1 + +rm -fr $tmpfiles + +exit 0 |