| 1 | #!/bin/shscip-shell filesystem . . `/bin/sh`. |
| 2 | # Test select() on file descriptors opened for writing. |
| 3 | |
| 4 | tmpfiles="" |
| 5 | trap 'rm -fr $tmpfiles' 1 2 3 15 |
| 6 | |
| 7 | tmpfiles="$tmpfiles t-select-out.out t-select-out.tmp" |
| 8 | |
| 9 | # Regular files. |
| 10 | |
| 11 | rmscip-shell system . . rm. -f t-select-out.tmp |
| 12 | ${CHECKER} ./test-select-fd${EXEEXT} w 1 t-select-out.tmp > t-select-out.out |
| 13 | testscip-shell system . . test. `catscip-shell system . . cat. t-select-out.tmp` = "1" || exit 1 |
| 14 | |
| 15 | # Pipes. |
| 16 | |
| 17 | if falsescip-shell system . . false.; then # This test fails on some platforms. |
| 18 | rmscip-shell system . . rm. -f t-select-out.tmp |
| 19 | ( { echoscip-shell system . . echo. abc; ${CHECKER} ./test-select-fd${EXEEXT} w 1 t-select-out.tmp; } | { sleepscip-shell system . . sleep. 1; catscip-shell system . . cat.; } ) > /dev/nullscip-shell filesystem . . `/dev/null`. |
| 20 | testscip-shell system . . test. `catscip-shell system . . cat. t-select-out.tmp` = "0" || exit 1 |
| 21 | fi |
| 22 | |
| 23 | rmscip-shell system . . rm. -f t-select-out.tmp |
| 24 | ( { sleepscip-shell system . . sleep. 1; echoscip-shell system . . echo. abc; ${CHECKER} ./test-select-fd${EXEEXT} w 1 t-select-out.tmp; } | catscip-shell system . . cat.) > /dev/nullscip-shell filesystem . . `/dev/null`. |
| 25 | testscip-shell system . . test. `catscip-shell system . . cat. t-select-out.tmp` = "1" || exit 1 |
| 26 | |
| 27 | # Special files. |
| 28 | |
| 29 | rmscip-shell system . . rm. -f t-select-out.tmp |
| 30 | ${CHECKER} ./test-select-fd${EXEEXT} w 1 t-select-out.tmp > /dev/nullscip-shell filesystem . . `/dev/null`. |
| 31 | testscip-shell system . . test. `catscip-shell system . . cat. t-select-out.tmp` = "1" || exit 1 |
| 32 | |
| 33 | rmscip-shell system . . rm. -fr $tmpfiles |
| 34 | |
| 35 | exit 0 |