fixeria has uploaded this change for review. ( 
https://gerrit.osmocom.org/c/libosmocore/+/28506 )


Change subject: gsm0408_test: add a testcase for gsm48_decode_bearer_cap()
......................................................................

gsm0408_test: add a testcase for gsm48_decode_bearer_cap()

The new testcase contains a Bearer capability IE from Siemens S11E,
which does not use octet 3a (no extension bit set in octet 3).
gsm48_decode_bearer_cap() currently fails to parse it.

Change-Id: Ia19f3f6d80bc09ca3f8d39d35b148a0c0245141f
---
M tests/gsm0408/gsm0408_test.c
A tests/gsm0408/gsm0408_test.err
M tests/gsm0408/gsm0408_test.ok
M tests/testsuite.at
4 files changed, 19 insertions(+), 1 deletion(-)



  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/06/28506/1

diff --git a/tests/gsm0408/gsm0408_test.c b/tests/gsm0408/gsm0408_test.c
index 16bc8e8..7d2df47 100644
--- a/tests/gsm0408/gsm0408_test.c
+++ b/tests/gsm0408/gsm0408_test.c
@@ -65,6 +65,18 @@
        },
 };

+static const uint8_t speech_no3a_lv[] = { 0x01, 0xa0 };
+
+static const struct gsm_mncc_bearer_cap bcap_speech_no3a = {
+       .transfer =     GSM48_BCAP_ITCAP_SPEECH,
+       .mode =         GSM48_BCAP_TMOD_CIRCUIT,
+       .coding =       GSM48_BCAP_CODING_GSM_STD,
+       .radio =        GSM48_BCAP_RRQ_FR_ONLY,
+       .speech_ver = {
+               0, -1,
+       },
+};
+

 struct bcap_test {
        const uint8_t *lv;
@@ -75,6 +87,7 @@
 static const struct bcap_test bcap_tests[] = {
        { csd_9600_v110_lv, &bcap_csd_9600_v110, "CSD 9600/V.110/transparent" },
        { speech_all_lv, &bcap_speech_all, "Speech, all codecs" },
+       { speech_no3a_lv, &bcap_speech_no3a, "Speech, without octet 3a" },
 };

 static int test_bearer_cap()
diff --git a/tests/gsm0408/gsm0408_test.err b/tests/gsm0408/gsm0408_test.err
new file mode 100644
index 0000000..1f0236c
--- /dev/null
+++ b/tests/gsm0408/gsm0408_test.err
@@ -0,0 +1,3 @@
+Incorrect decoded result of Speech, without octet 3a:
+ should: 00 00 00 00 00 00 00 00 00 00 00 00 01 00 00 00 00 00 00 00 00 00 00 
00 ff ff ff ff 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+ is:     00 00 00 00 00 00 00 00 00 00 00 00 01 00 00 00 00 00 00 00 ff ff ff 
ff 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
diff --git a/tests/gsm0408/gsm0408_test.ok b/tests/gsm0408/gsm0408_test.ok
index 97bf083..17a7a0b 100644
--- a/tests/gsm0408/gsm0408_test.ok
+++ b/tests/gsm0408/gsm0408_test.ok
@@ -1,5 +1,6 @@
 Test `CSD 9600/V.110/transparent' passed
 Test `Speech, all codecs' passed
+Test `Speech, without octet 3a' failed
 Simple TMSI encoding test....passed
 Simple IMSI encoding test....passed: [10] 17 08 99 10 07 00 00 00 64 02

diff --git a/tests/testsuite.at b/tests/testsuite.at
index ca133bb..44ae539 100644
--- a/tests/testsuite.at
+++ b/tests/testsuite.at
@@ -153,7 +153,8 @@
 AT_SETUP([gsm0408])
 AT_KEYWORDS([gsm0408])
 cat $abs_srcdir/gsm0408/gsm0408_test.ok > expout
-AT_CHECK([$abs_top_builddir/tests/gsm0408/gsm0408_test], [0], [expout], 
[ignore])
+cat $abs_srcdir/gsm0408/gsm0408_test.err > experr
+AT_CHECK([$abs_top_builddir/tests/gsm0408/gsm0408_test], [0], [expout], 
[experr])
 AT_CLEANUP

 AT_SETUP([gsm48_rest_octets])

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

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: Ia19f3f6d80bc09ca3f8d39d35b148a0c0245141f
Gerrit-Change-Number: 28506
Gerrit-PatchSet: 1
Gerrit-Owner: fixeria <[email protected]>
Gerrit-MessageType: newchange

Reply via email to