diff options
author | Max <msuraev@sysmocom.de> | 2018-01-22 15:15:06 +0100 |
---|---|---|
committer | Max <msuraev@sysmocom.de> | 2018-01-22 15:32:28 +0000 |
commit | 49382720f8d5b4e270fae197156cd69292d42ffc (patch) | |
tree | cbb66f2c456cc1ba0933e52a86b89d656300bfed /tests/gsup/gsup_test.c | |
parent | 8b7975b6aa31244faa8c8118aecc10de398f34f4 (diff) |
GSUP: don't fail test on first error
Instead of forcing test failure via assert on first error encountered,
let it run until completion and print detailed error log. This
simplifies troubleshooting by letting user to see more errors from
single run and more details on each of the errors. Update test output
with explicit test results.
Change-Id: I016a28fe04f7b194e22c15e936095004c5f079d1
Diffstat (limited to 'tests/gsup/gsup_test.c')
-rw-r--r-- | tests/gsup/gsup_test.c | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/tests/gsup/gsup_test.c b/tests/gsup/gsup_test.c index 3b360acf..eddcc924 100644 --- a/tests/gsup/gsup_test.c +++ b/tests/gsup/gsup_test.c @@ -212,21 +212,33 @@ static void test_gsup_messages_dec_enc(void) const struct test *t = &test_messages[test_idx]; struct osmo_gsup_message gm = {0}; struct msgb *msg = msgb_alloc(4096, "gsup_test"); + bool passed = true; printf(" Testing %s\n", t->name); rc = osmo_gsup_decode(t->data, t->data_len, &gm); - OSMO_ASSERT(rc >= 0); + if (rc < 0) + passed = false; osmo_gsup_encode(msg, &gm); fprintf(stderr, " generated message: %s\n", msgb_hexdump(msg)); fprintf(stderr, " original message: %s\n", osmo_hexdump(t->data, t->data_len)); fprintf(stderr, " IMSI: %s\n", gm.imsi); - OSMO_ASSERT(strcmp(gm.imsi, TEST_IMSI_STR) == 0); - OSMO_ASSERT(msgb_length(msg) == t->data_len); - OSMO_ASSERT(memcmp(msgb_data(msg), t->data, t->data_len) == 0); + if (strcmp(gm.imsi, TEST_IMSI_STR) != 0 || + msgb_length(msg) != t->data_len || + memcmp(msgb_data(msg), t->data, t->data_len) != 0) + passed = false; + + if (passed) + printf(" %s OK\n", t->name); + else + printf(" %s FAILED: %d<%s> [%u,%u,%zu,%u]\n", + t->name, rc, strerror(-rc), + strcmp(gm.imsi, TEST_IMSI_STR), + msgb_length(msg), t->data_len, + memcmp(msgb_data(msg), t->data, t->data_len)); msgb_free(msg); } |