Change in libosmocore[master]: coding: check gsm0503_rach_*() results

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/.

Max gerrit-no-reply at lists.osmocom.org
Tue Mar 5 15:37:28 UTC 2019


Max has submitted this change and it was merged. ( https://gerrit.osmocom.org/13129 )

Change subject: coding: check gsm0503_rach_*() results
......................................................................

coding: check gsm0503_rach_*() results

Check return value of RACH encode/decode functions and fail test on
unexpected results.

Change-Id: I41bfa808e3c064a11152e7ce8ee77a01d38a0744
Related: OS#1854
---
M tests/coding/coding_test.c
1 file changed, 10 insertions(+), 8 deletions(-)

Approvals:
  Jenkins Builder: Verified
  Pau Espin Pedrol: Looks good to me, but someone else must approve
  osmith: Looks good to me, approved



diff --git a/tests/coding/coding_test.c b/tests/coding/coding_test.c
index 7b4f2a5..2b0830f 100644
--- a/tests/coding/coding_test.c
+++ b/tests/coding/coding_test.c
@@ -104,13 +104,14 @@
 
 static void test_rach(uint8_t bsic, uint8_t ra)
 {
+	int rc;
 	uint8_t result;
 	ubit_t bursts_u[36];
 	sbit_t bursts_s[36];
 
 	/* Encode L2 message */
-	printf("Encoding: %02x\n", ra);
-	gsm0503_rach_ext_encode(bursts_u, ra, bsic, false);
+	rc = gsm0503_rach_ext_encode(bursts_u, ra, bsic, false);
+	printf("Encoding: %02x%s\n", ra, (rc != 0) ? " FAIL" : "");
 
 	/* Prepare soft-bits */
 	osmo_ubit2sbit(bursts_s, bursts_u, 36);
@@ -123,8 +124,8 @@
 	memset(bursts_s + 6, 0, 8);
 
 	/* Decode, correcting errors */
-	gsm0503_rach_decode_ber(&result, bursts_s, bsic, NULL, NULL);
-	printf("Decoded: %02x\n", result);
+	rc = gsm0503_rach_decode_ber(&result, bursts_s, bsic, NULL, NULL);
+	printf("Decoded: %02x%s\n", result, (rc != 0) ? " FAIL" : "");
 
 	if (ra != result)
 		printf("FAIL [RACH]: encoded %u != %u decoded\n", ra, result);
@@ -134,13 +135,14 @@
 
 static void test_rach_ext(uint8_t bsic, uint16_t ra)
 {
+	int rc;
 	uint16_t result = 3000; /* Max ext. RA is 2^11 = 2048 */
 	ubit_t bursts_u[36];
 	sbit_t bursts_s[36];
 
 	/* Encode L2 message */
-	printf("Encoding: %02x\n", ra);
-	gsm0503_rach_ext_encode(bursts_u, ra, bsic, true);
+	rc = gsm0503_rach_ext_encode(bursts_u, ra, bsic, true);
+	printf("Encoding: %02x%s\n", ra, (rc != 0) ? " FAIL" : "");
 
 	/* Prepare soft-bits */
 	osmo_ubit2sbit(bursts_s, bursts_u, 36);
@@ -153,8 +155,8 @@
 	memset(bursts_s + 9, 0, 8);
 
 	/* Decode, correcting errors */
-	gsm0503_rach_ext_decode_ber(&result, bursts_s, bsic, NULL, NULL);
-	printf("Decoded: %02x\n", result);
+	rc = gsm0503_rach_ext_decode_ber(&result, bursts_s, bsic, NULL, NULL);
+	printf("Decoded: %02x%s\n", result, (rc != 0) ? " FAIL" : "");
 
 	if (ra != result)
 		printf("FAIL [RACH ext]: encoded %u != %u decoded\n", ra, result);

-- 
To view, visit https://gerrit.osmocom.org/13129
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: I41bfa808e3c064a11152e7ce8ee77a01d38a0744
Gerrit-Change-Number: 13129
Gerrit-PatchSet: 1
Gerrit-Owner: Max <msuraev at sysmocom.de>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder (1000002)
Gerrit-Reviewer: Max <msuraev at sysmocom.de>
Gerrit-Reviewer: Pau Espin Pedrol <pespin at sysmocom.de>
Gerrit-Reviewer: osmith <osmith at sysmocom.de>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20190305/92cb204c/attachment.htm>


More information about the gerrit-log mailing list