diff options
author | Jörg Frings-Fürst <debian@jff.email> | 2022-02-07 06:57:44 +0100 |
---|---|---|
committer | Jörg Frings-Fürst <debian@jff.email> | 2022-02-07 06:57:44 +0100 |
commit | 6ffaa52cf732a84c0f8259dbc9b8183960ec5c33 (patch) | |
tree | d3136c22e3e805cfc0efe78412cce905a17e0c8d /tests/test-select-out.sh | |
parent | 591cbf5878b7d4105b275585b9db1324c9dfce56 (diff) | |
parent | af151c593704a40e10efb28d1e3dd59a23a661f3 (diff) |
Merge branch 'release/debian/1.0-1'debian/1.0-1
Diffstat (limited to 'tests/test-select-out.sh')
-rwxr-xr-x | tests/test-select-out.sh | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/tests/test-select-out.sh b/tests/test-select-out.sh new file mode 100755 index 0000000..dbeace5 --- /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 |