[pulseaudio-commits] 28 commits - src/Makefile.am src/tests

Arun Raghavan arun at kemper.freedesktop.org
Sun Aug 19 18:59:38 PDT 2012


 src/Makefile.am                  |  112 ++++++++++++++++++-------------------
 src/tests/alsa-time-test.c       |  118 +++++++++++++++++++++++----------------
 src/tests/asyncmsgq-test.c       |   30 ++++++++-
 src/tests/asyncq-test.c          |   35 +++++++++--
 src/tests/channelmap-test.c      |   27 +++++++-
 src/tests/connect-stress.c       |   54 ++++++++++++-----
 src/tests/cpulimit-test.c        |   28 ++++++++-
 src/tests/extended-test.c        |   47 +++++++++++----
 src/tests/format-test.c          |   80 ++++++++++++++++----------
 src/tests/get-binary-name-test.c |   28 +++++++--
 src/tests/hook-list-test.c       |   28 ++++++++-
 src/tests/interpol-test.c        |   69 +++++++++++++++-------
 src/tests/ipacl-test.c           |   45 ++++++++++----
 src/tests/lock-autospawn-test.c  |   40 ++++++++++---
 src/tests/memblock-test.c        |   57 ++++++++++++------
 src/tests/memblockq-test.c       |  113 +++++++++++++++++++++++++++----------
 src/tests/once-test.c            |   44 +++++++++++---
 src/tests/proplist-test.c        |   52 ++++++++++++-----
 src/tests/queue-test.c           |   33 ++++++++--
 src/tests/rtpoll-test.c          |   27 ++++++++
 src/tests/sig2str-test.c         |   98 +++++++++++++++++++++++++++++++-
 src/tests/sigbus-test.c          |   34 ++++++++---
 src/tests/smoother-test.c        |   24 +++++++
 src/tests/sync-playback.c        |   48 ++++++++++++---
 src/tests/test-daemon.sh         |    3 
 src/tests/thread-mainloop-test.c |   39 ++++++++++--
 src/tests/thread-test.c          |   27 +++++++-
 src/tests/usergroup-test.c       |   41 ++++++++-----
 src/tests/volume-test.c          |   32 ++++++++--
 29 files changed, 1057 insertions(+), 356 deletions(-)

New commits:
commit 8e0f50c176765d232e81a5af765a654c8ad4ea49
Author: Deng Zhengrong <dzrongg at gmail.com>
Date:   Fri Aug 17 13:51:23 2012 +0800

    tests: fix the wrong library path in check-daemon

diff --git a/src/tests/test-daemon.sh b/src/tests/test-daemon.sh
index 3347b42..264e169 100755
--- a/src/tests/test-daemon.sh
+++ b/src/tests/test-daemon.sh
@@ -3,7 +3,7 @@
 # This script is modified from dbus's run-with-temp-session-bus.sh.
 #
 
-SCRIPTNAME=$0
+SCRIPTNAME="$0"
 
 die()
 {
@@ -44,6 +44,7 @@ pulseaudio -n \
         --load="module-suspend-on-idle" \
         --load="module-native-protocol-unix" \
         --load="module-cli-protocol-unix" \
+        --dl-search-path="$(dirname $SCRIPTNAME)/.libs/" \
         &
 
 # wait a few seconds to let the daemon start!

commit 70acd7bf66693db9f0ea21237943bfb51afc80e0
Author: Deng Zhengrong <dzrongg at gmail.com>
Date:   Sun Jul 29 16:34:17 2012 +0800

    tests: modify ipacl-test to use 'check' framework

diff --git a/src/Makefile.am b/src/Makefile.am
index 14f703b..d3d5778 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -335,9 +335,9 @@ get_binary_name_test_LDADD = $(AM_LDADD) libpulse.la libpulsecommon- at PA_MAJORMIN
 get_binary_name_test_LDFLAGS = $(AM_LDFLAGS) $(BINLDFLAGS) $(LIBCHECK_LIBS)
 
 ipacl_test_SOURCES = tests/ipacl-test.c
-ipacl_test_CFLAGS = $(AM_CFLAGS)
+ipacl_test_CFLAGS = $(AM_CFLAGS) $(LIBCHECK_CFLAGS)
 ipacl_test_LDADD = $(AM_LDADD) libpulsecore- at PA_MAJORMINOR@.la libpulse.la libpulsecommon- at PA_MAJORMINOR@.la
-ipacl_test_LDFLAGS = $(AM_LDFLAGS) $(BINLDFLAGS)
+ipacl_test_LDFLAGS = $(AM_LDFLAGS) $(BINLDFLAGS) $(LIBCHECK_LIBS)
 
 hook_list_test_SOURCES = tests/hook-list-test.c
 hook_list_test_CFLAGS = $(AM_CFLAGS) $(LIBCHECK_CFLAGS)
diff --git a/src/tests/ipacl-test.c b/src/tests/ipacl-test.c
index fa190cf..4ce3490 100644
--- a/src/tests/ipacl-test.c
+++ b/src/tests/ipacl-test.c
@@ -7,6 +7,8 @@
 #include <unistd.h>
 #include <string.h>
 
+#include <check.h>
+
 #ifdef HAVE_NETINET_IN_H
 #include <netinet/in.h>
 #endif
@@ -27,15 +29,16 @@ static void do_ip_acl_check(const char *s, int fd, int expected) {
     pa_ip_acl *acl;
     int result;
 
-    pa_assert_se(acl = pa_ip_acl_new(s));
+    acl = pa_ip_acl_new(s);
+    fail_unless(acl != NULL);
     result = pa_ip_acl_check(acl, fd);
     pa_ip_acl_free(acl);
 
     pa_log_info("%-20s result=%u (should be %u)", s, result, expected);
-    pa_assert(result == expected);
+    fail_unless(result == expected);
 }
 
-int main(int argc, char *argv[]) {
+START_TEST (ipacl_test) {
     struct sockaddr_in sa;
 #ifdef HAVE_IPV6
     struct sockaddr_in6 sa6;
@@ -43,18 +46,15 @@ int main(int argc, char *argv[]) {
     int fd;
     int r;
 
-    if (!getenv("MAKE_CHECK"))
-        pa_log_set_level(PA_LOG_DEBUG);
-
     fd = socket(PF_INET, SOCK_STREAM, 0);
-    pa_assert(fd >= 0);
+    fail_unless(fd >= 0);
 
     sa.sin_family = AF_INET;
     sa.sin_port = htons(22);
     sa.sin_addr.s_addr = inet_addr("127.0.0.1");
 
     r = connect(fd, (struct sockaddr*) &sa, sizeof(sa));
-    pa_assert(r >= 0);
+    fail_unless(r >= 0);
 
     do_ip_acl_check("127.0.0.1", fd, 1);
     do_ip_acl_check("127.0.0.2/0", fd, 1);
@@ -70,16 +70,16 @@ int main(int argc, char *argv[]) {
 #ifdef HAVE_IPV6
     if ( (fd = socket(PF_INET6, SOCK_STREAM, 0)) < 0 ) {
       pa_log_error("Unable to open IPv6 socket, IPv6 tests ignored");
-      return 0;
+      return;
     }
 
     memset(&sa6, 0, sizeof(sa6));
     sa6.sin6_family = AF_INET6;
     sa6.sin6_port = htons(22);
-    pa_assert_se(inet_pton(AF_INET6, "::1", &sa6.sin6_addr) == 1);
+    fail_unless(inet_pton(AF_INET6, "::1", &sa6.sin6_addr) == 1);
 
     r = connect(fd, (struct sockaddr*) &sa6, sizeof(sa6));
-    pa_assert(r >= 0);
+    fail_unless(r >= 0);
 
     do_ip_acl_check("::1", fd, 1);
     do_ip_acl_check("::1/9", fd, 1);
@@ -90,6 +90,27 @@ int main(int argc, char *argv[]) {
 
     close(fd);
 #endif
+}
+END_TEST
+
+int main(int argc, char *argv[]) {
+    int failed = 0;
+    Suite *s;
+    TCase *tc;
+    SRunner *sr;
+
+    if (!getenv("MAKE_CHECK"))
+        pa_log_set_level(PA_LOG_DEBUG);
+
+    s = suite_create("IP ACL");
+    tc = tcase_create("ipacl");
+    tcase_add_test(tc, ipacl_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 0;
+    return (failed == 0) ? EXIT_SUCCESS : EXIT_FAILURE;
 }

commit deeb0f05b372fba103cf0b5b268e024b9c86daa1
Author: Deng Zhengrong <dzrongg at gmail.com>
Date:   Sun Jul 29 07:00:24 2012 +0800

    tests: modify once-test to use 'check' framework

diff --git a/src/Makefile.am b/src/Makefile.am
index 56e71f5..14f703b 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -355,9 +355,9 @@ thread_test_LDADD = $(AM_LDADD) libpulsecore- at PA_MAJORMINOR@.la libpulse.la libp
 thread_test_LDFLAGS = $(AM_LDFLAGS) $(BINLDFLAGS) $(LIBCHECK_LIBS)
 
 once_test_SOURCES = tests/once-test.c
-once_test_CFLAGS = $(AM_CFLAGS)
+once_test_CFLAGS = $(AM_CFLAGS) $(LIBCHECK_CFLAGS)
 once_test_LDADD = $(AM_LDADD) libpulsecore- at PA_MAJORMINOR@.la libpulse.la libpulsecommon- at PA_MAJORMINOR@.la
-once_test_LDFLAGS = $(AM_LDFLAGS) $(BINLDFLAGS)
+once_test_LDFLAGS = $(AM_LDFLAGS) $(BINLDFLAGS) $(LIBCHECK_LIBS)
 
 flist_test_SOURCES = tests/flist-test.c
 flist_test_CFLAGS = $(AM_CFLAGS)
diff --git a/src/tests/once-test.c b/src/tests/once-test.c
index b1ef6ba..b39a0e3 100644
--- a/src/tests/once-test.c
+++ b/src/tests/once-test.c
@@ -25,6 +25,8 @@
 #include <pthread.h>
 #endif
 
+#include <check.h>
+
 #include <pulsecore/thread.h>
 #include <pulsecore/once.h>
 #include <pulsecore/log.h>
@@ -58,31 +60,28 @@ static void thread_func(void *data) {
 
     CPU_ZERO(&mask);
     CPU_SET((size_t) (pa_atomic_inc(&i_cpu) % n_cpu), &mask);
-    pa_assert_se(pthread_setaffinity_np(pthread_self(), sizeof(mask), &mask) == 0);
+    fail_unless(pthread_setaffinity_np(pthread_self(), sizeof(mask), &mask) == 0);
 #endif
 
     pa_log_debug("started up: %s", (char *) data);
 
     r = pthread_barrier_wait(&barrier);
-    pa_assert(r == 0 || r == PTHREAD_BARRIER_SERIAL_THREAD);
+    fail_unless(r == 0 || r == PTHREAD_BARRIER_SERIAL_THREAD);
 #endif /* HAVE_PTHREAD */
 
     pa_run_once(&once, once_func);
 }
 
-int main(int argc, char *argv[]) {
+START_TEST (once_test) {
     unsigned n, i;
 
-    if (!getenv("MAKE_CHECK"))
-        pa_log_set_level(PA_LOG_DEBUG);
-
     n_cpu = pa_ncpus();
 
     for (n = 0; n < N_ITERATIONS; n++) {
         pa_thread* threads[N_THREADS];
 
 #ifdef HAVE_PTHREAD
-        pa_assert_se(pthread_barrier_init(&barrier, NULL, N_THREADS) == 0);
+        fail_unless(pthread_barrier_init(&barrier, NULL, N_THREADS) == 0);
 #endif
 
         /* Yes, kinda ugly */
@@ -94,7 +93,7 @@ int main(int argc, char *argv[]) {
         for (i = 0; i < N_THREADS; i++)
             pa_thread_join(threads[i]);
 
-        pa_assert(n_run == 1);
+        fail_unless(n_run == 1);
         pa_log_info("ran by %s", ran_by);
 
         for (i = 0; i < N_THREADS; i++) {
@@ -106,9 +105,34 @@ int main(int argc, char *argv[]) {
         ran_by = NULL;
 
 #ifdef HAVE_PTHREAD
-        pa_assert_se(pthread_barrier_destroy(&barrier) == 0);
+        fail_unless(pthread_barrier_destroy(&barrier) == 0);
 #endif
     }
+}
+END_TEST
+
+int main(int argc, char *argv[]) {
+    int failed = 0;
+    Suite *s;
+    TCase *tc;
+    SRunner *sr;
+
+    if (!getenv("MAKE_CHECK"))
+        pa_log_set_level(PA_LOG_DEBUG);
 
-    return 0;
+    s = suite_create("Once");
+    tc = tcase_create("once");
+    tcase_add_test(tc, once_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;
 }

commit b095ebd502d614221dd4928478de62bc6473b1e0
Author: Deng Zhengrong <dzrongg at gmail.com>
Date:   Sun Jul 29 06:58:30 2012 +0800

    tests: modify lock-autospawn-test to use 'check' framework

diff --git a/src/Makefile.am b/src/Makefile.am
index d91c226..56e71f5 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -501,8 +501,8 @@ stripnul_LDFLAGS = $(AM_LDFLAGS) $(BINLDFLAGS)
 
 lock_autospawn_test_SOURCES = tests/lock-autospawn-test.c
 lock_autospawn_test_LDADD = $(AM_LDADD) libpulsecore- at PA_MAJORMINOR@.la libpulse.la libpulsecommon- at PA_MAJORMINOR@.la
-lock_autospawn_test_CFLAGS = $(AM_CFLAGS)
-lock_autospawn_test_LDFLAGS = $(AM_LDFLAGS) $(BINLDFLAGS)
+lock_autospawn_test_CFLAGS = $(AM_CFLAGS) $(LIBCHECK_CFLAGS)
+lock_autospawn_test_LDFLAGS = $(AM_LDFLAGS) $(BINLDFLAGS) $(LIBCHECK_LIBS)
 
 sigbus_test_SOURCES = tests/sigbus-test.c
 sigbus_test_LDADD = $(AM_LDADD) libpulsecore- at PA_MAJORMINOR@.la libpulse.la libpulsecommon- at PA_MAJORMINOR@.la
diff --git a/src/tests/lock-autospawn-test.c b/src/tests/lock-autospawn-test.c
index e2db24c..1aa3bca 100644
--- a/src/tests/lock-autospawn-test.c
+++ b/src/tests/lock-autospawn-test.c
@@ -23,6 +23,8 @@
 #include <config.h>
 #endif
 
+#include <check.h>
+
 #include <string.h>
 
 #include <pulsecore/poll.h>
@@ -32,11 +34,11 @@
 #include <pulse/util.h>
 
 static void thread_func(void*k) {
-    pa_assert_se(pa_autospawn_lock_init() >= 0);
+    fail_unless(pa_autospawn_lock_init() >= 0);
 
     pa_log("%i, Trying to acquire lock.", PA_PTR_TO_INT(k));
 
-    pa_assert_se(pa_autospawn_lock_acquire(TRUE) > 0);
+    fail_unless(pa_autospawn_lock_acquire(TRUE) > 0);
 
     pa_log("%i, Got the lock!, Sleeping for 5s", PA_PTR_TO_INT(k));
 
@@ -52,7 +54,7 @@ static void thread_func(void*k) {
 static void thread_func2(void *k) {
     int fd;
 
-    pa_assert_se((fd = pa_autospawn_lock_init()) >= 0);
+    fail_unless((fd = pa_autospawn_lock_init()) >= 0);
 
     pa_log("%i, Trying to acquire lock.", PA_PTR_TO_INT(k));
 
@@ -63,13 +65,13 @@ static void thread_func2(void *k) {
         if ((j = pa_autospawn_lock_acquire(FALSE)) > 0)
             break;
 
-        pa_assert(j == 0);
+        fail_unless(j == 0);
 
         memset(&pollfd, 0, sizeof(pollfd));
         pollfd.fd = fd;
         pollfd.events = POLLIN;
 
-        pa_assert_se(pa_poll(&pollfd, 1, -1) == 1);
+        fail_unless(pa_poll(&pollfd, 1, -1) == 1);
 
         pa_log("%i, woke up", PA_PTR_TO_INT(k));
     }
@@ -85,7 +87,7 @@ static void thread_func2(void *k) {
     pa_autospawn_lock_done(FALSE);
 }
 
-int main(int argc, char**argv) {
+START_TEST (lockautospawn_test) {
     pa_thread *a, *b, *c, *d;
 
     pa_assert_se((a = pa_thread_new("test1", thread_func, PA_INT_TO_PTR(1))));
@@ -102,6 +104,28 @@ int main(int argc, char**argv) {
     pa_thread_free(b);
     pa_thread_free(c);
     pa_thread_free(d);
-
-    return 0;
+}
+END_TEST
+
+int main(int argc, char *argv[]) {
+    int failed = 0;
+    Suite *s;
+    TCase *tc;
+    SRunner *sr;
+
+    s = suite_create("Lock Auto Spawn");
+    tc = tcase_create("lockautospawn");
+    tcase_add_test(tc, lockautospawn_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;
 }

commit d9841a943191212ee8ef872255400cac5d8a02c4
Author: Deng Zhengrong <dzrongg at gmail.com>
Date:   Sun Jul 29 06:48:07 2012 +0800

    tests: modify rtpoll-test to use 'check' framework

diff --git a/src/Makefile.am b/src/Makefile.am
index be96fb3..d91c226 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -380,9 +380,9 @@ queue_test_LDADD = $(AM_LDADD) libpulsecore- at 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- at PA_MAJORMINOR@.la libpulse.la libpulsecommon- at 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)
diff --git a/src/tests/rtpoll-test.c b/src/tests/rtpoll-test.c
index 6a6b73a..2ac34f0 100644
--- a/src/tests/rtpoll-test.c
+++ b/src/tests/rtpoll-test.c
@@ -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;
 }

commit c02214dac53ae4edf5da8f46faac94feb1b16cde
Author: Deng Zhengrong <dzrongg at gmail.com>
Date:   Sun Jul 29 06:45:44 2012 +0800

    tests: modify sig2str-test to use 'check' framework

diff --git a/src/Makefile.am b/src/Makefile.am
index e5e2b21..be96fb3 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -456,8 +456,8 @@ interpol_test_LDFLAGS = $(AM_LDFLAGS) $(BINLDFLAGS) $(LIBCHECK_LIBS)
 
 sig2str_test_SOURCES = tests/sig2str-test.c
 sig2str_test_LDADD = $(AM_LDADD) libpulsecore- at PA_MAJORMINOR@.la libpulse.la libpulsecommon- at PA_MAJORMINOR@.la
-sig2str_test_CFLAGS = $(AM_CFLAGS)
-sig2str_test_LDFLAGS = $(AM_LDFLAGS) $(BINLDFLAGS)
+sig2str_test_CFLAGS = $(AM_CFLAGS) $(LIBCHECK_CFLAGS)
+sig2str_test_LDFLAGS = $(AM_LDFLAGS) $(BINLDFLAGS) $(LIBCHECK_LIBS)
 
 resampler_test_SOURCES = tests/resampler-test.c
 resampler_test_LDADD = $(AM_LDADD) libpulsecore- at PA_MAJORMINOR@.la libpulse.la libpulsecommon- at PA_MAJORMINOR@.la
diff --git a/src/tests/sig2str-test.c b/src/tests/sig2str-test.c
index 0cd929c..72cd224 100644
--- a/src/tests/sig2str-test.c
+++ b/src/tests/sig2str-test.c
@@ -21,17 +21,109 @@
 #include <config.h>
 #endif
 
+#include <check.h>
+
 #include <signal.h>
 #include <stdio.h>
 
 #include <pulsecore/macro.h>
 #include <pulsecore/core-util.h>
 
-int main(int argc, char *argv[]) {
+static const char *names[] = {
+    "SIG-1",
+    "SIG0",
+    "SIGHUP",
+    "SIGINT",
+    "SIGQUIT",
+    "SIGULL",
+    "SIGTRAP",
+    "SIGABRT",
+    "SIGBUS",
+    "SIGFPE",
+    "SIGKILL",
+    "SIGUSR1",
+    "SIGSEGV",
+    "SIGUSR2",
+    "SIGPIPE",
+    "SIGALRM",
+    "SIGTERM",
+    "SIGSTKFLT",
+    "SIGCHLD",
+    "SIGCONT",
+    "SIGSTOP",
+    "SIGTSTP",
+    "SIGTTIN",
+    "SIGTTOU",
+    "SIGURG",
+    "SIGXCPU",
+    "SIGXFSZ",
+    "SIGVTALRM",
+    "SIGPROF",
+    "SIGWINCH",
+    "SIGIO",
+    "SIGPWR",
+    "SIGSYS",
+    "SIG32",
+    "SIG33",
+    "SIGRTMIN+0",
+    "SIGRTMIN+1",
+    "SIGRTMIN+2",
+    "SIGRTMIN+3",
+    "SIGRTMIN+4",
+    "SIGRTMIN+5",
+    "SIGRTMIN+6",
+    "SIGRTMIN+7",
+    "SIGRTMIN+8",
+    "SIGRTMIN+9",
+    "SIGRTMIN+10",
+    "SIGRTMIN+11",
+    "SIGRTMIN+12",
+    "SIGRTMIN+13",
+    "SIGRTMIN+14",
+    "SIGRTMIN+15",
+    "SIGRTMIN+16",
+    "SIGRTMIN+17",
+    "SIGRTMIN+18",
+    "SIGRTMIN+19",
+    "SIGRTMIN+20",
+    "SIGRTMIN+21",
+    "SIGRTMIN+22",
+    "SIGRTMIN+23",
+    "SIGRTMIN+24",
+    "SIGRTMIN+25",
+    "SIGRTMIN+26",
+    "SIGRTMIN+27",
+    "SIGRTMIN+28",
+    "SIGRTMIN+29",
+    "SIGRTMIN+30",
+    "SIG65"
+};
+
+START_TEST (sig2str_test) {
     int sig;
 
-    for (sig = -1; sig <= NSIG; sig++)
+    for (sig = -1; sig <= NSIG; sig++) {
         printf("%i = %s\n", sig, pa_sig2str(sig));
+        fail_unless(pa_streq(pa_sig2str(sig), names[sig+1]));
+    }
+}
+END_TEST
+
+int main(int argc, char *argv[]) {
+    int failed = 0;
+    Suite *s;
+    TCase *tc;
+    SRunner *sr;
+
+    s = suite_create("Signal String");
+    tc = tcase_create("sig2str");
+    tcase_add_test(tc, sig2str_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 0;
+    return (failed == 0) ? EXIT_SUCCESS : EXIT_FAILURE;
 }

commit f4dd422c75e0699f016aba007c40ea872c1c8c36
Author: Deng Zhengrong <dzrongg at gmail.com>
Date:   Sun Jul 29 06:26:06 2012 +0800

    tests: modify sigbus-test to use 'check' framework

diff --git a/src/Makefile.am b/src/Makefile.am
index 2cc3983..e5e2b21 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -506,8 +506,8 @@ lock_autospawn_test_LDFLAGS = $(AM_LDFLAGS) $(BINLDFLAGS)
 
 sigbus_test_SOURCES = tests/sigbus-test.c
 sigbus_test_LDADD = $(AM_LDADD) libpulsecore- at PA_MAJORMINOR@.la libpulse.la libpulsecommon- at PA_MAJORMINOR@.la
-sigbus_test_CFLAGS = $(AM_CFLAGS)
-sigbus_test_LDFLAGS = $(AM_LDFLAGS) $(BINLDFLAGS)
+sigbus_test_CFLAGS = $(AM_CFLAGS) $(LIBCHECK_CFLAGS)
+sigbus_test_LDFLAGS = $(AM_LDFLAGS) $(BINLDFLAGS) $(LIBCHECK_LIBS)
 
 gtk_test_SOURCES = tests/gtk-test.c
 gtk_test_LDADD = $(AM_LDADD) $(GTK20_LIBS) libpulse-mainloop-glib.la libpulse.la
diff --git a/src/tests/sigbus-test.c b/src/tests/sigbus-test.c
index 4b9ca84..e5815e5 100644
--- a/src/tests/sigbus-test.c
+++ b/src/tests/sigbus-test.c
@@ -26,10 +26,12 @@
 #include <fcntl.h>
 #include <sys/mman.h>
 
+#include <check.h>
+
 #include <pulsecore/memtrap.h>
 #include <pulsecore/core-util.h>
 
-int main(int argc, char *argv[]) {
+START_TEST (sigbus_test) {
     void *p;
     int fd;
     pa_memtrap *m;
@@ -38,10 +40,10 @@ int main(int argc, char *argv[]) {
     pa_memtrap_install();
 
     /* Create the memory map */
-    pa_assert_se((fd = open("sigbus-test-map", O_RDWR|O_TRUNC|O_CREAT, 0660)) >= 0);
-    pa_assert_se(unlink("sigbus-test-map") == 0);
-    pa_assert_se(ftruncate(fd, PA_PAGE_SIZE) >= 0);
-    pa_assert_se((p = mmap(NULL, PA_PAGE_SIZE, PROT_READ|PROT_WRITE, MAP_SHARED, fd, 0)) != MAP_FAILED);
+    fail_unless((fd = open("sigbus-test-map", O_RDWR|O_TRUNC|O_CREAT, 0660)) >= 0);
+    fail_unless(unlink("sigbus-test-map") == 0);
+    fail_unless(ftruncate(fd, PA_PAGE_SIZE) >= 0);
+    fail_unless((p = mmap(NULL, PA_PAGE_SIZE, PROT_READ|PROT_WRITE, MAP_SHARED, fd, 0)) != MAP_FAILED);
 
     /* Register memory map */
     m = pa_memtrap_add(p, PA_PAGE_SIZE);
@@ -54,7 +56,7 @@ int main(int argc, char *argv[]) {
     pa_log("And memtrap says it is good: %s", pa_yes_no(pa_memtrap_is_good(m)));
 
     /* Invalidate mapping */
-    pa_assert_se(ftruncate(fd, 0) >= 0);
+    fail_unless(ftruncate(fd, 0) >= 0);
 
     /* Use memory map */
     pa_snprintf(p, PA_PAGE_SIZE, "This is a test that should fail but get caught.");
@@ -65,6 +67,24 @@ int main(int argc, char *argv[]) {
 
     pa_memtrap_remove(m);
     munmap(p, PA_PAGE_SIZE);
+}
+END_TEST
 
-    return 0;
+int main(int argc, char *argv[]) {
+    int failed = 0;
+    Suite *s;
+    TCase *tc;
+    SRunner *sr;
+
+    s = suite_create("Sig Bus");
+    tc = tcase_create("sigbus");
+    tcase_add_test(tc, sigbus_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;
 }

commit 034807d6d38270880ac2e76034b8261033e8f928
Author: Deng Zhengrong <dzrongg at gmail.com>
Date:   Sun Jul 29 06:12:53 2012 +0800

    tests: modify interpol-test to use 'check' framework

diff --git a/src/Makefile.am b/src/Makefile.am
index 8009b87..2cc3983 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -451,8 +451,8 @@ sync_playback_LDFLAGS = $(AM_LDFLAGS) $(BINLDFLAGS) $(LIBCHECK_LIBS)
 
 interpol_test_SOURCES = tests/interpol-test.c
 interpol_test_LDADD = $(AM_LDADD) libpulsecore- at PA_MAJORMINOR@.la libpulse.la libpulsecommon- at PA_MAJORMINOR@.la
-interpol_test_CFLAGS = $(AM_CFLAGS)
-interpol_test_LDFLAGS = $(AM_LDFLAGS) $(BINLDFLAGS)
+interpol_test_CFLAGS = $(AM_CFLAGS) $(LIBCHECK_CFLAGS)
+interpol_test_LDFLAGS = $(AM_LDFLAGS) $(BINLDFLAGS) $(LIBCHECK_LIBS)
 
 sig2str_test_SOURCES = tests/sig2str-test.c
 sig2str_test_LDADD = $(AM_LDADD) libpulsecore- at PA_MAJORMINOR@.la libpulse.la libpulsecommon- at PA_MAJORMINOR@.la
diff --git a/src/tests/interpol-test.c b/src/tests/interpol-test.c
index ad00aca..6303c5e 100644
--- a/src/tests/interpol-test.c
+++ b/src/tests/interpol-test.c
@@ -28,6 +28,8 @@
 #include <stdio.h>
 #include <stdlib.h>
 
+#include <check.h>
+
 #include <pulse/pulseaudio.h>
 #include <pulse/mainloop.h>
 
@@ -43,6 +45,7 @@ static pa_stream *stream = NULL;
 static pa_mainloop_api *mainloop_api = NULL;
 static pa_bool_t playback = TRUE;
 static pa_usec_t latency = 0;
+static const char *bname = NULL;
 
 static void stream_write_cb(pa_stream *p, size_t nbytes, void *userdata) {
     /* Just some silence */
@@ -50,14 +53,14 @@ static void stream_write_cb(pa_stream *p, size_t nbytes, void *userdata) {
     for (;;) {
         void *data;
 
-        pa_assert_se((nbytes = pa_stream_writable_size(p)) != (size_t) -1);
+        fail_unless((nbytes = pa_stream_writable_size(p)) != (size_t) -1);
 
         if (nbytes <= 0)
             break;
 
-        pa_assert_se(pa_stream_begin_write(p, &data, &nbytes) == 0);
+        fail_unless(pa_stream_begin_write(p, &data, &nbytes) == 0);
         pa_memzero(data, nbytes);
-        pa_assert_se(pa_stream_write(p, data, nbytes, NULL, 0, PA_SEEK_RELATIVE) == 0);
+        fail_unless(pa_stream_write(p, data, nbytes, NULL, 0, PA_SEEK_RELATIVE) == 0);
     }
 }
 
@@ -72,8 +75,8 @@ static void stream_read_cb(pa_stream *p, size_t nbytes, void *userdata) {
         if (nbytes <= 0)
             break;
 
-        pa_assert_se(pa_stream_peek(p, &data, &nbytes) == 0);
-        pa_assert_se(pa_stream_drop(p) == 0);
+        fail_unless(pa_stream_peek(p, &data, &nbytes) == 0);
+        fail_unless(pa_stream_drop(p) == 0);
     }
 }
 
@@ -88,7 +91,7 @@ static void stream_latency_cb(pa_stream *p, void *userdata) {
 
 /* This is called whenever the context status changes */
 static void context_state_callback(pa_context *c, void *userdata) {
-    pa_assert(c);
+    fail_unless(c != NULL);
 
     switch (pa_context_get_state(c)) {
         case PA_CONTEXT_CONNECTING:
@@ -121,7 +124,8 @@ static void context_state_callback(pa_context *c, void *userdata) {
 
             pa_log("Connection established");
 
-            pa_assert_se(stream = pa_stream_new(c, "interpol-test", &ss, NULL));
+            stream = pa_stream_new(c, "interpol-test", &ss, NULL);
+            fail_unless(stream != NULL);
 
             if (playback) {
                 pa_assert_se(pa_stream_connect_playback(stream, NULL, &attr, flags, NULL, NULL) == 0);
@@ -142,11 +146,11 @@ static void context_state_callback(pa_context *c, void *userdata) {
         case PA_CONTEXT_FAILED:
         default:
             pa_log_error("Context error: %s", pa_strerror(pa_context_errno(c)));
-            abort();
+            fail();
     }
 }
 
-int main(int argc, char *argv[]) {
+START_TEST (interpol_test) {
     pa_threaded_mainloop* m = NULL;
     int k;
     struct timeval start, last_info = { 0, 0 };
@@ -155,24 +159,21 @@ int main(int argc, char *argv[]) {
     pa_bool_t corked = FALSE;
 #endif
 
-    if (!getenv("MAKE_CHECK"))
-        pa_log_set_level(PA_LOG_DEBUG);
-
-    playback = argc <= 1 || !pa_streq(argv[1], "-r");
-    latency = (argc >= 2 && !pa_streq(argv[1], "-r")) ? atoi(argv[1]) : (argc >= 3 ? atoi(argv[2]) : 0);
-
     /* Set up a new main loop */
-    pa_assert_se(m = pa_threaded_mainloop_new());
-    pa_assert_se(mainloop_api = pa_threaded_mainloop_get_api(m));
-    pa_assert_se(context = pa_context_new(mainloop_api, argv[0]));
+    m = pa_threaded_mainloop_new();
+    fail_unless(m != NULL);
+    mainloop_api = pa_threaded_mainloop_get_api(m);
+    fail_unless(mainloop_api != NULL);
+    context = pa_context_new(mainloop_api, bname);
+    fail_unless(context != NULL);
 
     pa_context_set_state_callback(context, context_state_callback, NULL);
 
-    pa_assert_se(pa_context_connect(context, NULL, 0, NULL) >= 0);
+    fail_unless(pa_context_connect(context, NULL, 0, NULL) >= 0);
 
     pa_gettimeofday(&start);
 
-    pa_assert_se(pa_threaded_mainloop_start(m) >= 0);
+    fail_unless(pa_threaded_mainloop_start(m) >= 0);
 
 /* #ifdef CORK */
     for (k = 0; k < 20000; k++)
@@ -264,6 +265,32 @@ int main(int argc, char *argv[]) {
 
     if (m)
         pa_threaded_mainloop_free(m);
+}
+END_TEST
+
+int main(int argc, char *argv[]) {
+    int failed = 0;
+    Suite *s;
+    TCase *tc;
+    SRunner *sr;
+
+    if (!getenv("MAKE_CHECK"))
+        pa_log_set_level(PA_LOG_DEBUG);
+
+    bname = argv[0];
+    playback = argc <= 1 || !pa_streq(argv[1], "-r");
+    latency = (argc >= 2 && !pa_streq(argv[1], "-r")) ? atoi(argv[1]) : (argc >= 3 ? atoi(argv[2]) : 0);
+
+    s = suite_create("Interpol");
+    tc = tcase_create("interpol");
+    tcase_add_test(tc, interpol_test);
+    tcase_set_timeout(tc, 5 * 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 0;
+    return (failed == 0) ? EXIT_SUCCESS : EXIT_FAILURE;
 }

commit 23fac142787e27f8fc5a01ff590087d88c170678
Author: Deng Zhengrong <dzrongg at gmail.com>
Date:   Sun Jul 29 05:59:46 2012 +0800

    tests: modify smoother-test to use 'check' framework

diff --git a/src/Makefile.am b/src/Makefile.am
index f27e442..8009b87 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -476,8 +476,8 @@ remix_test_LDFLAGS = $(AM_LDFLAGS) $(BINLDFLAGS)
 
 smoother_test_SOURCES = tests/smoother-test.c
 smoother_test_LDADD = $(AM_LDADD) libpulsecore- at PA_MAJORMINOR@.la libpulse.la libpulsecommon- at PA_MAJORMINOR@.la
-smoother_test_CFLAGS = $(AM_CFLAGS)
-smoother_test_LDFLAGS = $(AM_LDFLAGS) $(BINLDFLAGS)
+smoother_test_CFLAGS = $(AM_CFLAGS) $(LIBCHECK_CFLAGS)
+smoother_test_LDFLAGS = $(AM_LDFLAGS) $(BINLDFLAGS) $(LIBCHECK_LIBS)
 
 proplist_test_SOURCES = tests/proplist-test.c
 proplist_test_LDADD = $(AM_LDADD) libpulsecore- at PA_MAJORMINOR@.la libpulse.la libpulsecommon- at PA_MAJORMINOR@.la
diff --git a/src/tests/smoother-test.c b/src/tests/smoother-test.c
index 4471669..c06f96d 100644
--- a/src/tests/smoother-test.c
+++ b/src/tests/smoother-test.c
@@ -24,12 +24,14 @@
 #include <stdio.h>
 #include <stdlib.h>
 
+#include <check.h>
+
 #include <pulse/timeval.h>
 
 #include <pulsecore/log.h>
 #include <pulsecore/time-smoother.h>
 
-int main(int argc, char*argv[]) {
+START_TEST (smoother_test) {
     pa_usec_t x;
     unsigned u = 0;
     pa_smoother *s;
@@ -80,6 +82,24 @@ int main(int argc, char*argv[]) {
     }
 
     pa_smoother_free(s);
+}
+END_TEST
+
+int main(int argc, char *argv[]) {
+    int failed = 0;
+    Suite *s;
+    TCase *tc;
+    SRunner *sr;
+
+    s = suite_create("Smoother");
+    tc = tcase_create("smoother");
+    tcase_add_test(tc, smoother_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 0;
+    return (failed == 0) ? EXIT_SUCCESS : EXIT_FAILURE;
 }

commit ca5ea07c42f24d88fc1e291c51b8f5bce686b3ae
Author: Deng Zhengrong <dzrongg at gmail.com>
Date:   Sun Jul 29 01:21:25 2012 +0800

    tests: modify sync-playback to use 'check' framework

diff --git a/src/Makefile.am b/src/Makefile.am
index 2cf4d3c..f27e442 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -446,8 +446,8 @@ memblockq_test_LDFLAGS = $(AM_LDFLAGS) $(BINLDFLAGS) $(LIBCHECK_LIBS)
 
 sync_playback_SOURCES = tests/sync-playback.c
 sync_playback_LDADD = $(AM_LDADD) libpulse.la
-sync_playback_CFLAGS = $(AM_CFLAGS)
-sync_playback_LDFLAGS = $(AM_LDFLAGS) $(BINLDFLAGS)
+sync_playback_CFLAGS = $(AM_CFLAGS) $(LIBCHECK_CFLAGS)
+sync_playback_LDFLAGS = $(AM_LDFLAGS) $(BINLDFLAGS) $(LIBCHECK_LIBS)
 
 interpol_test_SOURCES = tests/interpol-test.c
 interpol_test_LDADD = $(AM_LDADD) libpulsecore- at PA_MAJORMINOR@.la libpulse.la libpulsecommon- at PA_MAJORMINOR@.la
diff --git a/src/tests/sync-playback.c b/src/tests/sync-playback.c
index df1fa45..0a758d1 100644
--- a/src/tests/sync-playback.c
+++ b/src/tests/sync-playback.c
@@ -29,6 +29,8 @@
 #include <stdlib.h>
 #include <math.h>
 
+#include <check.h>
+
 #include <pulse/pulseaudio.h>
 #include <pulse/mainloop.h>
 
@@ -39,6 +41,7 @@
 static pa_context *context = NULL;
 static pa_stream *streams[NSTREAMS];
 static pa_mainloop_api *mainloop_api = NULL;
+static const char *bname = NULL;
 
 static float data[SAMPLE_HZ]; /* one second space */
 
@@ -73,7 +76,7 @@ static void underflow_cb(struct pa_stream *s, void *userdata) {
 
 /* This routine is called whenever the stream state changes */
 static void stream_state_callback(pa_stream *s, void *userdata) {
-    assert(s);
+    fail_unless(s != NULL);
 
     switch (pa_stream_get_state(s)) {
         case PA_STREAM_UNCONNECTED:
@@ -88,7 +91,7 @@ static void stream_state_callback(pa_stream *s, void *userdata) {
             fprintf(stderr, "Writing data to stream %i.\n", i);
 
             r = pa_stream_write(s, data, sizeof(data), nop_free_cb, (int64_t) sizeof(data) * (int64_t) i, PA_SEEK_ABSOLUTE);
-            assert(r == 0);
+            fail_unless(r == 0);
 
             /* Be notified when this stream is drained */
             pa_stream_set_underflow_callback(s, underflow_cb, userdata);
@@ -105,13 +108,13 @@ static void stream_state_callback(pa_stream *s, void *userdata) {
         default:
         case PA_STREAM_FAILED:
             fprintf(stderr, "Stream error: %s\n", pa_strerror(pa_context_errno(pa_stream_get_context(s))));
-            abort();
+            fail();
     }
 }
 
 /* This is called whenever the context status changes */
 static void context_state_callback(pa_context *c, void *userdata) {
-    assert(c);
+    fail_unless(c != NULL);
 
     switch (pa_context_get_state(c)) {
         case PA_CONTEXT_CONNECTING:
@@ -132,7 +135,7 @@ static void context_state_callback(pa_context *c, void *userdata) {
                 snprintf(name, sizeof(name), "stream #%i", i);
 
                 streams[i] = pa_stream_new(c, name, &sample_spec, NULL);
-                assert(streams[i]);
+                fail_unless(streams[i] != NULL);
                 pa_stream_set_state_callback(streams[i], stream_state_callback, (void*) (long) i);
                 pa_stream_connect_playback(streams[i], NULL, &buffer_attr, PA_STREAM_START_CORKED, NULL, i == 0 ? NULL : streams[0]);
             }
@@ -147,11 +150,11 @@ static void context_state_callback(pa_context *c, void *userdata) {
         case PA_CONTEXT_FAILED:
         default:
             fprintf(stderr, "Context error: %s\n", pa_strerror(pa_context_errno(c)));
-            abort();
+            fail();
     }
 }
 
-int main(int argc, char *argv[]) {
+START_TEST (sync_playback_test) {
     pa_mainloop* m = NULL;
     int i, ret = 0;
 
@@ -163,12 +166,12 @@ int main(int argc, char *argv[]) {
 
     /* Set up a new main loop */
     m = pa_mainloop_new();
-    assert(m);
+    fail_unless(m != NULL);
 
     mainloop_api = pa_mainloop_get_api(m);
 
-    context = pa_context_new(mainloop_api, argv[0]);
-    assert(context);
+    context = pa_context_new(mainloop_api, bname);
+    fail_unless(context != NULL);
 
     pa_context_set_state_callback(context, context_state_callback, NULL);
 
@@ -190,5 +193,28 @@ quit:
 
     pa_mainloop_free(m);
 
-    return ret;
+    fail_unless(ret == 0);
+}
+END_TEST
+
+int main(int argc, char *argv[]) {
+    int failed = 0;
+    Suite *s;
+    TCase *tc;
+    SRunner *sr;
+
+    bname = argv[0];
+
+    s = suite_create("Sync Playback");
+    tc = tcase_create("syncplayback");
+    tcase_add_test(tc, sync_playback_test);
+    tcase_set_timeout(tc, 5 * 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;
 }

commit eb15d0c5e2b622b06b33339ebeac190326b36f8c
Author: Deng Zhengrong <dzrongg at gmail.com>
Date:   Sun Jul 29 01:17:27 2012 +0800

    tests: modify extended-test to use 'check' framework

diff --git a/src/Makefile.am b/src/Makefile.am
index f058515..2cf4d3c 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -401,8 +401,8 @@ parec_simple_LDFLAGS = $(AM_LDFLAGS) $(BINLDFLAGS)
 
 extended_test_SOURCES = tests/extended-test.c
 extended_test_LDADD = $(AM_LDADD) libpulse.la
-extended_test_CFLAGS = $(AM_CFLAGS)
-extended_test_LDFLAGS = $(AM_LDFLAGS) $(BINLDFLAGS)
+extended_test_CFLAGS = $(AM_CFLAGS) $(LIBCHECK_CFLAGS)
+extended_test_LDFLAGS = $(AM_LDFLAGS) $(BINLDFLAGS) $(LIBCHECK_LIBS)
 
 strlist_test_SOURCES = tests/strlist-test.c
 strlist_test_CFLAGS = $(AM_CFLAGS) $(LIBCHECK_CFLAGS)
diff --git a/src/tests/extended-test.c b/src/tests/extended-test.c
index 7a0656b..ce8a6b0 100644
--- a/src/tests/extended-test.c
+++ b/src/tests/extended-test.c
@@ -29,6 +29,8 @@
 #include <stdlib.h>
 #include <math.h>
 
+#include <check.h>
+
 #include <pulse/pulseaudio.h>
 #include <pulse/mainloop.h>
 
@@ -39,6 +41,7 @@
 static pa_context *context = NULL;
 static pa_stream *streams[NSTREAMS];
 static pa_mainloop_api *mainloop_api = NULL;
+static const char *bname;
 
 static float data[SAMPLE_HZ]; /* one second space */
 
@@ -67,7 +70,7 @@ static void underflow_cb(struct pa_stream *s, void *userdata) {
 
 /* This routine is called whenever the stream state changes */
 static void stream_state_callback(pa_stream *s, void *userdata) {
-    assert(s);
+    fail_unless(s != NULL);
 
     switch (pa_stream_get_state(s)) {
         case PA_STREAM_UNCONNECTED:
@@ -82,7 +85,7 @@ static void stream_state_callback(pa_stream *s, void *userdata) {
             fprintf(stderr, "Writing data to stream %i.\n", i);
 
             r = pa_stream_write(s, data, sizeof(data), nop_free_cb, (int64_t) sizeof(data) * (int64_t) i, PA_SEEK_ABSOLUTE);
-            assert(r == 0);
+            fail_unless(r == 0);
 
             /* Be notified when this stream is drained */
             pa_stream_set_underflow_callback(s, underflow_cb, userdata);
@@ -99,13 +102,13 @@ static void stream_state_callback(pa_stream *s, void *userdata) {
         default:
         case PA_STREAM_FAILED:
             fprintf(stderr, "Stream error: %s\n", pa_strerror(pa_context_errno(pa_stream_get_context(s))));
-            abort();
+            fail();
     }
 }
 
 /* This is called whenever the context status changes */
 static void context_state_callback(pa_context *c, void *userdata) {
-    assert(c);
+    fail_unless(c != NULL);
 
     switch (pa_context_get_state(c)) {
         case PA_CONTEXT_CONNECTING:
@@ -133,7 +136,7 @@ static void context_state_callback(pa_context *c, void *userdata) {
                 snprintf(name, sizeof(name), "stream #%i", i);
 
                 streams[i] = pa_stream_new_extended(c, name, formats, 1, NULL);
-                assert(streams[i]);
+                fail_unless(streams[i] != NULL);
                 pa_stream_set_state_callback(streams[i], stream_state_callback, (void*) (long) i);
                 pa_stream_connect_playback(streams[i], NULL, &buffer_attr, PA_STREAM_START_CORKED, NULL, i == 0 ? NULL : streams[0]);
 
@@ -150,11 +153,11 @@ static void context_state_callback(pa_context *c, void *userdata) {
         case PA_CONTEXT_FAILED:
         default:
             fprintf(stderr, "Context error: %s\n", pa_strerror(pa_context_errno(c)));
-            abort();
+            fail();
     }
 }
 
-int main(int argc, char *argv[]) {
+START_TEST (extended_test) {
     pa_mainloop* m = NULL;
     int i, ret = 1;
 
@@ -166,12 +169,12 @@ int main(int argc, char *argv[]) {
 
     /* Set up a new main loop */
     m = pa_mainloop_new();
-    assert(m);
+    fail_unless(m != NULL);
 
     mainloop_api = pa_mainloop_get_api(m);
 
-    context = pa_context_new(mainloop_api, argv[0]);
-    assert(context);
+    context = pa_context_new(mainloop_api, bname);
+    fail_unless(context != NULL);
 
     pa_context_set_state_callback(context, context_state_callback, NULL);
 
@@ -193,5 +196,27 @@ quit:
 
     pa_mainloop_free(m);
 
-    return ret;
+    fail_unless(ret == 0);
+}
+END_TEST
+
+int main(int argc, char *argv[]) {
+    int failed = 0;
+    Suite *s;
+    TCase *tc;
+    SRunner *sr;
+
+    bname = argv[0];
+
+    s = suite_create("Extended");
+    tc = tcase_create("extended");
+    tcase_add_test(tc, extended_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;
 }

commit a74795f9e38e2eba7811ac8fccb183891120a30a
Author: Deng Zhengrong <dzrongg at gmail.com>
Date:   Sun Jul 29 00:59:42 2012 +0800

    tests: modify hook-list-test to use 'check' framework

diff --git a/src/Makefile.am b/src/Makefile.am
index 844716d..f058515 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -340,9 +340,9 @@ ipacl_test_LDADD = $(AM_LDADD) libpulsecore- at PA_MAJORMINOR@.la libpulse.la libpu
 ipacl_test_LDFLAGS = $(AM_LDFLAGS) $(BINLDFLAGS)
 
 hook_list_test_SOURCES = tests/hook-list-test.c
-hook_list_test_CFLAGS = $(AM_CFLAGS)
+hook_list_test_CFLAGS = $(AM_CFLAGS) $(LIBCHECK_CFLAGS)
 hook_list_test_LDADD = $(AM_LDADD) libpulsecore- at PA_MAJORMINOR@.la libpulse.la libpulsecommon- at PA_MAJORMINOR@.la
-hook_list_test_LDFLAGS = $(AM_LDFLAGS) $(BINLDFLAGS)
+hook_list_test_LDFLAGS = $(AM_LDFLAGS) $(BINLDFLAGS) $(LIBCHECK_LIBS)
 
 memblock_test_SOURCES = tests/memblock-test.c
 memblock_test_CFLAGS = $(AM_CFLAGS) $(LIBCHECK_CFLAGS)
diff --git a/src/tests/hook-list-test.c b/src/tests/hook-list-test.c
index 452e477..aec2a5d 100644
--- a/src/tests/hook-list-test.c
+++ b/src/tests/hook-list-test.c
@@ -2,20 +2,26 @@
 #include <config.h>
 #endif
 
+#include <check.h>
+
 #include <pulsecore/hook-list.h>
 #include <pulsecore/log.h>
 
 static pa_hook_result_t func1(const char *hook_data, const char *call_data, const char *slot_data) {
     pa_log("(func1) hook=%s call=%s slot=%s", hook_data, call_data, slot_data);
+    /* succeed when it runs to here */
+    fail_unless(1);
     return PA_HOOK_OK;
 }
 
 static pa_hook_result_t func2(const char *hook_data, const char *call_data, const char *slot_data) {
     pa_log("(func2) hook=%s call=%s slot=%s", hook_data, call_data, slot_data);
+    /* succeed when it runs to here */
+    fail_unless(1);
     return PA_HOOK_OK;
 }
 
-int main(int argc, char *argv[]) {
+START_TEST (hooklist_test) {
     pa_hook hook;
     pa_hook_slot *slot;
 
@@ -32,6 +38,24 @@ int main(int argc, char *argv[]) {
     pa_hook_fire(&hook, (void*) "call2");
 
     pa_hook_done(&hook);
+}
+END_TEST
 
-    return 0;
+int main(int argc, char *argv[]) {
+    int failed = 0;
+    Suite *s;
+    TCase *tc;
+    SRunner *sr;
+
+    s = suite_create("Hook List");
+    tc = tcase_create("hooklist");
+    tcase_add_test(tc, hooklist_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;
 }

commit ef5cf81ff8602477270bd445afdc8b5949cc9c1f
Author: Deng Zhengrong <dzrongg at gmail.com>
Date:   Sun Jul 29 00:24:33 2012 +0800

    tests: modify memblockq-test to use 'check' framework

diff --git a/src/Makefile.am b/src/Makefile.am
index 8528be8..844716d 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -440,9 +440,9 @@ mainloop_test_glib_LDADD = $(mainloop_test_LDADD) $(GLIB20_LIBS) libpulse-mainlo
 mainloop_test_glib_LDFLAGS = $(AM_LDFLAGS) $(BINLDFLAGS) $(LIBCHECK_LIBS)
 
 memblockq_test_SOURCES = tests/memblockq-test.c
-memblockq_test_CFLAGS = $(AM_CFLAGS)
+memblockq_test_CFLAGS = $(AM_CFLAGS) $(LIBCHECK_CFLAGS)
 memblockq_test_LDADD = $(AM_LDADD) $(WINSOCK_LIBS) libpulsecore- at PA_MAJORMINOR@.la libpulse.la libpulsecommon- at PA_MAJORMINOR@.la
-memblockq_test_LDFLAGS = $(AM_LDFLAGS) $(BINLDFLAGS)
+memblockq_test_LDFLAGS = $(AM_LDFLAGS) $(BINLDFLAGS) $(LIBCHECK_LIBS)
 
 sync_playback_SOURCES = tests/sync-playback.c
 sync_playback_LDADD = $(AM_LDADD) libpulse.la
diff --git a/src/tests/memblockq-test.c b/src/tests/memblockq-test.c
index 51e1717..11ac905 100644
--- a/src/tests/memblockq-test.c
+++ b/src/tests/memblockq-test.c
@@ -25,51 +25,77 @@
 #include <stdio.h>
 #include <signal.h>
 
+#include <check.h>
+
 #include <pulsecore/memblockq.h>
 #include <pulsecore/log.h>
 #include <pulsecore/macro.h>
+#include <pulsecore/strbuf.h>
+#include <pulsecore/core-util.h>
+
+#include <pulse/xmalloc.h>
 
-static void dump_chunk(const pa_memchunk *chunk) {
+static const char *fixed[] = {
+    "1122444411441144__22__11______3333______________________________",
+    "__________________3333__________________________________________"
+};
+static const char *manual[] = {
+    "1122444411441144__22__11______3333______________________________",
+    "__________________3333______________________________"
+};
+
+static void dump_chunk(const pa_memchunk *chunk, pa_strbuf *buf) {
     size_t n;
     void *q;
     char *e;
 
-    pa_assert(chunk);
+    fail_unless(chunk != NULL);
 
     q = pa_memblock_acquire(chunk->memblock);
-    for (e = (char*) q + chunk->index, n = 0; n < chunk->length; n++, e++)
+    for (e = (char*) q + chunk->index, n = 0; n < chunk->length; n++, e++) {
         fprintf(stderr, "%c", *e);
+        pa_strbuf_putc(buf, *e);
+    }
     pa_memblock_release(chunk->memblock);
 }
 
-static void dump(pa_memblockq *bq) {
+static void dump(pa_memblockq *bq, int n) {
     pa_memchunk out;
+    pa_strbuf *buf;
+    char *str;
 
     pa_assert(bq);
 
     /* First let's dump this as fixed block */
     fprintf(stderr, "FIXED >");
     pa_memblockq_peek_fixed_size(bq, 64, &out);
-    dump_chunk(&out);
+    buf = pa_strbuf_new();
+    dump_chunk(&out, buf);
     pa_memblock_unref(out.memblock);
+    str = pa_strbuf_tostring_free(buf);
+    fail_unless(pa_streq(str, fixed[n]));
+    pa_xfree(str);
     fprintf(stderr, "<\n");
 
     /* Then let's dump the queue manually */
     fprintf(stderr, "MANUAL>");
 
+    buf = pa_strbuf_new();
     for (;;) {
         if (pa_memblockq_peek(bq, &out) < 0)
             break;
 
-        dump_chunk(&out);
+        dump_chunk(&out, buf);
         pa_memblock_unref(out.memblock);
         pa_memblockq_drop(bq, out.length);
     }
-
+    str = pa_strbuf_tostring_free(buf);
+    fail_unless(pa_streq(str, manual[n]));
+    pa_xfree(str);
     fprintf(stderr, "<\n");
 }
 
-int main(int argc, char *argv[]) {
+START_TEST (memblockq_test) {
     int ret;
 
     pa_mempool *p;
@@ -86,85 +112,96 @@ int main(int argc, char *argv[]) {
 
     p = pa_mempool_new(FALSE, 0);
 
-    pa_assert_se(silence.memblock = pa_memblock_new_fixed(p, (char*) "__", 2, 1));
+    silence.memblock = pa_memblock_new_fixed(p, (char*) "__", 2, 1);
+    fail_unless(silence.memblock != NULL);
+
     silence.index = 0;
     silence.length = pa_memblock_get_length(silence.memblock);
 
-    pa_assert_se(bq = pa_memblockq_new("test memblockq", 0, 200, 10, &ss, 4, 4, 40, &silence));
+    bq = pa_memblockq_new("test memblockq", 0, 200, 10, &ss, 4, 4, 40, &silence);
+    fail_unless(bq != NULL);
+
+    chunk1.memblock = pa_memblock_new_fixed(p, (char*) "11", 2, 1);
+    fail_unless(chunk1.memblock != NULL);
 
-    pa_assert_se(chunk1.memblock = pa_memblock_new_fixed(p, (char*) "11", 2, 1));
     chunk1.index = 0;
     chunk1.length = 2;
 
-    pa_assert_se(chunk2.memblock = pa_memblock_new_fixed(p, (char*) "XX22", 4, 1));
+    chunk2.memblock = pa_memblock_new_fixed(p, (char*) "XX22", 4, 1);
+    fail_unless(chunk2.memblock != NULL);
+
     chunk2.index = 2;
     chunk2.length = 2;
 
-    pa_assert_se(chunk3.memblock = pa_memblock_new_fixed(p, (char*) "3333", 4, 1));
+    chunk3.memblock = pa_memblock_new_fixed(p, (char*) "3333", 4, 1);
+    fail_unless(chunk3.memblock != NULL);
+
     chunk3.index = 0;
     chunk3.length = 4;
 
-    pa_assert_se(chunk4.memblock = pa_memblock_new_fixed(p, (char*) "44444444", 8, 1));
+    chunk4.memblock = pa_memblock_new_fixed(p, (char*) "44444444", 8, 1);
+    fail_unless(chunk4.memblock != NULL);
+
     chunk4.index = 0;
     chunk4.length = 8;
 
     ret = pa_memblockq_push(bq, &chunk1);
-    assert(ret == 0);
+    fail_unless(ret == 0);
 
     ret = pa_memblockq_push(bq, &chunk2);
-    assert(ret == 0);
+    fail_unless(ret == 0);
 
     ret = pa_memblockq_push(bq, &chunk3);
-    assert(ret == 0);
+    fail_unless(ret == 0);
 
     ret = pa_memblockq_push(bq, &chunk4);
-    assert(ret == 0);
+    fail_unless(ret == 0);
 
     pa_memblockq_seek(bq, -6, 0, TRUE);
     ret = pa_memblockq_push(bq, &chunk3);
-    assert(ret == 0);
+    fail_unless(ret == 0);
 
     pa_memblockq_seek(bq, -2, 0, TRUE);
     ret = pa_memblockq_push(bq, &chunk1);
-    assert(ret == 0);
+    fail_unless(ret == 0);
 
     pa_memblockq_seek(bq, -10, 0, TRUE);
     ret = pa_memblockq_push(bq, &chunk4);
-    assert(ret == 0);
+    fail_unless(ret == 0);
 
     pa_memblockq_seek(bq, 10, 0, TRUE);
 
     ret = pa_memblockq_push(bq, &chunk1);
-    assert(ret == 0);
+    fail_unless(ret == 0);
 
     pa_memblockq_seek(bq, -6, 0, TRUE);
     ret = pa_memblockq_push(bq, &chunk2);
-    assert(ret == 0);
+    fail_unless(ret == 0);
 
     /* Test splitting */
     pa_memblockq_seek(bq, -12, 0, TRUE);
     ret = pa_memblockq_push(bq, &chunk1);
-    assert(ret == 0);
+    fail_unless(ret == 0);
 
     pa_memblockq_seek(bq, 20, 0, TRUE);
 
     /* Test merging */
     ret = pa_memblockq_push(bq, &chunk3);
-    assert(ret == 0);
+    fail_unless(ret == 0);
     pa_memblockq_seek(bq, -2, 0, TRUE);
 
     chunk3.index += 2;
     chunk3.length -= 2;
     ret = pa_memblockq_push(bq, &chunk3);
-    assert(ret == 0);
+    fail_unless(ret == 0);
 
     pa_memblockq_seek(bq, 30, PA_SEEK_RELATIVE, TRUE);
 
-    dump(bq);
+    dump(bq, 0);
 
     pa_memblockq_rewind(bq, 52);
 
-    dump(bq);
+    dump(bq, 1);
 
     pa_memblockq_free(bq);
     pa_memblock_unref(silence.memblock);
@@ -174,6 +211,24 @@ int main(int argc, char *argv[]) {
     pa_memblock_unref(chunk4.memblock);
 
     pa_mempool_free(p);
+}
+END_TEST
 
-    return 0;
+int main(int argc, char *argv[]) {
+    int failed = 0;
+    Suite *s;
+    TCase *tc;
+    SRunner *sr;
+
+    s = suite_create("Memblock Queue");
+    tc = tcase_create("memblockq");
+    tcase_add_test(tc, memblockq_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;
 }

commit d10009fc9760269a67164f512c1e8e66d8a4bbb2
Author: Deng Zhengrong <dzrongg at gmail.com>
Date:   Sat Jul 28 22:56:43 2012 +0800

    tests: modify proplist-test to use 'check' framework

diff --git a/src/Makefile.am b/src/Makefile.am
index 38f1ec6..8528be8 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -481,8 +481,8 @@ smoother_test_LDFLAGS = $(AM_LDFLAGS) $(BINLDFLAGS)
 
 proplist_test_SOURCES = tests/proplist-test.c
 proplist_test_LDADD = $(AM_LDADD) libpulsecore- at PA_MAJORMINOR@.la libpulse.la libpulsecommon- at PA_MAJORMINOR@.la
-proplist_test_CFLAGS = $(AM_CFLAGS)
-proplist_test_LDFLAGS = $(AM_LDFLAGS) $(BINLDFLAGS)
+proplist_test_CFLAGS = $(AM_CFLAGS) $(LIBCHECK_CFLAGS)
+proplist_test_LDFLAGS = $(AM_LDFLAGS) $(BINLDFLAGS) $(LIBCHECK_LIBS)
 
 cpu_test_SOURCES = tests/cpu-test.c
 cpu_test_LDADD = $(AM_LDADD) libpulsecore- at PA_MAJORMINOR@.la libpulse.la libpulsecommon- at PA_MAJORMINOR@.la
diff --git a/src/tests/proplist-test.c b/src/tests/proplist-test.c
index f5a54d6..6aac03c 100644
--- a/src/tests/proplist-test.c
+++ b/src/tests/proplist-test.c
@@ -23,36 +23,35 @@
 
 #include <stdio.h>
 
+#include <check.h>
+
 #include <pulse/proplist.h>
 #include <pulse/xmalloc.h>
 #include <pulsecore/macro.h>
 #include <pulsecore/core-util.h>
 #include <pulsecore/modargs.h>
 
-int main(int argc, char*argv[]) {
+START_TEST (proplist_test) {
     pa_modargs *ma;
     pa_proplist *a, *b, *c, *d;
     char *s, *t, *u, *v;
     const char *text;
     const char *x[] = { "foo", NULL };
 
-    if (!getenv("MAKE_CHECK"))
-        pa_log_set_level(PA_LOG_DEBUG);
-
     a = pa_proplist_new();
-    pa_assert_se(pa_proplist_sets(a, PA_PROP_MEDIA_TITLE, "Brandenburgische Konzerte") == 0);
-    pa_assert_se(pa_proplist_sets(a, PA_PROP_MEDIA_ARTIST, "Johann Sebastian Bach") == 0);
+    fail_unless(pa_proplist_sets(a, PA_PROP_MEDIA_TITLE, "Brandenburgische Konzerte") == 0);
+    fail_unless(pa_proplist_sets(a, PA_PROP_MEDIA_ARTIST, "Johann Sebastian Bach") == 0);
 
     b = pa_proplist_new();
-    pa_assert_se(pa_proplist_sets(b, PA_PROP_MEDIA_TITLE, "Goldbergvariationen") == 0);
-    pa_assert_se(pa_proplist_set(b, PA_PROP_MEDIA_ICON, "\0\1\2\3\4\5\6\7", 8) == 0);
+    fail_unless(pa_proplist_sets(b, PA_PROP_MEDIA_TITLE, "Goldbergvariationen") == 0);
+    fail_unless(pa_proplist_set(b, PA_PROP_MEDIA_ICON, "\0\1\2\3\4\5\6\7", 8) == 0);
 
     pa_proplist_update(a, PA_UPDATE_MERGE, b);
 
-    pa_assert_se(!pa_proplist_gets(a, PA_PROP_MEDIA_ICON));
+    fail_unless(!pa_proplist_gets(a, PA_PROP_MEDIA_ICON));
 
     pa_log_debug("%s", pa_strnull(pa_proplist_gets(a, PA_PROP_MEDIA_TITLE)));
-    pa_assert_se(pa_proplist_unset(b, PA_PROP_MEDIA_TITLE) == 0);
+    fail_unless(pa_proplist_unset(b, PA_PROP_MEDIA_TITLE) == 0);
 
     s = pa_proplist_to_string(a);
     t = pa_proplist_to_string(b);
@@ -60,7 +59,7 @@ int main(int argc, char*argv[]) {
 
     c = pa_proplist_from_string(s);
     u = pa_proplist_to_string(c);
-    pa_assert_se(pa_streq(s, u));
+    fail_unless(pa_streq(s, u));
 
     pa_xfree(s);
     pa_xfree(t);
@@ -84,16 +83,39 @@ int main(int argc, char*argv[]) {
     pa_log_debug("%s", v);
     pa_xfree(v);
 
-    pa_assert_se(ma = pa_modargs_new("foo='foobar=waldo foo2=\"lj\\\"dhflh\" foo3=\"kjlskj\\'\"'", x));
-    pa_assert_se(a = pa_proplist_new());
+    ma = pa_modargs_new("foo='foobar=waldo foo2=\"lj\\\"dhflh\" foo3=\"kjlskj\\'\"'", x);
+    fail_unless(ma != NULL);
+    a = pa_proplist_new();
+    fail_unless(a != NULL);
 
-    pa_assert_se(pa_modargs_get_proplist(ma, "foo", a, PA_UPDATE_REPLACE) >= 0);
+    fail_unless(pa_modargs_get_proplist(ma, "foo", a, PA_UPDATE_REPLACE) >= 0);
 
     pa_log_debug("%s", v = pa_proplist_to_string(a));
     pa_xfree(v);
 
     pa_proplist_free(a);
     pa_modargs_free(ma);
+}
+END_TEST
+
+int main(int argc, char *argv[]) {
+    int failed = 0;
+    Suite *s;
+    TCase *tc;
+    SRunner *sr;
+
+    if (!getenv("MAKE_CHECK"))
+        pa_log_set_level(PA_LOG_DEBUG);
+
+    s = suite_create("Property List");
+    tc = tcase_create("propertylist");
+    tcase_add_test(tc, proplist_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 0;
+    return (failed == 0) ? EXIT_SUCCESS : EXIT_FAILURE;
 }

commit 67df8223b0d34e3968c4cb89dce014b4652adc5b
Author: Deng Zhengrong <dzrongg at gmail.com>
Date:   Sat Jul 28 22:51:04 2012 +0800

    tests: modify memblock-test to use 'check' framework

diff --git a/src/Makefile.am b/src/Makefile.am
index 6e96eb9..38f1ec6 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -345,9 +345,9 @@ hook_list_test_LDADD = $(AM_LDADD) libpulsecore- at PA_MAJORMINOR@.la libpulse.la l
 hook_list_test_LDFLAGS = $(AM_LDFLAGS) $(BINLDFLAGS)
 
 memblock_test_SOURCES = tests/memblock-test.c
-memblock_test_CFLAGS = $(AM_CFLAGS)
+memblock_test_CFLAGS = $(AM_CFLAGS) $(LIBCHECK_CFLAGS)
 memblock_test_LDADD = $(AM_LDADD) libpulsecore- at PA_MAJORMINOR@.la libpulse.la libpulsecommon- at PA_MAJORMINOR@.la
-memblock_test_LDFLAGS = $(AM_LDFLAGS) $(BINLDFLAGS)
+memblock_test_LDFLAGS = $(AM_LDFLAGS) $(BINLDFLAGS) $(LIBCHECK_LIBS)
 
 thread_test_SOURCES = tests/thread-test.c
 thread_test_CFLAGS = $(AM_CFLAGS) $(LIBCHECK_CFLAGS)
diff --git a/src/tests/memblock-test.c b/src/tests/memblock-test.c
index b82c41a..a48daf7 100644
--- a/src/tests/memblock-test.c
+++ b/src/tests/memblock-test.c
@@ -24,6 +24,8 @@
 #include <stdio.h>
 #include <unistd.h>
 
+#include <check.h>
+
 #include <pulse/xmalloc.h>
 
 #include <pulsecore/log.h>
@@ -66,7 +68,7 @@ static void print_stats(pa_mempool *p, const char *text) {
            (unsigned) pa_atomic_load(&s->n_pool_full));
 }
 
-int main(int argc, char *argv[]) {
+START_TEST (memblock_test) {
     pa_mempool *pool_a, *pool_b, *pool_c;
     unsigned id_a, id_b, id_c;
     pa_memexport *export_a, *export_b;
@@ -80,19 +82,17 @@ int main(int argc, char *argv[]) {
 
     const char txt[] = "This is a test!";
 
-    if (!getenv("MAKE_CHECK"))
-        pa_log_set_level(PA_LOG_DEBUG);
-
     pool_a = pa_mempool_new(TRUE, 0);
+    fail_unless(pool_a != NULL);
     pool_b = pa_mempool_new(TRUE, 0);
+    fail_unless(pool_b != NULL);
     pool_c = pa_mempool_new(TRUE, 0);
+    fail_unless(pool_c != NULL);
 
     pa_mempool_get_shm_id(pool_a, &id_a);
     pa_mempool_get_shm_id(pool_b, &id_b);
     pa_mempool_get_shm_id(pool_c, &id_c);
 
-    pa_assert(pool_a && pool_b && pool_c);
-
     blocks[0] = pa_memblock_new_fixed(pool_a, (void*) txt, sizeof(txt), 1);
 
     blocks[1] = pa_memblock_new(pool_a, sizeof(txt));
@@ -112,35 +112,35 @@ int main(int argc, char *argv[]) {
         pa_log("Memory block %u", i);
 
         mb_a = blocks[i];
-        pa_assert(mb_a);
+        fail_unless(mb_a != NULL);
 
         export_a = pa_memexport_new(pool_a, revoke_cb, (void*) "A");
+        fail_unless(export_a != NULL);
         export_b = pa_memexport_new(pool_b, revoke_cb, (void*) "B");
-
-        pa_assert(export_a && export_b);
+        fail_unless(export_b != NULL);
 
         import_b = pa_memimport_new(pool_b, release_cb, (void*) "B");
+        fail_unless(import_b != NULL);
         import_c = pa_memimport_new(pool_c, release_cb, (void*) "C");
-
-        pa_assert(import_b && import_c);
+        fail_unless(import_b != NULL);
 
         r = pa_memexport_put(export_a, mb_a, &id, &shm_id, &offset, &size);
-        pa_assert(r >= 0);
-        pa_assert(shm_id == id_a);
+        fail_unless(r >= 0);
+        fail_unless(shm_id == id_a);
 
         pa_log("A: Memory block exported as %u", id);
 
         mb_b = pa_memimport_get(import_b, id, shm_id, offset, size);
-        pa_assert(mb_b);
+        fail_unless(mb_b != NULL);
         r = pa_memexport_put(export_b, mb_b, &id, &shm_id, &offset, &size);
-        pa_assert(r >= 0);
-        pa_assert(shm_id == id_a || shm_id == id_b);
+        fail_unless(r >= 0);
+        fail_unless(shm_id == id_a || shm_id == id_b);
         pa_memblock_unref(mb_b);
 
         pa_log("B: Memory block exported as %u", id);
 
         mb_c = pa_memimport_get(import_c, id, shm_id, offset, size);
-        pa_assert(mb_c);
+        fail_unless(mb_c != NULL);
         x = pa_memblock_acquire(mb_c);
         pa_log_debug("1 data=%s", x);
         pa_memblock_release(mb_c);
@@ -174,6 +174,27 @@ int main(int argc, char *argv[]) {
     pa_mempool_free(pool_a);
     pa_mempool_free(pool_b);
     pa_mempool_free(pool_c);
+}
+END_TEST
+
+int main(int argc, char *argv[]) {
+    int failed = 0;
+    Suite *s;
+    TCase *tc;
+    SRunner *sr;
+
+    if (!getenv("MAKE_CHECK"))
+        pa_log_set_level(PA_LOG_DEBUG);
+
+    s = suite_create("Memblock");
+    tc = tcase_create("memblock");
+    tcase_add_test(tc, memblock_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 0;
+    return (failed == 0) ? EXIT_SUCCESS : EXIT_FAILURE;
 }

commit 2b7fb50935f989b5fdec465a4dd5b2e9831d5f94
Author: Deng Zhengrong <dzrongg at gmail.com>
Date:   Sat Jul 28 22:21:56 2012 +0800

    tests: modify connect-stress to use 'check' framework

diff --git a/src/Makefile.am b/src/Makefile.am
index eca874b..6e96eb9 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -526,8 +526,8 @@ usergroup_test_LDFLAGS = $(AM_LDFLAGS) $(BINLDFLAGS) $(LIBCHECK_LIBS)
 
 connect_stress_SOURCES = tests/connect-stress.c
 connect_stress_LDADD = $(AM_LDADD) libpulse.la
-connect_stress_CFLAGS = $(AM_CFLAGS)
-connect_stress_LDFLAGS = $(AM_LDFLAGS) $(BINLDFLAGS)
+connect_stress_CFLAGS = $(AM_CFLAGS) $(LIBCHECK_CFLAGS)
+connect_stress_LDFLAGS = $(AM_LDFLAGS) $(BINLDFLAGS) $(LIBCHECK_LIBS)
 
 echo_cancel_test_SOURCES = $(module_echo_cancel_la_SOURCES)
 nodist_echo_cancel_test_SOURCES = $(nodist_module_echo_cancel_la_SOURCES)
diff --git a/src/tests/connect-stress.c b/src/tests/connect-stress.c
index c4c6efc..0cf072d 100644
--- a/src/tests/connect-stress.c
+++ b/src/tests/connect-stress.c
@@ -29,6 +29,8 @@
 #include <stdio.h>
 #include <stdlib.h>
 
+#include <check.h>
+
 #include <pulse/pulseaudio.h>
 #include <pulse/mainloop.h>
 
@@ -47,6 +49,7 @@
 static pa_context *context = NULL;
 static pa_stream *streams[NSTREAMS];
 static pa_threaded_mainloop *mainloop = NULL;
+static char *bname;
 
 static const pa_sample_spec sample_spec = {
     .format = PA_SAMPLE_FLOAT32,
@@ -62,29 +65,29 @@ static void connect(const char *name, int *try) {
 
     /* Set up a new main loop */
     mainloop = pa_threaded_mainloop_new();
-    assert(mainloop);
+    fail_unless(mainloop != NULL);
 
     api = pa_threaded_mainloop_get_api(mainloop);
     context = pa_context_new(api, name);
-    assert(context);
+    fail_unless(context != NULL);
 
     pa_context_set_state_callback(context, context_state_callback, try);
 
     /* Connect the context */
     if (pa_context_connect(context, NULL, 0, NULL) < 0) {
         fprintf(stderr, "pa_context_connect() failed.\n");
-        abort();
+        fail();
     }
 
     ret = pa_threaded_mainloop_start(mainloop);
-    assert(ret == 0);
+    fail_unless(ret == 0);
 }
 
 static void disconnect(void) {
     int i;
 
-    assert(mainloop);
-    assert(context);
+    fail_unless(mainloop != NULL);
+    fail_unless(context != NULL);
 
     pa_threaded_mainloop_lock(mainloop);
 
@@ -125,7 +128,7 @@ static void stream_write_callback(pa_stream *stream, size_t nbytes, void *userda
 }
 
 static void stream_state_callback(pa_stream *s, void *userdata) {
-    assert(s);
+    fail_unless(s != NULL);
 
     switch (pa_stream_get_state(s)) {
         case PA_STREAM_UNCONNECTED:
@@ -137,15 +140,15 @@ static void stream_state_callback(pa_stream *s, void *userdata) {
         default:
         case PA_STREAM_FAILED:
             fprintf(stderr, "Stream error: %s\n", pa_strerror(pa_context_errno(pa_stream_get_context(s))));
-            abort();
+            fail();
     }
 }
 
 static void context_state_callback(pa_context *c, void *userdata) {
     int *try;
 
-    assert(c);
-    assert(userdata);
+    fail_unless(c != NULL);
+    fail_unless(userdata != NULL);
 
     try = (int*)userdata;
 
@@ -165,7 +168,7 @@ static void context_state_callback(pa_context *c, void *userdata) {
 
                 snprintf(name, sizeof(name), "stream #%i", i);
                 streams[i] = pa_stream_new(c, name, &sample_spec, NULL);
-                assert(streams[i]);
+                fail_unless(streams[i] != NULL);
                 pa_stream_set_state_callback(streams[i], stream_state_callback, NULL);
                 pa_stream_set_write_callback(streams[i], stream_write_callback, NULL);
                 pa_stream_connect_playback(streams[i], NULL, &buffer_attr, 0, NULL, NULL);
@@ -183,24 +186,45 @@ static void context_state_callback(pa_context *c, void *userdata) {
         case PA_CONTEXT_FAILED:
         default:
             fprintf(stderr, "Context error: %s\n", pa_strerror(pa_context_errno(c)));
-            abort();
+            fail();
     }
 }
 
-int main(int argc, char *argv[]) {
+START_TEST (connect_stress_test) {
     int i;
 
     for (i = 0; i < NSTREAMS; i++)
         streams[i] = NULL;
 
     for (i = 0; i < NTESTS; i++) {
-        connect(argv[0], &i);
+        connect(bname, &i);
         usleep(rand() % 500000);
         disconnect();
         usleep(rand() % 500000);
     }
 
     fprintf(stderr, "Done.\n");
+}
+END_TEST
+
+int main(int argc, char *argv[]) {
+    int failed = 0;
+    Suite *s;
+    TCase *tc;
+    SRunner *sr;
+
+    bname = argv[0];
+
+    s = suite_create("Connect Stress");
+    tc = tcase_create("connectstress");
+    tcase_add_test(tc, connect_stress_test);
+    tcase_set_timeout(tc, 20 * 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 0;
+    return (failed == 0) ? EXIT_SUCCESS : EXIT_FAILURE;
 }

commit f270fead589f6e9ddc2ec9de4f967298b6e80aec
Author: Deng Zhengrong <dzrongg at gmail.com>
Date:   Sat Jul 28 21:53:58 2012 +0800

    tests: modify queue-test to use 'check' framework

diff --git a/src/Makefile.am b/src/Makefile.am
index 18bccb4..eca874b 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -375,9 +375,9 @@ asyncmsgq_test_LDADD = $(AM_LDADD) libpulsecore- at PA_MAJORMINOR@.la libpulse.la l
 asyncmsgq_test_LDFLAGS = $(AM_LDFLAGS) $(BINLDFLAGS) $(LIBCHECK_LIBS)
 
 queue_test_SOURCES = tests/queue-test.c
-queue_test_CFLAGS = $(AM_CFLAGS)
+queue_test_CFLAGS = $(AM_CFLAGS) $(LIBCHECK_CFLAGS)
 queue_test_LDADD = $(AM_LDADD) libpulsecore- at PA_MAJORMINOR@.la libpulse.la libpulsecommon- at PA_MAJORMINOR@.la
-queue_test_LDFLAGS = $(AM_LDFLAGS) $(BINLDFLAGS)
+queue_test_LDFLAGS = $(AM_LDFLAGS) $(BINLDFLAGS) $(LIBCHECK_LIBS)
 
 rtpoll_test_SOURCES = tests/rtpoll-test.c
 rtpoll_test_CFLAGS = $(AM_CFLAGS)
diff --git a/src/tests/queue-test.c b/src/tests/queue-test.c
index 6b3e895..814645e 100644
--- a/src/tests/queue-test.c
+++ b/src/tests/queue-test.c
@@ -25,21 +25,24 @@
 #include <stdlib.h>
 #include <unistd.h>
 
+#include <check.h>
+
 #include <pulsecore/queue.h>
 #include <pulsecore/log.h>
 #include <pulsecore/macro.h>
 
-int main(int argc, char *argv[]) {
+START_TEST (queue_test) {
     pa_queue *q;
 
-    pa_assert_se(q = pa_queue_new());
+    q = pa_queue_new();
+    fail_unless(q != NULL);
 
-    pa_assert(pa_queue_isempty(q));
+    fail_unless(pa_queue_isempty(q));
 
     pa_queue_push(q, (void*) "eins");
     pa_log("%s\n", (char*) pa_queue_pop(q));
 
-    pa_assert(pa_queue_isempty(q));
+    fail_unless(pa_queue_isempty(q));
 
     pa_queue_push(q, (void*) "zwei");
     pa_queue_push(q, (void*) "drei");
@@ -53,12 +56,30 @@ int main(int argc, char *argv[]) {
     pa_log("%s\n", (char*) pa_queue_pop(q));
     pa_log("%s\n", (char*) pa_queue_pop(q));
 
-    pa_assert(pa_queue_isempty(q));
+    fail_unless(pa_queue_isempty(q));
 
     pa_queue_push(q, (void*) "sechs");
     pa_queue_push(q, (void*) "sieben");
 
     pa_queue_free(q, NULL);
+}
+END_TEST
 
-    return 0;
+int main(int argc, char *argv[]) {
+    int failed = 0;
+    Suite *s;
+    TCase *tc;
+    SRunner *sr;
+
+    s = suite_create("Queue");
+    tc = tcase_create("queue");
+    tcase_add_test(tc, queue_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;
 }

commit 5f8c22e6f193c0f5fb1bf689e0751b19c53d9f2d
Author: Deng Zhengrong <dzrongg at gmail.com>
Date:   Sat Jul 28 21:34:58 2012 +0800

    tests: modify cpulimit-test to use 'check' framework

diff --git a/src/Makefile.am b/src/Makefile.am
index a804627..18bccb4 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -425,14 +425,14 @@ channelmap_test_LDADD = $(AM_LDADD) libpulse.la
 channelmap_test_LDFLAGS = $(AM_LDFLAGS) $(BINLDFLAGS) $(LIBCHECK_LIBS)
 
 cpulimit_test_SOURCES = tests/cpulimit-test.c daemon/cpulimit.c daemon/cpulimit.h
-cpulimit_test_CFLAGS = $(AM_CFLAGS)
+cpulimit_test_CFLAGS = $(AM_CFLAGS) $(LIBCHECK_CFLAGS)
 cpulimit_test_LDADD = $(AM_LDADD) libpulsecore- at PA_MAJORMINOR@.la libpulse.la libpulsecommon- at PA_MAJORMINOR@.la
-cpulimit_test_LDFLAGS = $(AM_LDFLAGS) $(BINLDFLAGS)
+cpulimit_test_LDFLAGS = $(AM_LDFLAGS) $(BINLDFLAGS) $(LIBCHECK_LIBS)
 
 cpulimit_test2_SOURCES = tests/cpulimit-test.c daemon/cpulimit.c daemon/cpulimit.h
-cpulimit_test2_CFLAGS = $(AM_CFLAGS) -DTEST2
+cpulimit_test2_CFLAGS = $(AM_CFLAGS) -DTEST2 $(LIBCHECK_CFLAGS)
 cpulimit_test2_LDADD = $(AM_LDADD) libpulsecore- at PA_MAJORMINOR@.la libpulse.la libpulsecommon- at PA_MAJORMINOR@.la
-cpulimit_test2_LDFLAGS = $(AM_LDFLAGS) $(BINLDFLAGS)
+cpulimit_test2_LDFLAGS = $(AM_LDFLAGS) $(BINLDFLAGS) $(LIBCHECK_LIBS)
 
 mainloop_test_glib_SOURCES = $(mainloop_test_SOURCES)
 mainloop_test_glib_CFLAGS = $(mainloop_test_CFLAGS) $(LIBCHECK_CFLAGS) $(GLIB20_CFLAGS) -DGLIB_MAIN_LOOP
diff --git a/src/tests/cpulimit-test.c b/src/tests/cpulimit-test.c
index 8bd0341..8988c1a 100644
--- a/src/tests/cpulimit-test.c
+++ b/src/tests/cpulimit-test.c
@@ -27,6 +27,8 @@
 #include <stdio.h>
 #include <signal.h>
 
+#include <check.h>
+
 #include <pulse/mainloop.h>
 
 #ifdef TEST2
@@ -48,17 +50,18 @@ static void func(pa_mainloop_api *m, pa_signal_event *e, int sig, void *userdata
     if ((now - start) >= 30) {
         m->quit(m, 1);
         fprintf(stderr, "Test failed\n");
+        fail();
     } else
         raise(SIGUSR1);
 }
 
 #endif
 
-int main(int argc, char *argv[]) {
+START_TEST (cpulimit_test) {
     pa_mainloop *m;
 
     m = pa_mainloop_new();
-    assert(m);
+    fail_unless(m != NULL);
 
     pa_cpu_limit_init(pa_mainloop_get_api(m));
 
@@ -77,6 +80,7 @@ int main(int argc, char *argv[]) {
 
         if ((now - start) >= 30) {
             fprintf(stderr, "Test failed\n");
+            fail();
             break;
         }
     }
@@ -85,6 +89,24 @@ int main(int argc, char *argv[]) {
     pa_cpu_limit_done();
 
     pa_mainloop_free(m);
+}
+END_TEST
 
-    return 0;
+int main(int argc, char *argv[]) {
+    int failed = 0;
+    Suite *s;
+    TCase *tc;
+    SRunner *sr;
+
+    s = suite_create("CPU Limit");
+    tc = tcase_create("cpulimit");
+    tcase_add_test(tc, cpulimit_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;
 }

commit dbf176acbdc4a6dccdd870348cdedf7a9d8d963d
Author: Deng Zhengrong <dzrongg at gmail.com>
Date:   Sat Jul 28 21:25:58 2012 +0800

    tests: modify channelmap-tets to use 'check' framework

diff --git a/src/Makefile.am b/src/Makefile.am
index 63b83fb..a804627 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -420,9 +420,9 @@ volume_test_LDADD = $(AM_LDADD) libpulse.la libpulsecommon- at PA_MAJORMINOR@.la
 volume_test_LDFLAGS = $(AM_LDFLAGS) $(BINLDFLAGS) $(LIBCHECK_LIBS)
 
 channelmap_test_SOURCES = tests/channelmap-test.c
-channelmap_test_CFLAGS = $(AM_CFLAGS)
+channelmap_test_CFLAGS = $(AM_CFLAGS) $(LIBCHECK_CFLAGS)
 channelmap_test_LDADD = $(AM_LDADD) libpulse.la
-channelmap_test_LDFLAGS = $(AM_LDFLAGS) $(BINLDFLAGS)
+channelmap_test_LDFLAGS = $(AM_LDFLAGS) $(BINLDFLAGS) $(LIBCHECK_LIBS)
 
 cpulimit_test_SOURCES = tests/cpulimit-test.c daemon/cpulimit.c daemon/cpulimit.h
 cpulimit_test_CFLAGS = $(AM_CFLAGS)
diff --git a/src/tests/channelmap-test.c b/src/tests/channelmap-test.c
index 70d6a6a..eb0187c 100644
--- a/src/tests/channelmap-test.c
+++ b/src/tests/channelmap-test.c
@@ -2,12 +2,15 @@
 #include <config.h>
 #endif
 
+#include <stdlib.h>
 #include <stdio.h>
 #include <assert.h>
 
+#include <check.h>
+
 #include <pulse/channelmap.h>
 
-int main(int argc, char *argv[]) {
+START_TEST (channelmap_test) {
     char cm[PA_CHANNEL_MAP_SNPRINT_MAX];
     pa_channel_map map, map2;
 
@@ -29,9 +32,27 @@ int main(int argc, char *argv[]) {
 
     pa_channel_map_parse(&map2, cm);
 
-    assert(pa_channel_map_equal(&map, &map2));
+    fail_unless(pa_channel_map_equal(&map, &map2));
 
     pa_channel_map_parse(&map2, "left,test");
+}
+END_TEST
 
-    return 0;
+int main(int argc, char *argv[]) {
+    int failed = 0;
+    Suite *s;
+    TCase *tc;
+    SRunner *sr;
+
+    s = suite_create("Channel Map");
+    tc = tcase_create("channelmap");
+    tcase_add_test(tc, channelmap_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;
 }

commit d746225b9829bd1b1d506d4d7da89a8652262389
Author: Deng Zhengrong <dzrongg at gmail.com>
Date:   Sat Jul 28 21:22:05 2012 +0800

    tests: modify asyncq-test to use 'check' framework

diff --git a/src/Makefile.am b/src/Makefile.am
index 62b4670..63b83fb 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -365,9 +365,9 @@ flist_test_LDADD = $(AM_LDADD) libpulsecore- at PA_MAJORMINOR@.la libpulse.la libpu
 flist_test_LDFLAGS = $(AM_LDFLAGS) $(BINLDFLAGS)
 
 asyncq_test_SOURCES = tests/asyncq-test.c
-asyncq_test_CFLAGS = $(AM_CFLAGS)
+asyncq_test_CFLAGS = $(AM_CFLAGS) $(LIBCHECK_CFLAGS)
 asyncq_test_LDADD = $(AM_LDADD) libpulsecore- at PA_MAJORMINOR@.la libpulse.la libpulsecommon- at PA_MAJORMINOR@.la
-asyncq_test_LDFLAGS = $(AM_LDFLAGS) $(BINLDFLAGS)
+asyncq_test_LDFLAGS = $(AM_LDFLAGS) $(BINLDFLAGS) $(LIBCHECK_LIBS)
 
 asyncmsgq_test_SOURCES = tests/asyncmsgq-test.c
 asyncmsgq_test_CFLAGS = $(AM_CFLAGS) $(LIBCHECK_CFLAGS)
diff --git a/src/tests/asyncq-test.c b/src/tests/asyncq-test.c
index 6ac8cba..7abfb89 100644
--- a/src/tests/asyncq-test.c
+++ b/src/tests/asyncq-test.c
@@ -25,6 +25,8 @@
 #include <stdlib.h>
 #include <unistd.h>
 
+#include <check.h>
+
 #include <pulse/util.h>
 #include <pulsecore/asyncq.h>
 #include <pulsecore/thread.h>
@@ -57,7 +59,7 @@ static void consumer(void *_q) {
         if (p == PA_UINT_TO_PTR(-1))
             break;
 
-        pa_assert(p == PA_UINT_TO_PTR(i+1));
+        fail_unless(p == PA_UINT_TO_PTR(i+1));
 
         pa_log_debug("popped %i", i);
     }
@@ -65,22 +67,43 @@ static void consumer(void *_q) {
     pa_log_debug("popped end");
 }
 
-int main(int argc, char *argv[]) {
+START_TEST (asyncq_test) {
     pa_asyncq *q;
     pa_thread *t1, *t2;
 
     if (!getenv("MAKE_CHECK"))
         pa_log_set_level(PA_LOG_DEBUG);
 
-    pa_assert_se(q = pa_asyncq_new(0));
+    q = pa_asyncq_new(0);
+    fail_unless(q != NULL);
 
-    pa_assert_se(t1 = pa_thread_new("producer", producer, q));
-    pa_assert_se(t2 = pa_thread_new("consumer", consumer, q));
+    t1 = pa_thread_new("producer", producer, q);
+    fail_unless(t1 != NULL);
+    t2 = pa_thread_new("consumer", consumer, q);
+    fail_unless(t2 != NULL);
 
     pa_thread_free(t1);
     pa_thread_free(t2);
 
     pa_asyncq_free(q, NULL);
+}
+END_TEST
 
-    return 0;
+int main(int argc, char *argv[]) {
+    int failed = 0;
+    Suite *s;
+    TCase *tc;
+    SRunner *sr;
+
+    s = suite_create("Async Queue");
+    tc = tcase_create("asyncq");
+    tcase_add_test(tc, asyncq_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;
 }

commit 86289903652b05a16bbe1102de26df52a3985e7d
Author: Deng Zhengrong <dzrongg at gmail.com>
Date:   Sat Jul 28 21:16:31 2012 +0800

    tests: modify asyncmsgq-test to new 'check' framework

diff --git a/src/Makefile.am b/src/Makefile.am
index a12faf2..62b4670 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -370,9 +370,9 @@ asyncq_test_LDADD = $(AM_LDADD) libpulsecore- at PA_MAJORMINOR@.la libpulse.la libp
 asyncq_test_LDFLAGS = $(AM_LDFLAGS) $(BINLDFLAGS)
 
 asyncmsgq_test_SOURCES = tests/asyncmsgq-test.c
-asyncmsgq_test_CFLAGS = $(AM_CFLAGS)
+asyncmsgq_test_CFLAGS = $(AM_CFLAGS) $(LIBCHECK_CFLAGS)
 asyncmsgq_test_LDADD = $(AM_LDADD) libpulsecore- at PA_MAJORMINOR@.la libpulse.la libpulsecommon- at PA_MAJORMINOR@.la
-asyncmsgq_test_LDFLAGS = $(AM_LDFLAGS) $(BINLDFLAGS)
+asyncmsgq_test_LDFLAGS = $(AM_LDFLAGS) $(BINLDFLAGS) $(LIBCHECK_LIBS)
 
 queue_test_SOURCES = tests/queue-test.c
 queue_test_CFLAGS = $(AM_CFLAGS)
diff --git a/src/tests/asyncmsgq-test.c b/src/tests/asyncmsgq-test.c
index 9fbe5bc..3bba753 100644
--- a/src/tests/asyncmsgq-test.c
+++ b/src/tests/asyncmsgq-test.c
@@ -25,6 +25,8 @@
 #include <stdlib.h>
 #include <unistd.h>
 
+#include <check.h>
+
 #include <pulsecore/asyncmsgq.h>
 #include <pulsecore/thread.h>
 #include <pulsecore/log.h>
@@ -71,13 +73,15 @@ static void the_thread(void *_q) {
     } while (!quit);
 }
 
-int main(int argc, char *argv[]) {
+START_TEST (asyncmsgq_test) {
     pa_asyncmsgq *q;
     pa_thread *t;
 
-    pa_assert_se(q = pa_asyncmsgq_new(0));
+    q = pa_asyncmsgq_new(0);
+    fail_unless(q != NULL);
 
-    pa_assert_se(t = pa_thread_new("test", the_thread, q));
+    t = pa_thread_new("test", the_thread, q);
+    fail_unless(t != NULL);
 
     pa_log_info("Operation A post");
     pa_asyncmsgq_post(q, NULL, OPERATION_A, NULL, 0, NULL, NULL);
@@ -100,6 +104,24 @@ int main(int argc, char *argv[]) {
     pa_thread_free(t);
 
     pa_asyncmsgq_unref(q);
+}
+END_TEST
 
-    return 0;
+int main(int argc, char *argv[]) {
+    int failed = 0;
+    Suite *s;
+    TCase *tc;
+    SRunner *sr;
+
+    s = suite_create("Async Message Queue");
+    tc = tcase_create("asyncmsgq");
+    tcase_add_test(tc, asyncmsgq_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;
 }

commit 1569601864af375c3788fbce429b6773bd48072e
Author: Deng Zhengrong <dzrongg at gmail.com>
Date:   Sat Jul 28 21:08:49 2012 +0800

    tests: modify alsa-time-test to use 'check' framework

diff --git a/src/Makefile.am b/src/Makefile.am
index d01c80d..a12faf2 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -516,8 +516,8 @@ gtk_test_LDFLAGS = $(AM_LDFLAGS) $(BINLDFLAGS)
 
 alsa_time_test_SOURCES = tests/alsa-time-test.c
 alsa_time_test_LDADD = $(AM_LDADD) $(ASOUNDLIB_LIBS)
-alsa_time_test_CFLAGS = $(AM_CFLAGS) $(ASOUNDLIB_CFLAGS)
-alsa_time_test_LDFLAGS = $(AM_LDFLAGS) $(BINLDFLAGS)
+alsa_time_test_CFLAGS = $(AM_CFLAGS) $(ASOUNDLIB_CFLAGS) $(LIBCHECK_CFLAGS)
+alsa_time_test_LDFLAGS = $(AM_LDFLAGS) $(BINLDFLAGS) $(LIBCHECK_LIBS)
 
 usergroup_test_SOURCES = tests/usergroup-test.c
 usergroup_test_LDADD = $(AM_LDADD) libpulsecore- at PA_MAJORMINOR@.la libpulse.la libpulsecommon- at PA_MAJORMINOR@.la
diff --git a/src/tests/alsa-time-test.c b/src/tests/alsa-time-test.c
index ab194ee..a7cd938 100644
--- a/src/tests/alsa-time-test.c
+++ b/src/tests/alsa-time-test.c
@@ -6,17 +6,21 @@
 #include <inttypes.h>
 #include <time.h>
 
+#include <check.h>
+
 #include <alsa/asoundlib.h>
 
+static const char *dev;
+static int cap;
+
 static uint64_t timespec_us(const struct timespec *ts) {
     return
         ts->tv_sec * 1000000LLU +
         ts->tv_nsec / 1000LLU;
 }
 
-int main(int argc, char *argv[]) {
-    const char *dev;
-    int r, cap;
+START_TEST (alsa_time_test) {
+    int r;
     snd_pcm_hw_params_t *hwparams;
     snd_pcm_sw_params_t *swparams;
     snd_pcm_status_t *status;
@@ -37,100 +41,97 @@ int main(int argc, char *argv[]) {
     snd_pcm_status_alloca(&status);
 
     r = clock_gettime(CLOCK_MONOTONIC, &start);
-    assert(r == 0);
+    fail_unless(r == 0);
 
     start_us = timespec_us(&start);
 
-    dev = argc > 1 ? argv[1] : "front:AudioPCI";
-    cap = argc > 2 ? atoi(argv[2]) : 0;
-
     if (cap == 0)
       r = snd_pcm_open(&pcm, dev, SND_PCM_STREAM_PLAYBACK, 0);
     else
       r = snd_pcm_open(&pcm, dev, SND_PCM_STREAM_CAPTURE, 0);
-    assert(r == 0);
+    fail_unless(r == 0);
 
     r = snd_pcm_hw_params_any(pcm, hwparams);
-    assert(r == 0);
+    fail_unless(r == 0);
 
     r = snd_pcm_hw_params_set_rate_resample(pcm, hwparams, 0);
-    assert(r == 0);
+    fail_unless(r == 0);
 
     r = snd_pcm_hw_params_set_access(pcm, hwparams, SND_PCM_ACCESS_RW_INTERLEAVED);
-    assert(r == 0);
+    fail_unless(r == 0);
 
     r = snd_pcm_hw_params_set_format(pcm, hwparams, SND_PCM_FORMAT_S16_LE);
-    assert(r == 0);
+    fail_unless(r == 0);
 
     r = snd_pcm_hw_params_set_rate_near(pcm, hwparams, &rate, NULL);
-    assert(r == 0);
+    fail_unless(r == 0);
 
     r = snd_pcm_hw_params_set_channels(pcm, hwparams, 2);
-    assert(r == 0);
+    fail_unless(r == 0);
 
     r = snd_pcm_hw_params_set_periods_integer(pcm, hwparams);
-    assert(r == 0);
+    fail_unless(r == 0);
 
     r = snd_pcm_hw_params_set_periods_near(pcm, hwparams, &periods, &dir);
-    assert(r == 0);
+    fail_unless(r == 0);
 
     r = snd_pcm_hw_params_set_buffer_size_near(pcm, hwparams, &buffer_size);
-    assert(r == 0);
+    fail_unless(r == 0);
 
     r = snd_pcm_hw_params(pcm, hwparams);
-    assert(r == 0);
+    fail_unless(r == 0);
 
     r = snd_pcm_hw_params_current(pcm, hwparams);
-    assert(r == 0);
+    fail_unless(r == 0);
 
     r = snd_pcm_sw_params_current(pcm, swparams);
-    assert(r == 0);
+    fail_unless(r == 0);
 
     if (cap == 0)
       r = snd_pcm_sw_params_set_avail_min(pcm, swparams, 1);
     else
       r = snd_pcm_sw_params_set_avail_min(pcm, swparams, 0);
-    assert(r == 0);
+    fail_unless(r == 0);
 
     r = snd_pcm_sw_params_set_period_event(pcm, swparams, 0);
-    assert(r == 0);
+    fail_unless(r == 0);
 
     r = snd_pcm_hw_params_get_buffer_size(hwparams, &buffer_size);
-    assert(r == 0);
+    fail_unless(r == 0);
     r = snd_pcm_sw_params_set_start_threshold(pcm, swparams, buffer_size);
-    assert(r == 0);
+    fail_unless(r == 0);
 
     r = snd_pcm_sw_params_get_boundary(swparams, &boundary);
-    assert(r == 0);
+    fail_unless(r == 0);
     r = snd_pcm_sw_params_set_stop_threshold(pcm, swparams, boundary);
-    assert(r == 0);
+    fail_unless(r == 0);
 
     r = snd_pcm_sw_params_set_tstamp_mode(pcm, swparams, SND_PCM_TSTAMP_ENABLE);
-    assert(r == 0);
+    fail_unless(r == 0);
 
     r = snd_pcm_sw_params(pcm, swparams);
-    assert(r == 0);
+    fail_unless(r == 0);
 
     r = snd_pcm_prepare(pcm);
-    assert(r == 0);
+    fail_unless(r == 0);
 
     r = snd_pcm_sw_params_current(pcm, swparams);
-    assert(r == 0);
+    fail_unless(r == 0);
 
-/*     assert(snd_pcm_hw_params_is_monotonic(hwparams) > 0); */
+/*     fail_unless(snd_pcm_hw_params_is_monotonic(hwparams) > 0); */
 
     n_pollfd = snd_pcm_poll_descriptors_count(pcm);
-    assert(n_pollfd > 0);
+    fail_unless(n_pollfd > 0);
 
     pollfds = malloc(sizeof(struct pollfd) * n_pollfd);
-    assert(pollfds);
+    fail_unless(pollfds != NULL);
 
     r = snd_pcm_poll_descriptors(pcm, pollfds, n_pollfd);
-    assert(r == n_pollfd);
+    fail_unless(r == n_pollfd);
 
     if (cap) {
       r = snd_pcm_start(pcm);
-      assert(r == 0);
+      fail_unless(r == 0);
     }
 
     for (;;) {
@@ -143,24 +144,24 @@ int main(int argc, char *argv[]) {
         unsigned long long pos;
 
         r = poll(pollfds, n_pollfd, 0);
-        assert(r >= 0);
+        fail_unless(r >= 0);
 
         r = snd_pcm_poll_descriptors_revents(pcm, pollfds, n_pollfd, &revents);
-        assert(r == 0);
+        fail_unless(r == 0);
 
         if (cap == 0)
-          assert((revents & ~POLLOUT) == 0);
+          fail_unless((revents & ~POLLOUT) == 0);
         else
-          assert((revents & ~POLLIN) == 0);
+          fail_unless((revents & ~POLLIN) == 0);
 
         avail = snd_pcm_avail(pcm);
-        assert(avail >= 0);
+        fail_unless(avail >= 0);
 
         r = snd_pcm_status(pcm, status);
-        assert(r == 0);
+        fail_unless(r == 0);
 
         /* This assertion fails from time to time. ALSA seems to be broken */
-/*         assert(avail == (snd_pcm_sframes_t) snd_pcm_status_get_avail(status)); */
+/*         fail_unless(avail == (snd_pcm_sframes_t) snd_pcm_status_get_avail(status)); */
 /*         printf("%lu %lu\n", (unsigned long) avail, (unsigned long) snd_pcm_status_get_avail(status)); */
 
         snd_pcm_status_get_htstamp(status, &timestamp);
@@ -168,9 +169,9 @@ int main(int argc, char *argv[]) {
         state = snd_pcm_status_get_state(status);
 
         r = clock_gettime(CLOCK_MONOTONIC, &now);
-        assert(r == 0);
+        fail_unless(r == 0);
 
-        assert(!revents || avail > 0);
+        fail_unless(!revents || avail > 0);
 
         if ((!cap && avail) || (cap && (unsigned)avail >= buffer_size)) {
             snd_pcm_sframes_t sframes;
@@ -181,7 +182,7 @@ int main(int argc, char *argv[]) {
               sframes = snd_pcm_writei(pcm, psamples, 1);
             else
               sframes = snd_pcm_readi(pcm, csamples, 1);
-            assert(sframes == 1);
+            fail_unless(sframes == 1);
 
             handled = 1;
             sample_count++;
@@ -215,14 +216,35 @@ int main(int argc, char *argv[]) {
                state);
 
         if (cap == 0)
-          /** When this assert is hit, most likely something bad
+          /** When this fail_unless is hit, most likely something bad
            * happened, i.e. the avail jumped suddenly. */
-          assert((unsigned) avail <= buffer_size);
+          fail_unless((unsigned) avail <= buffer_size);
 
         last_avail = avail;
         last_delay = delay;
         last_timestamp = timestamp;
     }
+}
+END_TEST
+
+int main(int argc, char *argv[]) {
+    int failed = 0;
+    Suite *s;
+    TCase *tc;
+    SRunner *sr;
+
+    dev = argc > 1 ? argv[1] : "front:AudioPCI";
+    cap = argc > 2 ? atoi(argv[2]) : 0;
+
+    s = suite_create("ALSA Time");
+    tc = tcase_create("alsatime");
+    tcase_add_test(tc, alsa_time_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 0;
+    return (failed == 0) ? EXIT_SUCCESS : EXIT_FAILURE;
 }

commit 4d5c85cfa2ff8f730d99d66a6df7ff4561e31601
Author: Deng Zhengrong <dzrongg at gmail.com>
Date:   Sat Jul 28 18:07:28 2012 +0800

    tests: modify thread-mainloop-test to use 'check' framework

diff --git a/src/Makefile.am b/src/Makefile.am
index 7b0d057..d01c80d 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -315,9 +315,9 @@ mainloop_test_LDADD = $(AM_LDADD) libpulse.la libpulsecommon- at PA_MAJORMINOR@.la
 mainloop_test_LDFLAGS = $(AM_LDFLAGS) $(BINLDFLAGS) $(LIBCHECK_LIBS)
 
 thread_mainloop_test_SOURCES = tests/thread-mainloop-test.c
-thread_mainloop_test_CFLAGS = $(AM_CFLAGS)
+thread_mainloop_test_CFLAGS = $(AM_CFLAGS) $(LIBCHECK_CFLAGS)
 thread_mainloop_test_LDADD = $(AM_LDADD) libpulsecore- at PA_MAJORMINOR@.la libpulse.la libpulsecommon- at PA_MAJORMINOR@.la
-thread_mainloop_test_LDFLAGS = $(AM_LDFLAGS) $(BINLDFLAGS)
+thread_mainloop_test_LDFLAGS = $(AM_LDFLAGS) $(BINLDFLAGS) $(LIBCHECK_LIBS)
 
 utf8_test_SOURCES = tests/utf8-test.c
 utf8_test_CFLAGS = $(AM_CFLAGS) $(LIBCHECK_CFLAGS)
diff --git a/src/tests/thread-mainloop-test.c b/src/tests/thread-mainloop-test.c
index 599f195..d2f6152 100644
--- a/src/tests/thread-mainloop-test.c
+++ b/src/tests/thread-mainloop-test.c
@@ -25,6 +25,8 @@
 #include <unistd.h>
 #include <stdio.h>
 
+#include <check.h>
+
 #include <pulse/rtclock.h>
 #include <pulse/timeval.h>
 #include <pulse/util.h>
@@ -40,19 +42,21 @@ static void tcb(pa_mainloop_api *a, pa_time_event *e, const struct timeval *tv,
     fprintf(stderr, "TIME EVENT END\n");
 }
 
-int main(int argc, char *argv[]) {
+START_TEST (thread_mainloop_test) {
     pa_mainloop_api *a;
     pa_threaded_mainloop *m;
     struct timeval tv;
 
-    pa_assert_se(m = pa_threaded_mainloop_new());
-    pa_assert_se(a = pa_threaded_mainloop_get_api(m));
+    m = pa_threaded_mainloop_new();
+    fail_unless(m != NULL);
+    a = pa_threaded_mainloop_get_api(m);
+    fail_unless(m != NULL);
 
-    pa_assert_se(pa_threaded_mainloop_start(m) >= 0);
+    fail_unless(pa_threaded_mainloop_start(m) >= 0);
 
     pa_threaded_mainloop_lock(m);
 
-    pa_assert_se(!pa_threaded_mainloop_in_thread(m));
+    fail_unless(!pa_threaded_mainloop_in_thread(m));
 
     a->time_new(a, pa_timeval_rtstore(&tv, pa_rtclock_now() + 5 * PA_USEC_PER_SEC, TRUE), tcb, m);
 
@@ -70,5 +74,28 @@ int main(int argc, char *argv[]) {
     pa_threaded_mainloop_stop(m);
 
     pa_threaded_mainloop_free(m);
-    return 0;
+}
+END_TEST
+
+int main(int argc, char *argv[]) {
+    int failed = 0;
+    Suite *s;
+    TCase *tc;
+    SRunner *sr;
+
+    s = suite_create("Thread MainLoop");
+    tc = tcase_create("threadmainloop");
+    tcase_add_test(tc, thread_mainloop_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;
 }

commit ca104d34677461de1f96d2a9534e417ccf41e078
Author: Deng Zhengrong <dzrongg at gmail.com>
Date:   Sat Jul 28 18:01:41 2012 +0800

    tests: modify thread-test to use 'check' framework

diff --git a/src/Makefile.am b/src/Makefile.am
index 3038055..7b0d057 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -350,9 +350,9 @@ memblock_test_LDADD = $(AM_LDADD) libpulsecore- at 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- at PA_MAJORMINOR@.la libpulse.la libpulsecommon- at 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 6441dc7..de4813c 100644
--- a/src/tests/thread-test.c
+++ b/src/tests/thread-test.c
@@ -21,6 +21,8 @@
 #include <config.h>
 #endif
 
+#include <check.h>
+
 #include <pulse/xmalloc.h>
 #include <pulsecore/thread.h>
 #include <pulsecore/macro.h>
@@ -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);
+}
+END_TEST
 
-    return 0;
+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;
 }

commit a5b438f8257e16c01371cb697dc242f5026b6b0d
Author: Deng Zhengrong <dzrongg at gmail.com>
Date:   Sat Jul 28 17:45:50 2012 +0800

    tests: modify get-binary-name-test to use 'check' framework

diff --git a/src/Makefile.am b/src/Makefile.am
index 6918935..3038055 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -330,9 +330,9 @@ format_test_LDADD = $(AM_LDADD) libpulsecore- at PA_MAJORMINOR@.la libpulse.la libp
 format_test_LDFLAGS = $(AM_LDFLAGS) $(BINLDFLAGS) $(LIBCHECK_LIBS)
 
 get_binary_name_test_SOURCES = tests/get-binary-name-test.c
-get_binary_name_test_CFLAGS = $(AM_CFLAGS)
+get_binary_name_test_CFLAGS = $(AM_CFLAGS) $(LIBCHECK_CFLAGS)
 get_binary_name_test_LDADD = $(AM_LDADD) libpulse.la libpulsecommon- at PA_MAJORMINOR@.la
-get_binary_name_test_LDFLAGS = $(AM_LDFLAGS) $(BINLDFLAGS)
+get_binary_name_test_LDFLAGS = $(AM_LDFLAGS) $(BINLDFLAGS) $(LIBCHECK_LIBS)
 
 ipacl_test_SOURCES = tests/ipacl-test.c
 ipacl_test_CFLAGS = $(AM_CFLAGS)
diff --git a/src/tests/get-binary-name-test.c b/src/tests/get-binary-name-test.c
index 7a09bc2..5d781c9 100644
--- a/src/tests/get-binary-name-test.c
+++ b/src/tests/get-binary-name-test.c
@@ -24,12 +24,14 @@
 #include <stdio.h>
 #include <string.h>
 
+#include <check.h>
+
 #include <pulse/util.h>
 #include <pulse/xmalloc.h>
 
 #include <pulsecore/log.h>
 
-int main(int argc, char *argv[]) {
+START_TEST (getbinaryname_test) {
     char *exename;
     size_t allocated = 128;
 
@@ -39,18 +41,36 @@ int main(int argc, char *argv[]) {
         if (!pa_get_binary_name(exename, allocated)) {
             pa_log_error("failed to read binary name");
             pa_xfree(exename);
-            break;
+            fail();
         }
 
         if (strlen(exename) < allocated - 1) {
             pa_log("%s", exename);
             pa_xfree(exename);
-            return 0;
+            return;
         }
 
         pa_xfree(exename);
         allocated *= 2;
     }
+}
+END_TEST
+
+int main(int argc, char *argv[]) {
+    int failed = 0;
+    Suite *s;
+    TCase *tc;
+    SRunner *sr;
+
+    s = suite_create("Binary Name");
+    tc = tcase_create("getbinaryname");
+    tcase_add_test(tc, getbinaryname_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 1;
+    return (failed == 0) ? EXIT_SUCCESS : EXIT_FAILURE;
 }

commit 8efef1e097aa0715a24b5a9e11703387cceae0c8
Author: Deng Zhengrong <dzrongg at gmail.com>
Date:   Sat Jul 28 17:25:16 2012 +0800

    tests: modify format-test to use 'check' framework

diff --git a/src/Makefile.am b/src/Makefile.am
index fcb6621..6918935 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -325,9 +325,9 @@ utf8_test_LDADD = $(AM_LDADD) libpulse.la libpulsecommon- at PA_MAJORMINOR@.la
 utf8_test_LDFLAGS = $(AM_LDFLAGS) $(BINLDFLAGS) $(LIBCHECK_LIBS)
 
 format_test_SOURCES = tests/format-test.c
-format_test_CFLAGS = $(AM_CFLAGS)
+format_test_CFLAGS = $(AM_CFLAGS) $(LIBCHECK_CFLAGS)
 format_test_LDADD = $(AM_LDADD) libpulsecore- at PA_MAJORMINOR@.la libpulse.la libpulsecommon- at PA_MAJORMINOR@.la
-format_test_LDFLAGS = $(AM_LDFLAGS) $(BINLDFLAGS)
+format_test_LDFLAGS = $(AM_LDFLAGS) $(BINLDFLAGS) $(LIBCHECK_LIBS)
 
 get_binary_name_test_SOURCES = tests/get-binary-name-test.c
 get_binary_name_test_CFLAGS = $(AM_CFLAGS)
diff --git a/src/tests/format-test.c b/src/tests/format-test.c
index bb66c85..5e7d587 100644
--- a/src/tests/format-test.c
+++ b/src/tests/format-test.c
@@ -23,6 +23,8 @@
 
 #include <stdlib.h>
 
+#include <check.h>
+
 #include <pulsecore/macro.h>
 #include <pulsecore/core-util.h>
 #include <pulse/format.h>
@@ -32,7 +34,7 @@
 #define DEINIT(f) pa_format_info_free(f);
 #define REINIT(f) { DEINIT(f); INIT(f); }
 
-int main(int argc, char *argv[]) {
+START_TEST (format_test) {
     pa_format_info *f1 = NULL, *f2 = NULL;
     int rates1[] = { 32000, 44100, 48000 }, i, temp_int1 = -1, temp_int2 = -1, *temp_int_array;
     const char *strings[] = { "thing1", "thing2", "thing3" };
@@ -44,7 +46,7 @@ int main(int argc, char *argv[]) {
     pa_format_info_set_prop_int(f1, PA_PROP_FORMAT_RATE, 32000);
     f2->encoding = PA_ENCODING_AC3_IEC61937;
     pa_format_info_set_prop_int(f2, PA_PROP_FORMAT_RATE, 44100);
-    pa_assert(!pa_format_info_is_compatible(f1, f2));
+    fail_unless(!pa_format_info_is_compatible(f1, f2));
 
     /* 2. Check int array membership - positive */
     REINIT(f1); REINIT(f2);
@@ -52,15 +54,15 @@ int main(int argc, char *argv[]) {
     pa_format_info_set_prop_int_array(f1, PA_PROP_FORMAT_RATE, rates1, PA_ELEMENTSOF(rates1));
     f2->encoding = PA_ENCODING_AC3_IEC61937;
     pa_format_info_set_prop_int(f2, PA_PROP_FORMAT_RATE, 44100);
-    pa_assert(pa_format_info_is_compatible(f1, f2));
-    pa_assert(pa_format_info_is_compatible(f2, f1));
+    fail_unless(pa_format_info_is_compatible(f1, f2));
+    fail_unless(pa_format_info_is_compatible(f2, f1));
 
     /* 3. Check int array membership - negative */
     REINIT(f2);
     f2->encoding = PA_ENCODING_AC3_IEC61937;
     pa_format_info_set_prop_int(f2, PA_PROP_FORMAT_RATE, 96000);
-    pa_assert(!pa_format_info_is_compatible(f1, f2));
-    pa_assert(!pa_format_info_is_compatible(f2, f1));
+    fail_unless(!pa_format_info_is_compatible(f1, f2));
+    fail_unless(!pa_format_info_is_compatible(f2, f1));
 
     /* 4. Check int range - positive */
     REINIT(f1); REINIT(f2);
@@ -68,15 +70,15 @@ int main(int argc, char *argv[]) {
     pa_format_info_set_prop_int_range(f1, PA_PROP_FORMAT_RATE, 32000, 48000);
     f2->encoding = PA_ENCODING_AC3_IEC61937;
     pa_format_info_set_prop_int(f2, PA_PROP_FORMAT_RATE, 44100);
-    pa_assert(pa_format_info_is_compatible(f1, f2));
-    pa_assert(pa_format_info_is_compatible(f2, f1));
+    fail_unless(pa_format_info_is_compatible(f1, f2));
+    fail_unless(pa_format_info_is_compatible(f2, f1));
 
     /* 5. Check int range - negative */
     REINIT(f2);
     f2->encoding = PA_ENCODING_AC3_IEC61937;
     pa_format_info_set_prop_int(f2, PA_PROP_FORMAT_RATE, 96000);
-    pa_assert(!pa_format_info_is_compatible(f1, f2));
-    pa_assert(!pa_format_info_is_compatible(f2, f1));
+    fail_unless(!pa_format_info_is_compatible(f1, f2));
+    fail_unless(!pa_format_info_is_compatible(f2, f1));
 
     /* 6. Simple fixed format string check */
     REINIT(f1); REINIT(f2);
@@ -84,7 +86,7 @@ int main(int argc, char *argv[]) {
     pa_format_info_set_prop_string(f1, "format.test_string", "thing1");
     f2->encoding = PA_ENCODING_AC3_IEC61937;
     pa_format_info_set_prop_string(f2, "format.test_string", "notthing1");
-    pa_assert(!pa_format_info_is_compatible(f1, f2));
+    fail_unless(!pa_format_info_is_compatible(f1, f2));
 
     /* 7. Check string array membership - positive */
     REINIT(f1); REINIT(f2);
@@ -92,22 +94,22 @@ int main(int argc, char *argv[]) {
     pa_format_info_set_prop_string_array(f1, "format.test_string", strings, PA_ELEMENTSOF(strings));
     f2->encoding = PA_ENCODING_AC3_IEC61937;
     pa_format_info_set_prop_string(f2, "format.test_string", "thing3");
-    pa_assert(pa_format_info_is_compatible(f1, f2));
-    pa_assert(pa_format_info_is_compatible(f2, f1));
+    fail_unless(pa_format_info_is_compatible(f1, f2));
+    fail_unless(pa_format_info_is_compatible(f2, f1));
 
     /* 8. Check string array membership - negative */
     REINIT(f2);
     f2->encoding = PA_ENCODING_AC3_IEC61937;
     pa_format_info_set_prop_string(f2, "format.test_string", "thing5");
-    pa_assert(!pa_format_info_is_compatible(f1, f2));
-    pa_assert(!pa_format_info_is_compatible(f2, f1));
+    fail_unless(!pa_format_info_is_compatible(f1, f2));
+    fail_unless(!pa_format_info_is_compatible(f2, f1));
 
     /* 9. Verify setting/getting an int */
     REINIT(f1);
     pa_format_info_set_prop_int(f1, "format.test_string", 42);
-    pa_assert(pa_format_info_get_prop_type(f1, "format.test_string") == PA_PROP_TYPE_INT);
-    pa_assert(pa_format_info_get_prop_int(f1, "format.test_string", &temp_int1) == 0);
-    pa_assert(temp_int1 == 42);
+    fail_unless(pa_format_info_get_prop_type(f1, "format.test_string") == PA_PROP_TYPE_INT);
+    fail_unless(pa_format_info_get_prop_int(f1, "format.test_string", &temp_int1) == 0);
+    fail_unless(temp_int1 == 42);
 
     /* 10. Verify setting/getting an int range */
     REINIT(f1);
@@ -119,33 +121,51 @@ int main(int argc, char *argv[]) {
     /* 11. Verify setting/getting an int array */
     REINIT(f1);
     pa_format_info_set_prop_int_array(f1, "format.test_string", rates1, PA_ELEMENTSOF(rates1));
-    pa_assert(pa_format_info_get_prop_type(f1, "format.test_string") == PA_PROP_TYPE_INT_ARRAY);
-    pa_assert(pa_format_info_get_prop_int_array(f1, "format.test_string", &temp_int_array, &temp_int1) == 0);
-    pa_assert(temp_int1 == PA_ELEMENTSOF(rates1));
+    fail_unless(pa_format_info_get_prop_type(f1, "format.test_string") == PA_PROP_TYPE_INT_ARRAY);
+    fail_unless(pa_format_info_get_prop_int_array(f1, "format.test_string", &temp_int_array, &temp_int1) == 0);
+    fail_unless(temp_int1 == PA_ELEMENTSOF(rates1));
     for (i = 0; i < temp_int1; i++)
-        pa_assert(temp_int_array[i] == rates1[i]);
+        fail_unless(temp_int_array[i] == rates1[i]);
     pa_xfree(temp_int_array);
 
     /* 12. Verify setting/getting a string */
     REINIT(f1);
     pa_format_info_set_prop_string(f1, "format.test_string", "foo");
-    pa_assert(pa_format_info_get_prop_type(f1, "format.test_string") == PA_PROP_TYPE_STRING);
-    pa_assert(pa_format_info_get_prop_string(f1, "format.test_string", &temp_str) == 0);
-    pa_assert(pa_streq(temp_str, "foo"));
+    fail_unless(pa_format_info_get_prop_type(f1, "format.test_string") == PA_PROP_TYPE_STRING);
+    fail_unless(pa_format_info_get_prop_string(f1, "format.test_string", &temp_str) == 0);
+    fail_unless(pa_streq(temp_str, "foo"));
     pa_xfree(temp_str);
 
     /* 13. Verify setting/getting an int array */
     REINIT(f1);
     pa_format_info_set_prop_string_array(f1, "format.test_string", strings, PA_ELEMENTSOF(strings));
-    pa_assert(pa_format_info_get_prop_type(f1, "format.test_string") == PA_PROP_TYPE_STRING_ARRAY);
-    pa_assert(pa_format_info_get_prop_string_array(f1, "format.test_string", &temp_str_array, &temp_int1) == 0);
-    pa_assert(temp_int1 == PA_ELEMENTSOF(strings));
+    fail_unless(pa_format_info_get_prop_type(f1, "format.test_string") == PA_PROP_TYPE_STRING_ARRAY);
+    fail_unless(pa_format_info_get_prop_string_array(f1, "format.test_string", &temp_str_array, &temp_int1) == 0);
+    fail_unless(temp_int1 == PA_ELEMENTSOF(strings));
     for (i = 0; i < temp_int1; i++)
-        pa_assert(pa_streq(temp_str_array[i], strings[i]));
+        fail_unless(pa_streq(temp_str_array[i], strings[i]));
     pa_format_info_free_string_array(temp_str_array, temp_int1);
 
     DEINIT(f1);
     DEINIT(f2);
+}
+END_TEST
 
-    return 0;
+int main(int argc, char *argv[]) {
+    int failed = 0;
+    Suite *s;
+    TCase *tc;
+    SRunner *sr;
+
+    s = suite_create("Format");
+    tc = tcase_create("format");
+    tcase_add_test(tc, format_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;
 }

commit 5f2a25b2523b14f41742901bfa9851f284f57906
Author: Deng Zhengrong <dzrongg at gmail.com>
Date:   Sat Jul 28 17:21:22 2012 +0800

    tests: modify usergroup-test to use 'check' test framework

diff --git a/src/Makefile.am b/src/Makefile.am
index aa3ba1a..fcb6621 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -521,8 +521,8 @@ alsa_time_test_LDFLAGS = $(AM_LDFLAGS) $(BINLDFLAGS)
 
 usergroup_test_SOURCES = tests/usergroup-test.c
 usergroup_test_LDADD = $(AM_LDADD) libpulsecore- at PA_MAJORMINOR@.la libpulse.la libpulsecommon- at PA_MAJORMINOR@.la
-usergroup_test_CFLAGS = $(AM_CFLAGS)
-usergroup_test_LDFLAGS = $(AM_LDFLAGS) $(BINLDFLAGS)
+usergroup_test_CFLAGS = $(AM_CFLAGS) $(LIBCHECK_CFLAGS)
+usergroup_test_LDFLAGS = $(AM_LDFLAGS) $(BINLDFLAGS) $(LIBCHECK_LIBS)
 
 connect_stress_SOURCES = tests/connect-stress.c
 connect_stress_LDADD = $(AM_LDADD) libpulse.la
diff --git a/src/tests/usergroup-test.c b/src/tests/usergroup-test.c
index 956f818..13ee48c 100644
--- a/src/tests/usergroup-test.c
+++ b/src/tests/usergroup-test.c
@@ -29,6 +29,8 @@
 #include <grp.h>
 #include <errno.h>
 
+#include <check.h>
+
 #include <pulsecore/usergroup.h>
 #include <pulsecore/core-util.h>
 
@@ -117,40 +119,51 @@ static int compare_passwd(const struct passwd *a, const struct passwd *b) {
     return 0;
 }
 
-int main(int argc, char *argv[]) {
+START_TEST (usergroup_test) {
     struct group *gr;
     struct passwd *pw;
-    int err;
     struct group *reference_group = NULL;
     struct passwd *reference_passwd = NULL;
 
-    err = load_reference_structs(&reference_group, &reference_passwd);
-    if (err)
-        return 77;
+    fail_if(load_reference_structs(&reference_group, &reference_passwd));
 
     errno = 0;
     gr = pa_getgrgid_malloc(reference_group->gr_gid);
-    if (compare_group(reference_group, gr))
-        return 1;
+    fail_if(compare_group(reference_group, gr));
     pa_getgrgid_free(gr);
 
     errno = 0;
     gr = pa_getgrnam_malloc(reference_group->gr_name);
-    if (compare_group(reference_group, gr))
-        return 1;
+    fail_if(compare_group(reference_group, gr));
     pa_getgrnam_free(gr);
 
     errno = 0;
     pw = pa_getpwuid_malloc(reference_passwd->pw_uid);
-    if (compare_passwd(reference_passwd, pw))
-        return 1;
+    fail_if(compare_passwd(reference_passwd, pw));
     pa_getpwuid_free(pw);
 
     errno = 0;
     pw = pa_getpwnam_malloc(reference_passwd->pw_name);
-    if (compare_passwd(reference_passwd, pw))
-        return 1;
+    fail_if(compare_passwd(reference_passwd, pw));
     pa_getpwnam_free(pw);
+}
+END_TEST
 
-    return 0;
+int main(int argc, char *argv[]) {
+    int failed = 0;
+    Suite *s;
+    TCase *tc;
+    SRunner *sr;
+
+    s = suite_create("Usergroup");
+    tc = tcase_create("usergroup");
+    tcase_add_test(tc, usergroup_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;
 }

commit 3db18c27d2e811c2e11532c07bd93ed2e6767517
Author: Deng Zhengrong <dzrongg at gmail.com>
Date:   Sat Jul 28 17:13:10 2012 +0800

    tests: modify volume_test to use new 'check' framework

diff --git a/src/Makefile.am b/src/Makefile.am
index faebe2a..aa3ba1a 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -415,9 +415,9 @@ close_test_LDADD = $(AM_LDADD) $(WINSOCK_LIBS) libpulsecore- at PA_MAJORMINOR@.la l
 close_test_LDFLAGS = $(AM_LDFLAGS) $(BINLDFLAGS)
 
 volume_test_SOURCES = tests/volume-test.c
-volume_test_CFLAGS = $(AM_CFLAGS)
+volume_test_CFLAGS = $(AM_CFLAGS) $(LIBCHECK_CFLAGS)
 volume_test_LDADD = $(AM_LDADD) libpulse.la libpulsecommon- at PA_MAJORMINOR@.la
-volume_test_LDFLAGS = $(AM_LDFLAGS) $(BINLDFLAGS)
+volume_test_LDFLAGS = $(AM_LDFLAGS) $(BINLDFLAGS) $(LIBCHECK_LIBS)
 
 channelmap_test_SOURCES = tests/channelmap-test.c
 channelmap_test_CFLAGS = $(AM_CFLAGS)
diff --git a/src/tests/volume-test.c b/src/tests/volume-test.c
index f7405ff..f47994d 100644
--- a/src/tests/volume-test.c
+++ b/src/tests/volume-test.c
@@ -24,12 +24,14 @@
 #include <stdio.h>
 #include <math.h>
 
+#include <check.h>
+
 #include <pulse/volume.h>
 
 #include <pulsecore/log.h>
 #include <pulsecore/macro.h>
 
-int main(int argc, char *argv[]) {
+START_TEST (volume_test) {
     pa_volume_t v;
     pa_cvolume cv;
     float b;
@@ -95,8 +97,8 @@ int main(int argc, char *argv[]) {
         pa_volume_t r = pa_sw_volume_from_dB(db);
         pa_volume_t w;
 
-        pa_assert(k == v);
-        pa_assert(r == v);
+        fail_unless(k == v);
+        fail_unless(r == v);
 
         for (w = PA_VOLUME_MUTED; w < PA_VOLUME_NORM*2; w += 37) {
 
@@ -127,8 +129,26 @@ int main(int argc, char *argv[]) {
 
     pa_log("max deviation: %lu n=%lu", (unsigned long) md, (unsigned long) mdn);
 
-    pa_assert(md <= 1);
-    pa_assert(mdn <= 251);
+    fail_unless(md <= 1);
+    fail_unless(mdn <= 251);
+}
+END_TEST
 
-    return 0;
+int main(int argc, char *argv[]) {
+    int failed = 0;
+    Suite *s;
+    TCase *tc;
+    SRunner *sr;
+
+    s = suite_create("Volume");
+    tc = tcase_create("volume");
+    tcase_add_test(tc, volume_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;
 }



More information about the pulseaudio-commits mailing list