2003-09-25 17:55:17 +00:00
|
|
|
#!/bin/sh
|
2003-10-05 22:02:49 +00:00
|
|
|
|
2010-05-26 13:31:41 -04:00
|
|
|
FAILED=no
|
|
|
|
|
2009-12-29 18:07:51 -05:00
|
|
|
if test "x$TEST_OUTPUT_FILE" = "x"
|
|
|
|
then
|
2009-12-29 18:11:52 -05:00
|
|
|
TEST_OUTPUT_FILE=/dev/null
|
2009-12-29 17:59:55 -05:00
|
|
|
fi
|
|
|
|
|
2011-02-01 01:15:48 -05:00
|
|
|
# /bin/echo is a little more likely to support -n than sh's builtin echo,
|
|
|
|
# printf is even more likely
|
2011-02-22 00:31:56 -05:00
|
|
|
if test "`printf %s hello 2>&1`" = "hello"
|
2010-01-12 15:58:36 -05:00
|
|
|
then
|
2011-02-22 00:31:56 -05:00
|
|
|
ECHO_N="printf %s"
|
2010-01-12 15:58:36 -05:00
|
|
|
else
|
2011-02-01 01:15:48 -05:00
|
|
|
if test -x /bin/echo
|
|
|
|
then
|
|
|
|
ECHO_N="/bin/echo -n"
|
|
|
|
else
|
|
|
|
ECHO_N="echo -n"
|
|
|
|
fi
|
2010-01-12 15:58:36 -05:00
|
|
|
fi
|
|
|
|
|
2010-05-08 18:00:26 -04:00
|
|
|
if test "$TEST_OUTPUT_FILE" != "/dev/null"
|
|
|
|
then
|
|
|
|
touch "$TEST_OUTPUT_FILE" || exit 1
|
|
|
|
fi
|
2009-12-29 18:07:51 -05:00
|
|
|
|
|
|
|
TEST_DIR=.
|
|
|
|
|
|
|
|
T=`echo "$0" | sed -e 's/test.sh$//'`
|
|
|
|
if test -x "$T/test-init"
|
|
|
|
then
|
2009-12-29 18:11:52 -05:00
|
|
|
TEST_DIR="$T"
|
2009-12-29 18:07:51 -05:00
|
|
|
fi
|
2009-12-29 17:59:55 -05:00
|
|
|
|
2003-10-05 22:02:49 +00:00
|
|
|
setup () {
|
2009-12-29 18:11:52 -05:00
|
|
|
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
|
2010-11-22 14:10:01 -05:00
|
|
|
unset EVENT_EPOLL_USE_CHANGELIST
|
2009-12-29 18:11:52 -05:00
|
|
|
EVENT_NOEVPORT=yes; export EVENT_NOEVPORT
|
2010-05-08 18:00:26 -04:00
|
|
|
EVENT_NOWIN32=yes; export EVENT_NOWIN32
|
2003-09-25 17:55:17 +00:00
|
|
|
}
|
|
|
|
|
2009-12-29 17:59:55 -05:00
|
|
|
announce () {
|
2010-11-22 14:10:01 -05:00
|
|
|
echo "$@"
|
|
|
|
echo "$@" >>"$TEST_OUTPUT_FILE"
|
2009-12-29 17:59:55 -05:00
|
|
|
}
|
|
|
|
|
2010-01-12 15:58:36 -05:00
|
|
|
announce_n () {
|
2011-02-01 01:15:48 -05:00
|
|
|
$ECHO_N "$@"
|
2010-11-22 14:10:01 -05:00
|
|
|
echo "$@" >>"$TEST_OUTPUT_FILE"
|
2010-01-12 15:58:36 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-12-29 18:07:51 -05:00
|
|
|
run_tests () {
|
|
|
|
if $TEST_DIR/test-init 2>>"$TEST_OUTPUT_FILE" ;
|
2003-09-25 17:55:17 +00:00
|
|
|
then
|
2009-12-29 18:11:52 -05:00
|
|
|
true
|
2005-09-02 05:34:01 +00:00
|
|
|
else
|
2009-12-29 17:59:55 -05:00
|
|
|
announce Skipping test
|
2003-09-25 17:55:17 +00:00
|
|
|
return
|
2009-12-29 18:11:52 -05:00
|
|
|
fi
|
2003-09-25 17:55:17 +00:00
|
|
|
|
2010-01-12 15:58:36 -05:00
|
|
|
announce_n " test-eof: "
|
2009-12-29 18:11:52 -05:00
|
|
|
if $TEST_DIR/test-eof >>"$TEST_OUTPUT_FILE" ;
|
|
|
|
then
|
|
|
|
announce OKAY ;
|
|
|
|
else
|
|
|
|
announce FAILED ;
|
2010-05-26 13:31:41 -04:00
|
|
|
FAILED=yes
|
2009-12-29 18:11:52 -05:00
|
|
|
fi
|
2010-01-12 15:58:36 -05:00
|
|
|
announce_n " test-weof: "
|
2009-12-29 18:11:52 -05:00
|
|
|
if $TEST_DIR/test-weof >>"$TEST_OUTPUT_FILE" ;
|
|
|
|
then
|
|
|
|
announce OKAY ;
|
|
|
|
else
|
|
|
|
announce FAILED ;
|
2010-05-26 13:31:41 -04:00
|
|
|
FAILED=yes
|
2009-12-29 18:11:52 -05:00
|
|
|
fi
|
2010-01-12 15:58:36 -05:00
|
|
|
announce_n " test-time: "
|
2009-12-29 18:11:52 -05:00
|
|
|
if $TEST_DIR/test-time >>"$TEST_OUTPUT_FILE" ;
|
|
|
|
then
|
|
|
|
announce OKAY ;
|
|
|
|
else
|
|
|
|
announce FAILED ;
|
2010-05-26 13:31:41 -04:00
|
|
|
FAILED=yes
|
2009-12-29 18:11:52 -05:00
|
|
|
fi
|
2010-07-19 15:14:10 +02:00
|
|
|
announce_n " test-changelist: "
|
|
|
|
if $TEST_DIR/test-changelist >>"$TEST_OUTPUT_FILE" ;
|
|
|
|
then
|
|
|
|
announce OKAY ;
|
|
|
|
else
|
|
|
|
announce FAILED ;
|
|
|
|
FAILED=yes
|
|
|
|
fi
|
2012-02-23 21:40:02 +02:00
|
|
|
announce_n " test-fdleak: "
|
|
|
|
if $TEST_DIR/test-fdleak >>"$TEST_OUTPUT_FILE" ;
|
|
|
|
then
|
|
|
|
announce OKAY ;
|
|
|
|
else
|
|
|
|
announce FAILED ;
|
|
|
|
FAILED=yes
|
|
|
|
fi
|
2012-03-23 17:56:23 -04:00
|
|
|
announce_n " test-dumpevents: "
|
2012-03-26 20:12:45 +02:00
|
|
|
if python -c 'import sys; assert(sys.version_info >= (2, 4))' 2>/dev/null; then
|
2012-03-23 17:56:23 -04:00
|
|
|
if $TEST_DIR/test-dumpevents | python $TEST_DIR/check-dumpevents.py >> "$TEST_OUTPUT_FILE" ;
|
|
|
|
then
|
|
|
|
announce OKAY ;
|
|
|
|
else
|
|
|
|
announce FAILED ;
|
|
|
|
fi
|
|
|
|
else
|
|
|
|
# no python
|
|
|
|
if $TEST_DIR/test-dumpevents >/dev/null; then
|
|
|
|
announce "OKAY (output not checked)" ;
|
|
|
|
else
|
|
|
|
announce "FAILED (output not checked)" ;
|
|
|
|
fi
|
|
|
|
fi
|
2011-02-13 02:05:04 -05:00
|
|
|
test -x $TEST_DIR/regress || return
|
2010-01-12 15:58:36 -05:00
|
|
|
announce_n " regress: "
|
2010-05-26 13:32:32 -04:00
|
|
|
if test "$TEST_OUTPUT_FILE" = "/dev/null" ;
|
|
|
|
then
|
|
|
|
$TEST_DIR/regress --quiet
|
|
|
|
else
|
|
|
|
$TEST_DIR/regress >>"$TEST_OUTPUT_FILE"
|
|
|
|
fi
|
|
|
|
if test "$?" = "0" ;
|
2009-12-29 18:11:52 -05:00
|
|
|
then
|
|
|
|
announce OKAY ;
|
|
|
|
else
|
|
|
|
announce FAILED ;
|
2010-05-26 13:31:41 -04:00
|
|
|
FAILED=yes
|
2009-12-29 18:11:52 -05:00
|
|
|
fi
|
2003-09-25 17:55:17 +00:00
|
|
|
}
|
|
|
|
|
2011-07-05 14:41:46 -04:00
|
|
|
do_test() {
|
|
|
|
setup
|
|
|
|
announce "$1 $2"
|
|
|
|
unset EVENT_NO$1
|
|
|
|
if test "$2" = "(changelist)" ; then
|
|
|
|
EVENT_EPOLL_USE_CHANGELIST=yes; export EVENT_EPOLL_USE_CHANGELIST
|
|
|
|
fi
|
|
|
|
run_tests
|
|
|
|
}
|
|
|
|
|
2009-12-29 18:11:52 -05:00
|
|
|
announce "Running tests:"
|
2003-09-25 17:55:17 +00:00
|
|
|
|
|
|
|
# Need to do this by hand?
|
2011-07-05 14:41:46 -04:00
|
|
|
do_test EVPORT
|
|
|
|
do_test KQUEUE
|
|
|
|
do_test EPOLL
|
|
|
|
do_test EPOLL "(changelist)"
|
|
|
|
do_test DEVPOLL
|
|
|
|
do_test POLL
|
|
|
|
do_test SELECT
|
|
|
|
do_test WIN32
|
2010-05-26 13:31:41 -04:00
|
|
|
|
|
|
|
if test "$FAILED" = "yes"; then
|
|
|
|
exit 1
|
|
|
|
fi
|