mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-11-06 13:29:56 -05:00
tests: modify asyncmsgq-test to new 'check' framework
This commit is contained in:
parent
1569601864
commit
8628990365
2 changed files with 29 additions and 7 deletions
|
|
@ -370,9 +370,9 @@ asyncq_test_LDADD = $(AM_LDADD) libpulsecore-@PA_MAJORMINOR@.la libpulse.la libp
|
||||||
asyncq_test_LDFLAGS = $(AM_LDFLAGS) $(BINLDFLAGS)
|
asyncq_test_LDFLAGS = $(AM_LDFLAGS) $(BINLDFLAGS)
|
||||||
|
|
||||||
asyncmsgq_test_SOURCES = tests/asyncmsgq-test.c
|
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-@PA_MAJORMINOR@.la libpulse.la libpulsecommon-@PA_MAJORMINOR@.la
|
asyncmsgq_test_LDADD = $(AM_LDADD) libpulsecore-@PA_MAJORMINOR@.la libpulse.la libpulsecommon-@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_SOURCES = tests/queue-test.c
|
||||||
queue_test_CFLAGS = $(AM_CFLAGS)
|
queue_test_CFLAGS = $(AM_CFLAGS)
|
||||||
|
|
|
||||||
|
|
@ -25,6 +25,8 @@
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
|
#include <check.h>
|
||||||
|
|
||||||
#include <pulsecore/asyncmsgq.h>
|
#include <pulsecore/asyncmsgq.h>
|
||||||
#include <pulsecore/thread.h>
|
#include <pulsecore/thread.h>
|
||||||
#include <pulsecore/log.h>
|
#include <pulsecore/log.h>
|
||||||
|
|
@ -71,13 +73,15 @@ static void the_thread(void *_q) {
|
||||||
} while (!quit);
|
} while (!quit);
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(int argc, char *argv[]) {
|
START_TEST (asyncmsgq_test) {
|
||||||
pa_asyncmsgq *q;
|
pa_asyncmsgq *q;
|
||||||
pa_thread *t;
|
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_log_info("Operation A post");
|
||||||
pa_asyncmsgq_post(q, NULL, OPERATION_A, NULL, 0, NULL, NULL);
|
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_thread_free(t);
|
||||||
|
|
||||||
pa_asyncmsgq_unref(q);
|
pa_asyncmsgq_unref(q);
|
||||||
|
}
|
||||||
return 0;
|
END_TEST
|
||||||
|
|
||||||
|
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;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue