Skip to content

Commit

Permalink
Simplify test.sh code significantly.
Browse files Browse the repository at this point in the history
Also make it easier to add new tests/backends.
  • Loading branch information
rosslagerwall committed Apr 7, 2012
1 parent d9a5515 commit 9b856fd
Showing 1 changed file with 19 additions and 61 deletions.
80 changes: 19 additions & 61 deletions test/test.sh
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
#!/bin/sh

BACKENDS="EVPORT KQUEUE EPOLL DEVPOLL POLL SELECT WIN32"
TESTS="test-eof test-weof test-time test-changelist test-fdleak"
FAILED=no

if test "x$TEST_OUTPUT_FILE" = "x"
then
TEST_OUTPUT_FILE=/dev/null
fi
TEST_OUTPUT_FILE=${TEST_OUTPUT_FILE:-/dev/null}

# /bin/echo is a little more likely to support -n than sh's builtin echo,
# printf is even more likely
Expand Down Expand Up @@ -40,14 +38,10 @@ then
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
for i in $BACKENDS; do
eval "EVENT_NO$i=yes; export EVENT_NO$i"
done
unset EVENT_EPOLL_USE_CHANGELIST
EVENT_NOEVPORT=yes; export EVENT_NOEVPORT
EVENT_NOWIN32=yes; export EVENT_NOWIN32
}

announce () {
Expand All @@ -69,47 +63,16 @@ run_tests () {
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
announce_n " test-fdleak: "
if $TEST_DIR/test-fdleak >>"$TEST_OUTPUT_FILE" ;
then
announce OKAY ;
else
announce FAILED ;
FAILED=yes
fi
for i in $TESTS; do
announce_n " $i: "
if $TEST_DIR/$i >>"$TEST_OUTPUT_FILE" ;
then
announce OKAY ;
else
announce FAILED ;
FAILED=yes
fi
done
announce_n " test-dumpevents: "
if python -c 'import sys; assert(sys.version_info >= (2, 4))' 2>/dev/null; then
if $TEST_DIR/test-dumpevents | python $TEST_SRC_DIR/check-dumpevents.py >> "$TEST_OUTPUT_FILE" ;
Expand Down Expand Up @@ -155,15 +118,10 @@ do_test() {

announce "Running tests:"

# Need to do this by hand?
do_test EVPORT
do_test KQUEUE
do_test EPOLL
for i in $BACKENDS; do
do_test $i
done
do_test EPOLL "(changelist)"
do_test DEVPOLL
do_test POLL
do_test SELECT
do_test WIN32

if test "$FAILED" = "yes"; then
exit 1
Expand Down

0 comments on commit 9b856fd

Please sign in to comment.