blob: 08a4cddb7a977096ce16d75a39017b842fd8a572 (
plain)
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
|
#!/bin/sh
FAILED=no
if test "x$TEST_OUTPUT_FILE" = "x"
then
TEST_OUTPUT_FILE=/dev/null
fi
# /bin/echo is a little more likely to support -n than sh's builtin echo,
# printf is even more likely
if test "`printf %s hello 2>&1`" = "hello"
then
ECHO_N="printf %s"
else
if test -x /bin/echo
then
ECHO_N="/bin/echo -n"
else
ECHO_N="echo -n"
fi
fi
if test "$TEST_OUTPUT_FILE" != "/dev/null"
then
touch "$TEST_OUTPUT_FILE" || exit 1
fi
TEST_DIR=.
T=`echo "$0" | sed -e 's/test.sh$//'`
if test -x "$T/test-init"
then
TEST_DIR="$T"
fi
setup () {
EVENT_NOKQUEUE=yes; export EVENT_NOKQUEUE
EVENT_NODEVPOLL=yes; export EVENT_NODEVPOLL
EVENT_NOPOLL=yes; export EVENT_NOPOLL
EVENT_NOSELECT=yes; export EVENT_NOSELECT
EVENT_NOEPOLL=yes; export EVENT_NOEPOLL
unset EVENT_EPOLL_USE_CHANGELIST
EVENT_NOEVPORT=yes; export EVENT_NOEVPORT
EVENT_NOWIN32=yes; export EVENT_NOWIN32
}
announce () {
echo "$@"
echo "$@" >>"$TEST_OUTPUT_FILE"
}
announce_n () {
$ECHO_N "$@"
echo "$@" >>"$TEST_OUTPUT_FILE"
}
run_tests () {
if $TEST_DIR/test-init 2>>"$TEST_OUTPUT_FILE" ;
then
true
else
announce Skipping test
return
fi
announce_n " test-eof: "
if $TEST_DIR/test-eof >>"$TEST_OUTPUT_FILE" ;
then
announce OKAY ;
else
announce FAILED ;
FAILED=yes
fi
announce_n " test-weof: "
if $TEST_DIR/test-weof >>"$TEST_OUTPUT_FILE" ;
then
announce OKAY ;
else
announce FAILED ;
FAILED=yes
fi
announce_n " test-time: "
if $TEST_DIR/test-time >>"$TEST_OUTPUT_FILE" ;
then
announce OKAY ;
else
announce FAILED ;
FAILED=yes
fi
announce_n " test-changelist: "
if $TEST_DIR/test-changelist >>"$TEST_OUTPUT_FILE" ;
then
announce OKAY ;
else
announce FAILED ;
FAILED=yes
fi
test -x $TEST_DIR/regress || return
announce_n " regress: "
if test "$TEST_OUTPUT_FILE" = "/dev/null" ;
then
$TEST_DIR/regress --quiet
else
$TEST_DIR/regress >>"$TEST_OUTPUT_FILE"
fi
if test "$?" = "0" ;
then
announce OKAY ;
else
announce FAILED ;
FAILED=yes
fi
}
announce "Running tests:"
# Need to do this by hand?
setup
unset EVENT_NOEVPORT
announce "EVPORT"
run_tests
setup
unset EVENT_NOKQUEUE
announce "KQUEUE"
run_tests
setup
unset EVENT_NOEPOLL
announce "EPOLL"
run_tests
setup
unset EVENT_NOEPOLL
EVENT_EPOLL_USE_CHANGELIST=yes; export EVENT_EPOLL_USE_CHANGELIST
announce "EPOLL (changelist)"
run_tests
setup
unset EVENT_NODEVPOLL
announce "DEVPOLL"
run_tests
setup
unset EVENT_NOPOLL
announce "POLL"
run_tests
setup
unset EVENT_NOSELECT
announce "SELECT"
run_tests
setup
unset EVENT_NOWIN32
announce "WIN32"
run_tests
if test "$FAILED" = "yes"; then
exit 1
fi
|