mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-11-08 13:29:59 -05:00
tests: modify mainloop-test to use new 'check' framework
This commit is contained in:
parent
c8cd89a7cb
commit
11d2bf787f
2 changed files with 33 additions and 14 deletions
|
|
@ -310,9 +310,9 @@ check-daemon:
|
|||
$(MAKE) check TESTS="$(TESTS_daemon)"
|
||||
|
||||
mainloop_test_SOURCES = tests/mainloop-test.c
|
||||
mainloop_test_CFLAGS = $(AM_CFLAGS)
|
||||
mainloop_test_CFLAGS = $(AM_CFLAGS) $(LIBCHECK_CFLAGS)
|
||||
mainloop_test_LDADD = $(AM_LDADD) libpulse.la libpulsecommon-@PA_MAJORMINOR@.la
|
||||
mainloop_test_LDFLAGS = $(AM_LDFLAGS) $(BINLDFLAGS)
|
||||
mainloop_test_LDFLAGS = $(AM_LDFLAGS) $(BINLDFLAGS) $(LIBCHECK_LIBS)
|
||||
|
||||
thread_mainloop_test_SOURCES = tests/thread-mainloop-test.c
|
||||
thread_mainloop_test_CFLAGS = $(AM_CFLAGS)
|
||||
|
|
@ -435,9 +435,9 @@ cpulimit_test2_LDADD = $(AM_LDADD) libpulsecore-@PA_MAJORMINOR@.la libpulse.la l
|
|||
cpulimit_test2_LDFLAGS = $(AM_LDFLAGS) $(BINLDFLAGS)
|
||||
|
||||
mainloop_test_glib_SOURCES = $(mainloop_test_SOURCES)
|
||||
mainloop_test_glib_CFLAGS = $(mainloop_test_CFLAGS) $(GLIB20_CFLAGS) -DGLIB_MAIN_LOOP
|
||||
mainloop_test_glib_CFLAGS = $(mainloop_test_CFLAGS) $(LIBCHECK_CFLAGS) $(GLIB20_CFLAGS) -DGLIB_MAIN_LOOP
|
||||
mainloop_test_glib_LDADD = $(mainloop_test_LDADD) $(GLIB20_LIBS) libpulse-mainloop-glib.la
|
||||
mainloop_test_glib_LDFLAGS = $(AM_LDFLAGS) $(BINLDFLAGS)
|
||||
mainloop_test_glib_LDFLAGS = $(AM_LDFLAGS) $(BINLDFLAGS) $(LIBCHECK_LIBS)
|
||||
|
||||
memblockq_test_SOURCES = tests/memblockq-test.c
|
||||
memblockq_test_CFLAGS = $(AM_CFLAGS)
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@
|
|||
#include <unistd.h>
|
||||
#include <sys/time.h>
|
||||
#include <assert.h>
|
||||
#include <check.h>
|
||||
|
||||
#include <pulse/rtclock.h>
|
||||
#include <pulse/timeval.h>
|
||||
|
|
@ -67,7 +68,7 @@ static void tcb(pa_mainloop_api*a, pa_time_event *e, const struct timeval *tv, v
|
|||
#endif
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
START_TEST (mainloop_test) {
|
||||
pa_mainloop_api *a;
|
||||
pa_io_event *ioe;
|
||||
pa_time_event *te;
|
||||
|
|
@ -77,28 +78,28 @@ int main(int argc, char *argv[]) {
|
|||
pa_glib_mainloop *g;
|
||||
|
||||
glib_main_loop = g_main_loop_new(NULL, FALSE);
|
||||
assert(glib_main_loop);
|
||||
fail_if(!glib_main_loop);
|
||||
|
||||
g = pa_glib_mainloop_new(NULL);
|
||||
assert(g);
|
||||
fail_if(!g);
|
||||
|
||||
a = pa_glib_mainloop_get_api(g);
|
||||
assert(a);
|
||||
fail_if(!a);
|
||||
#else /* GLIB_MAIN_LOOP */
|
||||
pa_mainloop *m;
|
||||
|
||||
m = pa_mainloop_new();
|
||||
assert(m);
|
||||
fail_if(!m);
|
||||
|
||||
a = pa_mainloop_get_api(m);
|
||||
assert(a);
|
||||
fail_if(!a);
|
||||
#endif /* GLIB_MAIN_LOOP */
|
||||
|
||||
ioe = a->io_new(a, 0, PA_IO_EVENT_INPUT, iocb, NULL);
|
||||
assert(ioe);
|
||||
fail_if(!ioe);
|
||||
|
||||
de = a->defer_new(a, dcb, NULL);
|
||||
assert(de);
|
||||
fail_if(!de);
|
||||
|
||||
te = a->time_new(a, pa_timeval_rtstore(&tv, pa_rtclock_now() + 2 * PA_USEC_PER_SEC, TRUE), tcb, NULL);
|
||||
|
||||
|
|
@ -118,6 +119,24 @@ int main(int argc, char *argv[]) {
|
|||
#else
|
||||
pa_mainloop_free(m);
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
END_TEST
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
int failed = 0;
|
||||
Suite *s;
|
||||
TCase *tc;
|
||||
SRunner *sr;
|
||||
|
||||
s = suite_create("MainLoop");
|
||||
tc = tcase_create("mainloop");
|
||||
tcase_add_test(tc, mainloop_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;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue