summaryrefslogtreecommitdiff
path: root/gl/tests/test-select-out.sh
diff options
context:
space:
mode:
authorSimon Josefsson <simon@josefsson.org>2008-11-10 12:08:50 +0100
committerSimon Josefsson <simon@josefsson.org>2008-11-10 12:08:50 +0100
commit622b00c1f9f2dae59e1f4b29ba7c5566e3cceb25 (patch)
treeacedc1db086a648ef27d7973de731677e8c11bf5 /gl/tests/test-select-out.sh
parent8db007da11d55f0b3b05a7efbfba05481401db16 (diff)
downloadgnutls-622b00c1f9f2dae59e1f4b29ba7c5566e3cceb25.tar.gz
Update gnulib files.
Diffstat (limited to 'gl/tests/test-select-out.sh')
-rwxr-xr-xgl/tests/test-select-out.sh29
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