mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-11-09 13:29:59 -05:00
tests: modify hook-list-test to use 'check' framework
This commit is contained in:
parent
ef5cf81ff8
commit
a74795f9e3
2 changed files with 29 additions and 5 deletions
|
|
@ -340,9 +340,9 @@ ipacl_test_LDADD = $(AM_LDADD) libpulsecore-@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-@PA_MAJORMINOR@.la libpulse.la libpulsecommon-@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)
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
||||
return 0;
|
||||
}
|
||||
END_TEST
|
||||
|
||||
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;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue