more tests

svn:r81
This commit is contained in:
Niels Provos 2003-09-25 17:55:17 +00:00
parent c61a2547e2
commit ec70653b61
3 changed files with 108 additions and 32 deletions

View File

@ -4,8 +4,9 @@ LDADD = -L.. -levent
CPPFPLAGS = -I.. CPPFPLAGS = -I..
CFLAGS = -I../compat -Wall @CFLAGS@ 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_eof_sources = test-eof.c
test_weof_sources = test-weof.c test_weof_sources = test-weof.c
test_time_sources = test-time.c test_time_sources = test-time.c
@ -16,35 +17,7 @@ DISTCLEANFILES = *~
all: test all: test
test: test-eof test-weof test-time regress test: test-init test-eof test-weof test-time regress
@echo "Running tests:" @./test.sh
@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
bench test-eof test-weof test-time regress: ../libevent.a bench test-init test-eof test-weof test-time regress: ../libevent.a

27
test/test-init.c Normal file
View File

@ -0,0 +1,27 @@
/*
* Compile with:
* cc -I/usr/local/include -o time-test time-test.c -L/usr/local/lib -levent
*/
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/time.h>
#include <sys/socket.h>
#include <fcntl.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <errno.h>
#include <event.h>
int
main(int argc, char **argv)
{
/* Initalize the event library */
event_init();
return (0);
}

76
test/test.sh Executable file
View File

@ -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