mirror of
https://github.com/cuberite/libevent.git
synced 2025-09-11 13:24:43 -04:00
more tests
svn:r81
This commit is contained in:
parent
c61a2547e2
commit
ec70653b61
@ -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
|
||||
|
27
test/test-init.c
Normal file
27
test/test-init.c
Normal 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
76
test/test.sh
Executable 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
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user