Change in libosmocore[master]: tests: codec: ecu_fr: Add buffer with unequal XMAXC values

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

Harald Welte gerrit-no-reply at lists.osmocom.org
Sat Jul 21 07:40:21 UTC 2018


Harald Welte has submitted this change and it was merged. ( https://gerrit.osmocom.org/10079 )

Change subject: tests: codec: ecu_fr: Add buffer with unequal XMAXC values
......................................................................

tests: codec: ecu_fr: Add buffer with unequal XMAXC values

This buffer verifies that all XMAXC fields must be zero before the
entire buffer is considered as silent by osmo_ecu_fr_conceal().

Change-Id: I14a192d001b5e167437cedbe76a1a3dd84dde35c
---
M tests/codec/codec_ecu_fr_test.c
M tests/codec/codec_ecu_fr_test.ok
2 files changed, 49 insertions(+), 19 deletions(-)

Approvals:
  Harald Welte: Looks good to me, approved
  Vadim Yanitskiy: Looks good to me, but someone else must approve
  Jenkins Builder: Verified



diff --git a/tests/codec/codec_ecu_fr_test.c b/tests/codec/codec_ecu_fr_test.c
index 3a99fc7..3561c44 100644
--- a/tests/codec/codec_ecu_fr_test.c
+++ b/tests/codec/codec_ecu_fr_test.c
@@ -73,8 +73,11 @@
 };
 
 /* Example of a good frame */
-static const char *sample_frame_hex = \
-	"d9ec9be212901f802335598c501f805bad3d4ba01f809b69df5a501f809cd1b4da";
+static const char *sample_frame_hex[] = {
+	"d9ec9be212901f802335598c501f805bad3d4ba01f809b69df5a501f809cd1b4da",
+	"d9ec9be212901d802335598c5013805bad3d4ba01f809b69df5a5019809cd1b4da",
+	NULL
+};
 
 #define GSM610_XMAXC_LEN	6
 static void parse_xmaxc_frame(uint8_t *frame, uint64_t xmaxc_res[4])
@@ -108,26 +111,32 @@
 	uint8_t frame[GSM_FR_BYTES];
 	uint64_t xmaxc[4];
 	int i, rc;
+	int j = 0;
 
-	/* Parse frame from string to hex */
-	osmo_hexparse(sample_frame_hex, frame, GSM_FR_BYTES);
-	parse_xmaxc_frame(frame, xmaxc);
-	printf("Start with: %s, XMAXC: [%"PRIx64", %"PRIx64", %"PRIx64", %"PRIx64"]\n",
-	       sample_frame_hex, xmaxc[0], xmaxc[1], xmaxc[2], xmaxc[3]);
-
-	/* Reset the ECU with the proposed known good frame */
-	osmo_ecu_fr_reset(&state, frame);
-
-	/* Now pretend that we do not receive any good frames anymore */
-	for (i = 0; i < 20; i++) {
-
-		rc = osmo_ecu_fr_conceal(&state, frame);
-		OSMO_ASSERT(rc == 0);
+	while (sample_frame_hex[j] != NULL) {
+		/* Parse frame from string to hex */
+		osmo_hexparse(sample_frame_hex[j], frame, GSM_FR_BYTES);
 		parse_xmaxc_frame(frame, xmaxc);
+		printf("Start with: %s, XMAXC: [%"PRIx64", %"PRIx64", %"PRIx64", %"PRIx64"]\n",
+		       sample_frame_hex[j], xmaxc[0], xmaxc[1], xmaxc[2], xmaxc[3]);
 
-		printf("conceal: %02i, result: %s XMAXC: [%"PRIx64", %"PRIx64", %"PRIx64", %"PRIx64"]\n",
-		       i, osmo_hexdump_nospc(frame, GSM_FR_BYTES),
-		       xmaxc[0], xmaxc[1], xmaxc[2], xmaxc[3]);
+		/* Reset the ECU with the proposed known good frame */
+		osmo_ecu_fr_reset(&state, frame);
+
+		/* Now pretend that we do not receive any good frames anymore */
+		for (i = 0; i < 20; i++) {
+
+			rc = osmo_ecu_fr_conceal(&state, frame);
+			OSMO_ASSERT(rc == 0);
+			parse_xmaxc_frame(frame, xmaxc);
+
+			printf("conceal: %02i, result: %s XMAXC: [%"PRIx64", %"PRIx64", %"PRIx64", %"PRIx64"]\n",
+			       i, osmo_hexdump_nospc(frame, GSM_FR_BYTES),
+			       xmaxc[0], xmaxc[1], xmaxc[2], xmaxc[3]);
+		}
+
+		/* Go to the next frame */
+		j++;
 	}
 }
 
diff --git a/tests/codec/codec_ecu_fr_test.ok b/tests/codec/codec_ecu_fr_test.ok
index 52d06a1..3cc35af 100644
--- a/tests/codec/codec_ecu_fr_test.ok
+++ b/tests/codec/codec_ecu_fr_test.ok
@@ -19,6 +19,27 @@
 conceal: 17, result: d00000000000000000000000000000000000000000000000000000000000000000 XMAXC: [0, 0, 0, 0]
 conceal: 18, result: d00000000000000000000000000000000000000000000000000000000000000000 XMAXC: [0, 0, 0, 0]
 conceal: 19, result: d00000000000000000000000000000000000000000000000000000000000000000 XMAXC: [0, 0, 0, 0]
+Start with: d9ec9be212901d802335598c5013805bad3d4ba01f809b69df5a5019809cd1b4da, XMAXC: [3b, 27, 3f, 33]
+conceal: 00, result: d9ec9be212901d802335598c5013805bad3d4ba01f809b69df5a5019809cd1b4da XMAXC: [3b, 27, 3f, 33]
+conceal: 01, result: d9ec9be212901b802335598c5011805bad3d4ba01d809b69df5a5017809cd1b4da XMAXC: [37, 23, 3b, 2f]
+conceal: 02, result: d9ec9be2129019802335598c500f805bad3d4ba01b809b69df5a5015809cd1b4da XMAXC: [33, 1f, 37, 2b]
+conceal: 03, result: d9ec9be2129017802335598c500d805bad3d4ba019809b69df5a5013809cd1b4da XMAXC: [2f, 1b, 33, 27]
+conceal: 04, result: d9ec9be2129015802335598c500b805bad3d4ba017809b69df5a5011809cd1b4da XMAXC: [2b, 17, 2f, 23]
+conceal: 05, result: d9ec9be2129013802335598c5009805bad3d4ba015809b69df5a500f809cd1b4da XMAXC: [27, 13, 2b, 1f]
+conceal: 06, result: d9ec9be2129011802335598c5007805bad3d4ba013809b69df5a500d809cd1b4da XMAXC: [23, f, 27, 1b]
+conceal: 07, result: d9ec9be212900f802335598c5005805bad3d4ba011809b69df5a500b809cd1b4da XMAXC: [1f, b, 23, 17]
+conceal: 08, result: d9ec9be212900d802335598c5003805bad3d4ba00f809b69df5a5009809cd1b4da XMAXC: [1b, 7, 1f, 13]
+conceal: 09, result: d9ec9be212900b802335598c5001805bad3d4ba00d809b69df5a5007809cd1b4da XMAXC: [17, 3, 1b, f]
+conceal: 10, result: d9ec9be2129009802335598c5000005bad3d4ba00b809b69df5a5005809cd1b4da XMAXC: [13, 0, 17, b]
+conceal: 11, result: d9ec9be2129007802335598c5000005bad3d4ba009809b69df5a5003809cd1b4da XMAXC: [f, 0, 13, 7]
+conceal: 12, result: d9ec9be2129005802335598c5000005bad3d4ba007809b69df5a5001809cd1b4da XMAXC: [b, 0, f, 3]
+conceal: 13, result: d9ec9be2129003802335598c5000005bad3d4ba005809b69df5a5000009cd1b4da XMAXC: [7, 0, b, 0]
+conceal: 14, result: d9ec9be2129001802335598c5000005bad3d4ba003809b69df5a5000009cd1b4da XMAXC: [3, 0, 7, 0]
+conceal: 15, result: d9ec9be2129000002335598c5000005bad3d4ba001809b69df5a5000009cd1b4da XMAXC: [0, 0, 3, 0]
+conceal: 16, result: d00000000000000000000000000000000000000000000000000000000000000000 XMAXC: [0, 0, 0, 0]
+conceal: 17, result: d00000000000000000000000000000000000000000000000000000000000000000 XMAXC: [0, 0, 0, 0]
+conceal: 18, result: d00000000000000000000000000000000000000000000000000000000000000000 XMAXC: [0, 0, 0, 0]
+conceal: 19, result: d00000000000000000000000000000000000000000000000000000000000000000 XMAXC: [0, 0, 0, 0]
 Frame No. 000:
  * input:  d9aa93ae63de00471a91b95b8660471392b4a2daa037628f391c624039258dc723
  * output: d9aa93ae63de00471a91b95b8660471392b4a2daa037628f391c624039258dc723

-- 
To view, visit https://gerrit.osmocom.org/10079
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I14a192d001b5e167437cedbe76a1a3dd84dde35c
Gerrit-Change-Number: 10079
Gerrit-PatchSet: 2
Gerrit-Owner: Pau Espin Pedrol <pespin at sysmocom.de>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Vadim Yanitskiy <axilirator at gmail.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20180721/6f5cdac4/attachment.htm>


More information about the gerrit-log mailing list