]> code.delx.au - pulseaudio/commitdiff
tests: modify rtpoll-test to use 'check' framework
authorDeng Zhengrong <dzrongg@gmail.com>
Sat, 28 Jul 2012 22:48:07 +0000 (06:48 +0800)
committerArun Raghavan <arun.raghavan@collabora.co.uk>
Mon, 20 Aug 2012 01:36:00 +0000 (07:06 +0530)
src/Makefile.am
src/tests/rtpoll-test.c

index be96fb3691d193d8cf4f1a06708a28c43b498c8d..d91c22623028f7f29b23991f109e9165703d06a6 100644 (file)
@@ -380,9 +380,9 @@ queue_test_LDADD = $(AM_LDADD) libpulsecore-@PA_MAJORMINOR@.la libpulse.la libpu
 queue_test_LDFLAGS = $(AM_LDFLAGS) $(BINLDFLAGS) $(LIBCHECK_LIBS)
 
 rtpoll_test_SOURCES = tests/rtpoll-test.c
-rtpoll_test_CFLAGS = $(AM_CFLAGS)
+rtpoll_test_CFLAGS = $(AM_CFLAGS) $(LIBCHECK_CFLAGS)
 rtpoll_test_LDADD = $(AM_LDADD) libpulsecore-@PA_MAJORMINOR@.la libpulse.la libpulsecommon-@PA_MAJORMINOR@.la
-rtpoll_test_LDFLAGS = $(AM_LDFLAGS) $(BINLDFLAGS)
+rtpoll_test_LDFLAGS = $(AM_LDFLAGS) $(BINLDFLAGS) $(LIBCHECK_LIBS)
 
 mcalign_test_SOURCES = tests/mcalign-test.c
 mcalign_test_CFLAGS = $(AM_CFLAGS)
index 6a6b73a83d98dabacbd6946fc19934f677f096e0..2ac34f0e5136533ef13c96d035cd1e135e681820 100644 (file)
@@ -21,6 +21,7 @@
 #include <config.h>
 #endif
 
+#include <check.h>
 #include <signal.h>
 
 #include <pulsecore/poll.h>
@@ -41,7 +42,7 @@ static int worker(pa_rtpoll_item *w) {
     return 0;
 }
 
-int main(int argc, char *argv[]) {
+START_TEST (rtpoll_test) {
     pa_rtpoll *p;
     pa_rtpoll_item *i, *w;
     struct pollfd *pollfd;
@@ -80,6 +81,28 @@ int main(int argc, char *argv[]) {
     pa_rtpoll_item_free(w);
 
     pa_rtpoll_free(p);
+}
+END_TEST
 
-    return 0;
+int main(int argc, char *argv[]) {
+    int failed = 0;
+    Suite *s;
+    TCase *tc;
+    SRunner *sr;
+
+    s = suite_create("RT Poll");
+    tc = tcase_create("rtpoll");
+    tcase_add_test(tc, rtpoll_test);
+    /* the default timeout is too small,
+     * set it to a reasonable large one.
+     */
+    tcase_set_timeout(tc, 60 * 60);
+    suite_add_tcase(s, tc);
+
+    sr = srunner_create(s);
+    srunner_run_all(sr, CK_NORMAL);
+    failed = srunner_ntests_failed(sr);
+    srunner_free(sr);
+
+    return (failed == 0) ? EXIT_SUCCESS : EXIT_FAILURE;
 }