diff options
author | Igor Pashev <pashev.igor@gmail.com> | 2012-09-09 02:33:07 +0000 |
---|---|---|
committer | Igor Pashev <pashev.igor@gmail.com> | 2012-09-09 02:33:07 +0000 |
commit | 8e7ba70eba02f88d4f3ba12e07ab9c7bdf32240a (patch) | |
tree | 35373d0bc6f80a2f2ce1c49c91b3817f26b6c465 /gnulib-tests/test-select-in.sh | |
download | coreutils-8e7ba70eba02f88d4f3ba12e07ab9c7bdf32240a.tar.gz |
Imported Upstream version 8.17upstream/8.17
Diffstat (limited to 'gnulib-tests/test-select-in.sh')
-rwxr-xr-x | gnulib-tests/test-select-in.sh | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/gnulib-tests/test-select-in.sh b/gnulib-tests/test-select-in.sh new file mode 100755 index 00000000..44f5dbb8 --- /dev/null +++ b/gnulib-tests/test-select-in.sh @@ -0,0 +1,38 @@ +#!/bin/sh +# Test select() on file descriptors opened for reading. + +# This test is known to fail on Solaris 2.6 and older, due to its handling +# of /dev/null. + +tmpfiles="" +trap 'rm -fr $tmpfiles' 1 2 3 15 + +tmpfiles="$tmpfiles t-select-in.tmp" + +# Regular files. + +rm -f t-select-in.tmp +./test-select-fd${EXEEXT} r 0 t-select-in.tmp < ./test-select-fd${EXEEXT} +test `cat t-select-in.tmp` = "1" || exit 1 + +# Pipes. + +rm -f t-select-in.tmp +{ sleep 1; echo abc; } | \ + { ./test-select-fd${EXEEXT} r 0 t-select-in.tmp; cat > /dev/null; } +test `cat t-select-in.tmp` = "0" || exit 1 + +rm -f t-select-in.tmp +echo abc | { sleep 1; ./test-select-fd${EXEEXT} r 0 t-select-in.tmp; } +test `cat t-select-in.tmp` = "1" || exit 1 + +# Special files. +# This part of the test is known to fail on Solaris 2.6 and older. + +rm -f t-select-in.tmp +./test-select-fd${EXEEXT} r 0 t-select-in.tmp < /dev/null +test `cat t-select-in.tmp` = "1" || exit 1 + +rm -fr $tmpfiles + +exit 0 |