annotate tests/test-select-in.sh @ 40186:8964917f9574

autoupdate
author Karl Berry <karl@freefriends.org>
date Mon, 18 Feb 2019 08:02:49 -0800
parents 700012efeb01
children 8c1a17df67e0
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
10771
1ac304db6933 More tests for 'select' module.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
1 #!/bin/sh
1ac304db6933 More tests for 'select' module.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2 # Test select() on file descriptors opened for reading.
1ac304db6933 More tests for 'select' module.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
3
10921
bafc6771d75a Document a select() bug on Solaris 2.6.
Bruno Haible <bruno@clisp.org>
parents: 10787
diff changeset
4 # This test is known to fail on Solaris 2.6 and older, due to its handling
bafc6771d75a Document a select() bug on Solaris 2.6.
Bruno Haible <bruno@clisp.org>
parents: 10787
diff changeset
5 # of /dev/null.
bafc6771d75a Document a select() bug on Solaris 2.6.
Bruno Haible <bruno@clisp.org>
parents: 10787
diff changeset
6
10771
1ac304db6933 More tests for 'select' module.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
7 tmpfiles=""
1ac304db6933 More tests for 'select' module.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
8 trap 'rm -fr $tmpfiles' 1 2 3 15
1ac304db6933 More tests for 'select' module.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
9
1ac304db6933 More tests for 'select' module.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
10 tmpfiles="$tmpfiles t-select-in.tmp"
1ac304db6933 More tests for 'select' module.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
11
1ac304db6933 More tests for 'select' module.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
12 # Regular files.
1ac304db6933 More tests for 'select' module.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
13
10787
14671fbf0b74 Don't rely on the contents of stderr of shell commands.
Bruno Haible <bruno@clisp.org>
parents: 10771
diff changeset
14 rm -f t-select-in.tmp
14671fbf0b74 Don't rely on the contents of stderr of shell commands.
Bruno Haible <bruno@clisp.org>
parents: 10771
diff changeset
15 ./test-select-fd${EXEEXT} r 0 t-select-in.tmp < ./test-select-fd${EXEEXT}
10771
1ac304db6933 More tests for 'select' module.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
16 test `cat t-select-in.tmp` = "1" || exit 1
1ac304db6933 More tests for 'select' module.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
17
1ac304db6933 More tests for 'select' module.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
18 # Pipes.
1ac304db6933 More tests for 'select' module.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
19
10787
14671fbf0b74 Don't rely on the contents of stderr of shell commands.
Bruno Haible <bruno@clisp.org>
parents: 10771
diff changeset
20 rm -f t-select-in.tmp
13251
700012efeb01 tests: be robust to ignored SIGPIPE
Eric Blake <eblake@redhat.com>
parents: 10921
diff changeset
21 { sleep 1; echo abc; } | \
700012efeb01 tests: be robust to ignored SIGPIPE
Eric Blake <eblake@redhat.com>
parents: 10921
diff changeset
22 { ./test-select-fd${EXEEXT} r 0 t-select-in.tmp; cat > /dev/null; }
10771
1ac304db6933 More tests for 'select' module.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
23 test `cat t-select-in.tmp` = "0" || exit 1
1ac304db6933 More tests for 'select' module.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
24
10787
14671fbf0b74 Don't rely on the contents of stderr of shell commands.
Bruno Haible <bruno@clisp.org>
parents: 10771
diff changeset
25 rm -f t-select-in.tmp
14671fbf0b74 Don't rely on the contents of stderr of shell commands.
Bruno Haible <bruno@clisp.org>
parents: 10771
diff changeset
26 echo abc | { sleep 1; ./test-select-fd${EXEEXT} r 0 t-select-in.tmp; }
10771
1ac304db6933 More tests for 'select' module.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
27 test `cat t-select-in.tmp` = "1" || exit 1
1ac304db6933 More tests for 'select' module.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
28
1ac304db6933 More tests for 'select' module.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
29 # Special files.
10921
bafc6771d75a Document a select() bug on Solaris 2.6.
Bruno Haible <bruno@clisp.org>
parents: 10787
diff changeset
30 # This part of the test is known to fail on Solaris 2.6 and older.
10771
1ac304db6933 More tests for 'select' module.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
31
10787
14671fbf0b74 Don't rely on the contents of stderr of shell commands.
Bruno Haible <bruno@clisp.org>
parents: 10771
diff changeset
32 rm -f t-select-in.tmp
14671fbf0b74 Don't rely on the contents of stderr of shell commands.
Bruno Haible <bruno@clisp.org>
parents: 10771
diff changeset
33 ./test-select-fd${EXEEXT} r 0 t-select-in.tmp < /dev/null
10771
1ac304db6933 More tests for 'select' module.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
34 test `cat t-select-in.tmp` = "1" || exit 1
1ac304db6933 More tests for 'select' module.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
35
1ac304db6933 More tests for 'select' module.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
36 rm -fr $tmpfiles
1ac304db6933 More tests for 'select' module.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
37
1ac304db6933 More tests for 'select' module.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
38 exit 0