diff --git a/src/Makefile.am b/src/Makefile.am index 303805572..7b0d057b1 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -350,9 +350,9 @@ memblock_test_LDADD = $(AM_LDADD) libpulsecore-@PA_MAJORMINOR@.la libpulse.la li memblock_test_LDFLAGS = $(AM_LDFLAGS) $(BINLDFLAGS) thread_test_SOURCES = tests/thread-test.c -thread_test_CFLAGS = $(AM_CFLAGS) +thread_test_CFLAGS = $(AM_CFLAGS) $(LIBCHECK_CFLAGS) thread_test_LDADD = $(AM_LDADD) libpulsecore-@PA_MAJORMINOR@.la libpulse.la libpulsecommon-@PA_MAJORMINOR@.la -thread_test_LDFLAGS = $(AM_LDFLAGS) $(BINLDFLAGS) +thread_test_LDFLAGS = $(AM_LDFLAGS) $(BINLDFLAGS) $(LIBCHECK_LIBS) once_test_SOURCES = tests/once-test.c once_test_CFLAGS = $(AM_CFLAGS) diff --git a/src/tests/thread-test.c b/src/tests/thread-test.c index 6441dc7e0..de4813c96 100644 --- a/src/tests/thread-test.c +++ b/src/tests/thread-test.c @@ -21,6 +21,8 @@ #include #endif +#include + #include #include #include @@ -91,7 +93,7 @@ quit: pa_log_info("thread_func() for %s done...", (char*) pa_tls_get(tls)); } -int main(int argc, char *argv[]) { +START_TEST (thread_test) { int i, k; pa_thread* t[THREADS_MAX]; @@ -104,7 +106,8 @@ int main(int argc, char *argv[]) { tls = pa_tls_new(pa_xfree); for (i = 0; i < THREADS_MAX; i++) { - pa_assert_se(t[i] = pa_thread_new("test", thread_func, pa_sprintf_malloc("Thread #%i", i+1))); + t[i] = pa_thread_new("test", thread_func, pa_sprintf_malloc("Thread #%i", i+1)); + fail_unless(t[i] != 0); } pa_mutex_lock(mutex); @@ -137,6 +140,24 @@ int main(int argc, char *argv[]) { pa_cond_free(cond1); pa_cond_free(cond2); pa_tls_free(tls); - - return 0; +} +END_TEST + +int main(int argc, char *argv[]) { + int failed = 0; + Suite *s; + TCase *tc; + SRunner *sr; + + s = suite_create("Thread"); + tc = tcase_create("thread"); + tcase_add_test(tc, thread_test); + 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; }