[MERGED] libosmocore[master]: gsup_test: also check stderr

Harald Welte gerrit-no-reply at lists.osmocom.org
Wed Feb 22 07:29:46 UTC 2017


Harald Welte has submitted this change and it was merged.

Change subject: gsup_test: also check stderr
......................................................................


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
---
M tests/Makefile.am
M tests/gsup/gsup_test.c
A tests/gsup/gsup_test.err
M tests/testsuite.at
4 files changed, 89 insertions(+), 8 deletions(-)

Approvals:
  Harald Welte: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/tests/Makefile.am b/tests/Makefile.am
index 5731bf8..f6d4db3 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -177,7 +177,8 @@
 	     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 42e7b81..a950ca3 100644
--- a/tests/gsup/gsup_test.c
+++ b/tests/gsup/gsup_test.c
@@ -134,9 +134,9 @@
 			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 @@
 			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 @@
 		{"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 @@
 			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 @@
 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 0000000..6cd8627
--- /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 d6181c9..a3be0e7 100644
--- a/tests/testsuite.at
+++ b/tests/testsuite.at
@@ -212,7 +212,8 @@
 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])

-- 
To view, visit https://gerrit.osmocom.org/1863
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I0dd7112967a64a168556b62e5ec15107b7608ffb
Gerrit-PatchSet: 3
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Owner: Neels Hofmeyr <nhofmeyr at sysmocom.de>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder


More information about the gerrit-log mailing list