File: test-select-in.sh

package info (click to toggle)
gnulib 20140202%2Bstable-4
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 63,844 kB
  • sloc: ansic: 241,781; sh: 21,791; cpp: 1,551; yacc: 1,252; perl: 827; makefile: 324; lisp: 271; java: 5
file content (38 lines) | stat: -rwxr-xr-x 945 bytes parent folder | download | duplicates (47)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
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