diff options
author | Neels Hofmeyr <nhofmeyr@sysmocom.de> | 2017-02-21 20:17:35 +0100 |
---|---|---|
committer | Harald Welte <laforge@gnumonks.org> | 2017-02-22 07:29:46 +0000 |
commit | bd9de2f66f82db66bbbe7e7df54bf8fee8e1a8ae (patch) | |
tree | 1e06efdd1c4cf17173661ecf7dfc4d1919c0299b /tests | |
parent | abb23698d6363e9be368a24c034f5cfa7015a829 (diff) |
gsup_test: also check stderr
Configure logging to be deterministic and add stderr checking to testuite.at.
However, exclude the thousands of message modification log lines from the log
to not have a huge test expectation file.
Change-Id: I0dd7112967a64a168556b62e5ec15107b7608ffb
Diffstat (limited to 'tests')
-rw-r--r-- | tests/Makefile.am | 3 | ||||
-rw-r--r-- | tests/gsup/gsup_test.c | 20 | ||||
-rw-r--r-- | tests/gsup/gsup_test.err | 71 | ||||
-rw-r--r-- | tests/testsuite.at | 3 |
4 files changed, 89 insertions, 8 deletions
diff --git a/tests/Makefile.am b/tests/Makefile.am index 5731bf8d..f6d4db3e 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -177,7 +177,8 @@ EXTRA_DIST = testsuite.at $(srcdir)/package.m4 $(TESTSUITE) \ vty/vty_test.ok comp128/comp128_test.ok \ utils/utils_test.ok stats/stats_test.ok \ bitvec/bitvec_test.ok msgb/msgb_test.ok bits/bitcomp_test.ok \ - sim/sim_test.ok tlv/tlv_test.ok gsup/gsup_test.ok \ + sim/sim_test.ok tlv/tlv_test.ok \ + gsup/gsup_test.ok gsup/gsup_test.err \ oap/oap_test.ok fsm/fsm_test.ok fsm/fsm_test.err \ write_queue/wqueue_test.ok socket/socket_test.ok \ socket/socket_test.err diff --git a/tests/gsup/gsup_test.c b/tests/gsup/gsup_test.c index 42e7b81e..a950ca3e 100644 --- a/tests/gsup/gsup_test.c +++ b/tests/gsup/gsup_test.c @@ -134,9 +134,9 @@ static void test_gsup_messages_dec_enc(void) 0x25, 0x10, /* AUTN (UMTS) */ 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10, - 0x25, 0x08, /* RES (UMTS) */ + 0x27, 0x08, /* RES (UMTS) */ 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, - 0x03, 0x22, /* Auth tuple */ + 0x03, 0x62, /* Auth tuple */ 0x20, 0x10, /* rand */ 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, 0x10, @@ -153,17 +153,17 @@ static void test_gsup_messages_dec_enc(void) 0x25, 0x10, /* AUTN (UMTS) */ 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff, 0xf0, - 0x25, 0x08, /* RES (UMTS) */ + 0x27, 0x08, /* RES (UMTS) */ 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, 0x98, }; static const uint8_t send_auth_info_req_auts[] = { 0x08, TEST_IMSI_IE, - 0x26, 0x0e, + 0x26, 0x0e, /* AUTS (UMTS) */ 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, - 0x20, 0x10, + 0x20, 0x10, /* rand */ 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10, }; @@ -198,7 +198,7 @@ static void test_gsup_messages_dec_enc(void) {"Purge MS Result", purge_ms_res, sizeof(purge_ms_res)}, {"Send Authentication Info Result with IK, CK, AUTN and RES (UMTS)", - send_auth_info_req_auts, sizeof(send_auth_info_req_auts)}, + send_auth_info_res_umts, sizeof(send_auth_info_res_umts)}, {"Send Authentication Info Request with AUTS and RAND (UMTS)", send_auth_info_req_auts, sizeof(send_auth_info_req_auts)}, }; @@ -264,6 +264,10 @@ static void test_gsup_messages_dec_enc(void) test_idx, counter, parse_err); } + /* Don't log thousands of message modification errors */ + LOGP(DLGSUP, LOGL_NOTICE, "Stopping DLGSUP logging\n"); + log_set_category_filter(osmo_stderr_target, DLGSUP, 0, 0); + /* message modification test (relies on ASAN or valgrind being used) */ for (test_idx = 0; test_idx < ARRAY_SIZE(test_messages); test_idx++) { int j; @@ -309,6 +313,10 @@ static struct log_info info = { int main(int argc, char **argv) { osmo_init_logging(&info); + log_set_print_filename(osmo_stderr_target, 0); + log_set_print_timestamp(osmo_stderr_target, 0); + log_set_use_color(osmo_stderr_target, 0); + log_set_print_category(osmo_stderr_target, 1); test_gsup_messages_dec_enc(); diff --git a/tests/gsup/gsup_test.err b/tests/gsup/gsup_test.err new file mode 100644 index 00000000..6cd8627c --- /dev/null +++ b/tests/gsup/gsup_test.err @@ -0,0 +1,71 @@ + generated message: 08 01 08 21 43 65 87 09 21 43 f5 + original message: 08 01 08 21 43 65 87 09 21 43 f5 + IMSI: 123456789012345 + generated message: 09 01 08 21 43 65 87 09 21 43 f5 02 01 07 + original message: 09 01 08 21 43 65 87 09 21 43 f5 02 01 07 + IMSI: 123456789012345 + generated message: 0a 01 08 21 43 65 87 09 21 43 f5 03 22 20 10 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f 10 21 04 21 22 23 24 22 08 31 32 33 34 35 36 37 38 03 22 20 10 81 82 83 84 85 86 87 88 89 8a 8b 8c 8d 8e 8f 90 21 04 a1 a2 a3 a4 22 08 b1 b2 b3 b4 b5 b6 b7 b8 + original message: 0a 01 08 21 43 65 87 09 21 43 f5 03 22 20 10 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f 10 21 04 21 22 23 24 22 08 31 32 33 34 35 36 37 38 03 22 20 10 81 82 83 84 85 86 87 88 89 8a 8b 8c 8d 8e 8f 90 21 04 a1 a2 a3 a4 22 08 b1 b2 b3 b4 b5 b6 b7 b8 + IMSI: 123456789012345 + generated message: 04 01 08 21 43 65 87 09 21 43 f5 + original message: 04 01 08 21 43 65 87 09 21 43 f5 + IMSI: 123456789012345 + generated message: 05 01 08 21 43 65 87 09 21 43 f5 02 01 07 + original message: 05 01 08 21 43 65 87 09 21 43 f5 02 01 07 + IMSI: 123456789012345 + generated message: 06 01 08 21 43 65 87 09 21 43 f5 08 07 91 94 61 46 32 24 43 09 07 91 83 52 38 48 83 93 04 00 05 15 10 01 01 11 02 f1 21 12 09 04 74 65 73 74 03 61 70 6e 13 01 02 05 11 10 01 02 11 02 f1 21 12 08 03 66 6f 6f 03 61 70 6e + original message: 06 01 08 21 43 65 87 09 21 43 f5 08 07 91 94 61 46 32 24 43 09 07 91 83 52 38 48 83 93 04 00 05 15 10 01 01 11 02 f1 21 12 09 04 74 65 73 74 03 61 70 6e 13 01 02 05 11 10 01 02 11 02 f1 21 12 08 03 66 6f 6f 03 61 70 6e + IMSI: 123456789012345 + generated message: 1c 01 08 21 43 65 87 09 21 43 f5 06 01 00 + original message: 1c 01 08 21 43 65 87 09 21 43 f5 06 01 00 + IMSI: 123456789012345 + generated message: 1d 01 08 21 43 65 87 09 21 43 f5 02 01 03 + original message: 1d 01 08 21 43 65 87 09 21 43 f5 02 01 03 + IMSI: 123456789012345 + generated message: 1e 01 08 21 43 65 87 09 21 43 f5 + original message: 1e 01 08 21 43 65 87 09 21 43 f5 + IMSI: 123456789012345 + generated message: 0c 01 08 21 43 65 87 09 21 43 f5 + original message: 0c 01 08 21 43 65 87 09 21 43 f5 + IMSI: 123456789012345 + generated message: 0d 01 08 21 43 65 87 09 21 43 f5 02 01 03 + original message: 0d 01 08 21 43 65 87 09 21 43 f5 02 01 03 + IMSI: 123456789012345 + generated message: 0e 01 08 21 43 65 87 09 21 43 f5 07 00 + original message: 0e 01 08 21 43 65 87 09 21 43 f5 07 00 + IMSI: 123456789012345 + generated message: 0a 01 08 21 43 65 87 09 21 43 f5 03 62 20 10 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f 10 21 04 21 22 23 24 22 08 31 32 33 34 35 36 37 38 23 10 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f 10 24 10 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f 10 25 10 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f 10 27 08 01 02 03 04 05 06 07 08 03 62 20 10 a1 a2 a3 a4 a5 a6 a7 a8 a9 aa ab ac ad ae af 10 21 04 b1 b2 b3 b4 22 08 c1 c2 c3 c4 c5 c6 c7 c8 23 10 d1 d2 d3 d4 d5 d6 d7 d8 d9 da db dc dd de df d0 24 10 e1 e2 e3 e4 e5 e6 e7 e8 e9 ea eb ec ed ee ef e0 25 10 f1 f2 f3 f4 f5 f6 f7 f8 f9 fa fb fc fd fe ff f0 27 08 91 92 93 94 95 96 97 98 + original message: 0a 01 08 21 43 65 87 09 21 43 f5 03 62 20 10 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f 10 21 04 21 22 23 24 22 08 31 32 33 34 35 36 37 38 23 10 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f 10 24 10 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f 10 25 10 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f 10 27 08 01 02 03 04 05 06 07 08 03 62 20 10 a1 a2 a3 a4 a5 a6 a7 a8 a9 aa ab ac ad ae af 10 21 04 b1 b2 b3 b4 22 08 c1 c2 c3 c4 c5 c6 c7 c8 23 10 d1 d2 d3 d4 d5 d6 d7 d8 d9 da db dc dd de df d0 24 10 e1 e2 e3 e4 e5 e6 e7 e8 e9 ea eb ec ed ee ef e0 25 10 f1 f2 f3 f4 f5 f6 f7 f8 f9 fa fb fc fd fe ff f0 27 08 91 92 93 94 95 96 97 98 + IMSI: 123456789012345 + generated message: 08 01 08 21 43 65 87 09 21 43 f5 26 0e 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 20 10 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f 10 + original message: 08 01 08 21 43 65 87 09 21 43 f5 26 0e 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 20 10 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f 10 + IMSI: 123456789012345 + message 0: tested 11 truncations, 11 parse failures + message 1: tested 14 truncations, 13 parse failures + message 2: tested 83 truncations, 81 parse failures + message 3: tested 11 truncations, 11 parse failures + message 4: tested 14 truncations, 13 parse failures + message 5: tested 73 truncations, 68 parse failures + message 6: tested 14 truncations, 13 parse failures + message 7: tested 14 truncations, 13 parse failures + message 8: tested 11 truncations, 11 parse failures + message 9: tested 11 truncations, 11 parse failures + message 10: tested 14 truncations, 13 parse failures + message 11: tested 13 truncations, 12 parse failures + message 12: tested 211 truncations, 209 parse failures + message 13: tested 45 truncations, 43 parse failures +DLGSUP Stopping DLGSUP logging + message 0: tested 2816 modifications, 510 parse failures + message 1: tested 3584 modifications, 768 parse failures + message 2: tested 21248 modifications, 2571 parse failures + message 3: tested 2816 modifications, 510 parse failures + message 4: tested 3584 modifications, 768 parse failures + message 5: tested 18688 modifications, 3505 parse failures + message 6: tested 3584 modifications, 769 parse failures + message 7: tested 3584 modifications, 768 parse failures + message 8: tested 2816 modifications, 510 parse failures + message 9: tested 2816 modifications, 510 parse failures + message 10: tested 3584 modifications, 768 parse failures + message 11: tested 3328 modifications, 767 parse failures + message 12: tested 54016 modifications, 4622 parse failures + message 13: tested 11520 modifications, 1026 parse failures diff --git a/tests/testsuite.at b/tests/testsuite.at index d6181c91..a3be0e7d 100644 --- a/tests/testsuite.at +++ b/tests/testsuite.at @@ -212,7 +212,8 @@ AT_CLEANUP AT_SETUP([gsup]) AT_KEYWORDS([gsup]) cat $abs_srcdir/gsup/gsup_test.ok > expout -AT_CHECK([$abs_top_builddir/tests/gsup/gsup_test], [0], [expout], [ignore]) +cat $abs_srcdir/gsup/gsup_test.err > experr +AT_CHECK([$abs_top_builddir/tests/gsup/gsup_test], [0], [expout], [experr]) AT_CLEANUP AT_SETUP([fsm]) |