usleep tests: Avoid failure due to known Cygwin 3.5.3 bug.
[gnulib.git] / tests / test-select-out.sh
blobcfa5e179578ae1405bdf3bee2ce0591f1f1b0b0b
1 #!/bin/sh
2 # Test select() on file descriptors opened for writing.
4 tmpfiles=""
5 trap 'rm -fr $tmpfiles' HUP INT QUIT TERM
7 tmpfiles="$tmpfiles t-select-out.out t-select-out.tmp"
9 # Regular files.
11 rm -f t-select-out.tmp
12 ${CHECKER} ./test-select-fd${EXEEXT} w 1 t-select-out.tmp > t-select-out.out
13 test `cat t-select-out.tmp` = "1" || exit 1
15 # Pipes.
17 if false; then # This test fails on some platforms.
18 rm -f t-select-out.tmp
19 ( { echo abc; ${CHECKER} ./test-select-fd${EXEEXT} w 1 t-select-out.tmp; } | { sleep 1; cat; } ) > /dev/null
20 test `cat t-select-out.tmp` = "0" || exit 1
23 rm -f t-select-out.tmp
24 ( { sleep 1; echo abc; ${CHECKER} ./test-select-fd${EXEEXT} w 1 t-select-out.tmp; } | cat) > /dev/null
25 test `cat t-select-out.tmp` = "1" || exit 1
27 # Special files.
29 rm -f t-select-out.tmp
30 ${CHECKER} ./test-select-fd${EXEEXT} w 1 t-select-out.tmp > /dev/null
31 test `cat t-select-out.tmp` = "1" || exit 1
33 rm -fr $tmpfiles
35 exit 0