From: Niels Provos Date: Thu, 25 Sep 2003 17:55:17 +0000 (+0000) Subject: more tests X-Git-Tag: release-1.1b~88 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=ec70653b61cdf20f4640a9e3d445a2f77c63e738;p=libevent more tests svn:r81 --- diff --git a/test/Makefile.am b/test/Makefile.am index 0d9ea53e..f763af59 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -4,8 +4,9 @@ LDADD = -L.. -levent CPPFPLAGS = -I.. CFLAGS = -I../compat -Wall @CFLAGS@ -noinst_PROGRAMS = test-eof test-weof test-time regress bench +noinst_PROGRAMS = test-init test-eof test-weof test-time regress bench +test_init_sources = test-init.c test_eof_sources = test-eof.c test_weof_sources = test-weof.c test_time_sources = test-time.c @@ -16,35 +17,7 @@ DISTCLEANFILES = *~ all: test -test: test-eof test-weof test-time regress - @echo "Running tests:" - @echo -n " test-eof: " - @if ./test-eof >/dev/null ; \ - then \ - echo OKAY ; \ - else \ - echo FAILED ; \ - fi - @echo -n " test-weof: " - @if ./test-weof >/dev/null ; \ - then \ - echo OKAY ; \ - else \ - echo FAILED ; \ - fi - @echo -n " test-time: " - @if ./test-time >/dev/null ; \ - then \ - echo OKAY ; \ - else \ - echo FAILED ; \ - fi - @echo -n " regress: " - @if ./regress >/dev/null ; \ - then \ - echo OKAY ; \ - else \ - echo FAILED ; \ - fi +test: test-init test-eof test-weof test-time regress + @./test.sh -bench test-eof test-weof test-time regress: ../libevent.a +bench test-init test-eof test-weof test-time regress: ../libevent.a diff --git a/test/test-init.c b/test/test-init.c new file mode 100644 index 00000000..32806baa --- /dev/null +++ b/test/test-init.c @@ -0,0 +1,27 @@ +/* + * Compile with: + * cc -I/usr/local/include -o time-test time-test.c -L/usr/local/lib -levent + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +int +main(int argc, char **argv) +{ + /* Initalize the event library */ + event_init(); + + return (0); +} + diff --git a/test/test.sh b/test/test.sh new file mode 100755 index 00000000..a79d0cc9 --- /dev/null +++ b/test/test.sh @@ -0,0 +1,76 @@ +#!/bin/sh +function setup { + export EVENT_NOKQUEUE=yes + export EVENT_NOPOLL=yes + export EVENT_NOSELECT=yes + export EVENT_NOEPOLL=yes + export EVENT_NORTSIG=yes +} + +function test { + if ! ./test-init 2>/dev/null ; + then + echo Skipping test + return + fi + +echo -n " test-eof: " +if ./test-eof >/dev/null ; +then + echo OKAY ; +else + echo FAILED ; +fi +echo -n " test-weof: " +if ./test-weof >/dev/null ; +then + echo OKAY ; +else + echo FAILED ; +fi +echo -n " test-time: " +if ./test-time >/dev/null ; +then + echo OKAY ; +else + echo FAILED ; +fi +echo -n " regress: " +if ./regress >/dev/null ; +then + echo OKAY ; +else + echo FAILED ; +fi +} + +echo "Running tests:" + +# Need to do this by hand? +setup +unset EVENT_NOKQUEUE +echo "KQUEUE" +test + +setup +unset EVENT_NOPOLL +echo "POLL" +test + +setup +unset EVENT_NOSELECT +echo "SELECT" +test + +setup +unset EVENT_NORTSIG +echo "RTSIG" +test + +setup +unset EVENT_NOEPOLL +echo "EPOLL" +test + + +