]> granicus.if.org Git - libevent/commitdiff
more tests
authorNiels Provos <provos@gmail.com>
Thu, 25 Sep 2003 17:55:17 +0000 (17:55 +0000)
committerNiels Provos <provos@gmail.com>
Thu, 25 Sep 2003 17:55:17 +0000 (17:55 +0000)
svn:r81

test/Makefile.am
test/test-init.c [new file with mode: 0644]
test/test.sh [new file with mode: 0755]

index 0d9ea53e41220b38fd30e77c8b2fb14a11a323c2..f763af59be12177d926e6e42960a336ab9a1c354 100644 (file)
@@ -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 (file)
index 0000000..32806ba
--- /dev/null
@@ -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);
+}
+
diff --git a/test/test.sh b/test/test.sh
new file mode 100755 (executable)
index 0000000..a79d0cc
--- /dev/null
@@ -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
+
+
+