Remove building with NOCRYPTO option
[minix.git] / external / bsd / libevent / dist / test / test.sh
blob08a4cddb7a977096ce16d75a39017b842fd8a572
1 #!/bin/sh
3 FAILED=no
5 if test "x$TEST_OUTPUT_FILE" = "x"
6 then
7 TEST_OUTPUT_FILE=/dev/null
8 fi
10 # /bin/echo is a little more likely to support -n than sh's builtin echo,
11 # printf is even more likely
12 if test "`printf %s hello 2>&1`" = "hello"
13 then
14 ECHO_N="printf %s"
15 else
16 if test -x /bin/echo
17 then
18 ECHO_N="/bin/echo -n"
19 else
20 ECHO_N="echo -n"
24 if test "$TEST_OUTPUT_FILE" != "/dev/null"
25 then
26 touch "$TEST_OUTPUT_FILE" || exit 1
29 TEST_DIR=.
31 T=`echo "$0" | sed -e 's/test.sh$//'`
32 if test -x "$T/test-init"
33 then
34 TEST_DIR="$T"
37 setup () {
38 EVENT_NOKQUEUE=yes; export EVENT_NOKQUEUE
39 EVENT_NODEVPOLL=yes; export EVENT_NODEVPOLL
40 EVENT_NOPOLL=yes; export EVENT_NOPOLL
41 EVENT_NOSELECT=yes; export EVENT_NOSELECT
42 EVENT_NOEPOLL=yes; export EVENT_NOEPOLL
43 unset EVENT_EPOLL_USE_CHANGELIST
44 EVENT_NOEVPORT=yes; export EVENT_NOEVPORT
45 EVENT_NOWIN32=yes; export EVENT_NOWIN32
48 announce () {
49 echo "$@"
50 echo "$@" >>"$TEST_OUTPUT_FILE"
53 announce_n () {
54 $ECHO_N "$@"
55 echo "$@" >>"$TEST_OUTPUT_FILE"
59 run_tests () {
60 if $TEST_DIR/test-init 2>>"$TEST_OUTPUT_FILE" ;
61 then
62 true
63 else
64 announce Skipping test
65 return
68 announce_n " test-eof: "
69 if $TEST_DIR/test-eof >>"$TEST_OUTPUT_FILE" ;
70 then
71 announce OKAY ;
72 else
73 announce FAILED ;
74 FAILED=yes
76 announce_n " test-weof: "
77 if $TEST_DIR/test-weof >>"$TEST_OUTPUT_FILE" ;
78 then
79 announce OKAY ;
80 else
81 announce FAILED ;
82 FAILED=yes
84 announce_n " test-time: "
85 if $TEST_DIR/test-time >>"$TEST_OUTPUT_FILE" ;
86 then
87 announce OKAY ;
88 else
89 announce FAILED ;
90 FAILED=yes
92 announce_n " test-changelist: "
93 if $TEST_DIR/test-changelist >>"$TEST_OUTPUT_FILE" ;
94 then
95 announce OKAY ;
96 else
97 announce FAILED ;
98 FAILED=yes
100 test -x $TEST_DIR/regress || return
101 announce_n " regress: "
102 if test "$TEST_OUTPUT_FILE" = "/dev/null" ;
103 then
104 $TEST_DIR/regress --quiet
105 else
106 $TEST_DIR/regress >>"$TEST_OUTPUT_FILE"
108 if test "$?" = "0" ;
109 then
110 announce OKAY ;
111 else
112 announce FAILED ;
113 FAILED=yes
117 announce "Running tests:"
119 # Need to do this by hand?
120 setup
121 unset EVENT_NOEVPORT
122 announce "EVPORT"
123 run_tests
125 setup
126 unset EVENT_NOKQUEUE
127 announce "KQUEUE"
128 run_tests
130 setup
131 unset EVENT_NOEPOLL
132 announce "EPOLL"
133 run_tests
135 setup
136 unset EVENT_NOEPOLL
137 EVENT_EPOLL_USE_CHANGELIST=yes; export EVENT_EPOLL_USE_CHANGELIST
138 announce "EPOLL (changelist)"
139 run_tests
141 setup
142 unset EVENT_NODEVPOLL
143 announce "DEVPOLL"
144 run_tests
146 setup
147 unset EVENT_NOPOLL
148 announce "POLL"
149 run_tests
151 setup
152 unset EVENT_NOSELECT
153 announce "SELECT"
154 run_tests
156 setup
157 unset EVENT_NOWIN32
158 announce "WIN32"
159 run_tests
161 if test "$FAILED" = "yes"; then
162 exit 1