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
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
--- /dev/null
+/*
+ * 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);
+}
+
--- /dev/null
+#!/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
+
+
+