From: Bert Vermeulen Date: Wed, 11 Dec 2013 17:36:42 +0000 (+0100) Subject: check: Make sure to test this set of decoders, not the installed ones. X-Git-Tag: libsigrokdecode-0.3.0~197 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=554a49f9df0ee8c57d7fae64515cf57d622b0511;p=libsigrokdecode.git check: Make sure to test this set of decoders, not the installed ones. --- diff --git a/tests/Makefile.am b/tests/Makefile.am index 5739a03..e70b301 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -20,9 +20,7 @@ if HAVE_CHECK TESTS = check_main - check_PROGRAMS = ${TESTS} - check_main_SOURCES = \ $(top_builddir)/libsigrokdecode.h \ check_main.c \ @@ -30,12 +28,10 @@ check_main_SOURCES = \ check_decoder.c \ check_inst.c \ check_session.c - check_main_CFLAGS = @check_CFLAGS@ - check_main_LDADD = $(top_builddir)/libsigrokdecode.la @check_LIBS@ - -check_main_CPPFLAGS = $(CPPFLAGS_PYTHON) +check_main_CPPFLAGS = $(CPPFLAGS_PYTHON) \ + -DDECODERS_DIR='"$(abs_top_builddir)/decoders"' endif if HAVE_LIBSIGROK diff --git a/tests/check_decoder.c b/tests/check_decoder.c index fe1b92f..d62a1eb 100644 --- a/tests/check_decoder.c +++ b/tests/check_decoder.c @@ -40,7 +40,7 @@ START_TEST(test_load_all) { int ret; - srd_init(NULL); + srd_init(DECODERS_DIR); ret = srd_decoder_load_all(); fail_unless(ret == SRD_OK, "srd_decoder_load_all() failed: %d.", ret); srd_exit(); @@ -69,7 +69,7 @@ START_TEST(test_load) { int ret; - srd_init(NULL); + srd_init(DECODERS_DIR); ret = srd_decoder_load("uart"); fail_unless(ret == SRD_OK, "srd_decoder_load(uart) failed: %d.", ret); ret = srd_decoder_load("spi"); @@ -86,7 +86,7 @@ END_TEST */ START_TEST(test_load_bogus) { - srd_init(NULL); + srd_init(DECODERS_DIR); /* http://sigrok.org/bugzilla/show_bug.cgi?id=176 */ fail_unless(srd_decoder_load(NULL) != SRD_OK); fail_unless(srd_decoder_load("") != SRD_OK); @@ -109,7 +109,7 @@ END_TEST */ START_TEST(test_load_valid_and_bogus) { - srd_init(NULL); + srd_init(DECODERS_DIR); fail_unless(srd_decoder_load("") != SRD_OK); fail_unless(srd_decoder_load("uart") == SRD_OK); fail_unless(srd_decoder_load("") != SRD_OK); @@ -130,7 +130,7 @@ START_TEST(test_load_multiple) { int ret; - srd_init(NULL); + srd_init(DECODERS_DIR); ret = srd_decoder_load("uart"); fail_unless(ret == SRD_OK, "Loading uart PD 1x failed: %d", ret); ret = srd_decoder_load("uart"); @@ -163,7 +163,7 @@ END_TEST */ START_TEST(test_decoder_list) { - srd_init(NULL); + srd_init(DECODERS_DIR); srd_decoder_load_all(); fail_unless(srd_decoder_list() != NULL); srd_exit(); @@ -177,7 +177,7 @@ END_TEST */ START_TEST(test_decoder_list_no_load) { - srd_init(NULL); + srd_init(DECODERS_DIR); fail_unless(srd_decoder_list() == NULL); srd_exit(); } @@ -213,7 +213,7 @@ END_TEST */ START_TEST(test_decoder_list_correct_numbers) { - srd_init(NULL); + srd_init(DECODERS_DIR); fail_unless(g_slist_length((GSList *)srd_decoder_list()) == 0); srd_decoder_load("spi"); fail_unless(g_slist_length((GSList *)srd_decoder_list()) == 1); @@ -233,7 +233,7 @@ END_TEST */ START_TEST(test_get_by_id) { - srd_init(NULL); + srd_init(DECODERS_DIR); srd_decoder_load("uart"); fail_unless(srd_decoder_get_by_id("uart") != NULL); fail_unless(srd_decoder_get_by_id("can") == NULL); @@ -250,7 +250,7 @@ END_TEST */ START_TEST(test_get_by_id_multiple) { - srd_init(NULL); + srd_init(DECODERS_DIR); srd_decoder_load("uart"); fail_unless(srd_decoder_get_by_id("uart") != NULL); fail_unless(srd_decoder_get_by_id("uart") != NULL); @@ -266,7 +266,7 @@ END_TEST */ START_TEST(test_get_by_id_bogus) { - srd_init(NULL); + srd_init(DECODERS_DIR); fail_unless(srd_decoder_get_by_id(NULL) == NULL); fail_unless(srd_decoder_get_by_id("") == NULL); fail_unless(srd_decoder_get_by_id(" ") == NULL); @@ -290,7 +290,7 @@ START_TEST(test_doc_get) { struct srd_decoder *dec; - srd_init(NULL); + srd_init(DECODERS_DIR); srd_decoder_load("uart"); dec = srd_decoder_get_by_id("uart"); fail_unless(srd_decoder_doc_get(dec) != NULL); @@ -305,7 +305,7 @@ END_TEST */ START_TEST(test_doc_get_null) { - srd_init(NULL); + srd_init(DECODERS_DIR); fail_unless(srd_decoder_doc_get(NULL) == NULL); srd_exit(); } diff --git a/tests/check_inst.c b/tests/check_inst.c index 25adc4f..87dbe91 100644 --- a/tests/check_inst.c +++ b/tests/check_inst.c @@ -41,7 +41,7 @@ START_TEST(test_inst_new) struct srd_session *sess; struct srd_decoder_inst *inst; - srd_init(NULL); + srd_init(DECODERS_DIR); srd_decoder_load("uart"); srd_session_new(&sess); inst = srd_inst_new(sess, "uart", NULL); @@ -61,7 +61,7 @@ START_TEST(test_inst_new_multiple) inst1 = inst2 = inst3 = NULL; - srd_init(NULL); + srd_init(DECODERS_DIR); srd_decoder_load_all(); srd_session_new(&sess); @@ -98,7 +98,7 @@ START_TEST(test_inst_option_set_empty) struct srd_decoder_inst *inst; GHashTable *options; - srd_init(NULL); + srd_init(DECODERS_DIR); srd_decoder_load_all(); srd_session_new(&sess); inst = srd_inst_new(sess, "uart", NULL); @@ -122,7 +122,7 @@ START_TEST(test_inst_option_set_bogus) struct srd_decoder_inst *inst; GHashTable *options; - srd_init(NULL); + srd_init(DECODERS_DIR); srd_decoder_load_all(); srd_session_new(&sess); inst = srd_inst_new(sess, "uart", NULL);