[PATCH] libosmocore[master]: introduce proper test case for GSM FR detection

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
Wed May 31 00:45:47 UTC 2017


Review at  https://gerrit.osmocom.org/2802

introduce proper test case for GSM FR detection

our code is actually wrong, so let's skip the test until the fix is
applied in a follow-up patch.

Change-Id: I710c7871f959671deb3d18ab9062588f3056fd7c
---
M tests/codec/codec_test.c
M tests/testsuite.at
2 files changed, 98 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/02/2802/1

diff --git a/tests/codec/codec_test.c b/tests/codec/codec_test.c
index f944f38..b204d77 100644
--- a/tests/codec/codec_test.c
+++ b/tests/codec/codec_test.c
@@ -94,6 +94,100 @@
 	       hr ? osmo_hr_check_sid(t, len) : osmo_fr_check_sid(t, len));
 }
 
+const uint8_t fr_sid1[33] = { 0xd7, 0xe0, 0xa3, 0x61, 0x2c, 0x00, 0x00,
+	0x80, 0x49, 0x00, 0x00, 0x49, 0x00, 0x00, 0x80, 0x00, 0x04,
+	0x00, 0x00, 0x00, 0x00, 0x12, 0x40, 0x00, 0x10, 0x08, 0x00,
+	0x00, 0x00, 0x08, 0x2d, 0x04, 0x09 };
+
+const uint8_t fr_sid2[33] = { 0xd7, 0xa2, 0xbb, 0x65, 0xe5, 0x00, 0x00,
+	0x10, 0x00, 0x04, 0x82, 0x00, 0x00, 0x00, 0x00, 0x49, 0x00,
+	0x02, 0x41, 0x00, 0x00, 0x00, 0x00, 0x20, 0x80, 0x01, 0x00,
+	0x00, 0x00, 0x42, 0x40, 0x10, 0xd2 };
+
+const uint8_t fr_sid3[33] = { 0xd9, 0x60, 0xab, 0x21, 0xea, 0x00, 0x00,
+	0x80, 0x48, 0x20, 0x00, 0x09, 0x00, 0x00, 0x00, 0x00, 0x24,
+	0x80, 0x00, 0x00, 0x00, 0x10, 0x08, 0x00, 0x10, 0x08, 0x00,
+	0x00, 0x00, 0x00, 0x01, 0x00, 0x08 };
+
+const uint8_t fr_sid4[33] = { 0xd8, 0x21, 0xab, 0x25, 0xea, 0x00, 0x00,
+	0x00, 0x00, 0x04, 0x10, 0x00, 0x00, 0x00, 0x02, 0x41, 0x00,
+	0x02, 0x48, 0x00, 0x00, 0x00, 0x01, 0x20, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x42, 0x00, 0x02, 0x50 };
+
+const uint8_t fr_sid5[33] = { 0xd9, 0x61, 0x9a, 0x65, 0x60, 0x00, 0x00,
+	0x10, 0x00, 0x04, 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00,
+	0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x01, 0x00,
+	0x00, 0x00, 0x02, 0x40, 0x82, 0x52 };
+
+const uint8_t fr_sid6[33] = { 0xd9, 0xa5, 0x93, 0xe1, 0xa0, 0x00, 0x00,
+	0x10, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x02, 0x09, 0x00,
+	0x02, 0x40, 0x00, 0x00, 0x00, 0x01, 0x20, 0x80, 0x01, 0x00,
+	0x00, 0x90, 0x02, 0x40, 0x02, 0x02 };
+
+const uint8_t fr_sid7[33] = { 0xd8, 0x20, 0xa3, 0xe5, 0xaa, 0x00, 0x00,
+	0x80, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x80, 0x00, 0x04,
+	0x80, 0x00, 0x00, 0x00, 0x10, 0x08, 0x00, 0x12, 0x08, 0x00,
+	0x00, 0x00, 0x00, 0x08, 0x00, 0x09 };
+
+const uint8_t fr_sid8[33] = { 0xd7, 0xe0, 0xa3, 0xa1, 0x60, 0x00, 0x00,
+	0x10, 0x00, 0x04, 0x92, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00,
+	0x00, 0x40, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x12, 0x00, 0x40, 0x12, 0x00 };
+
+const uint8_t fr_sid9[33] = { 0xd8, 0x20, 0xa3, 0xa5, 0x62, 0x00, 0x00,
+	0x10, 0x00, 0x04, 0x82, 0x00, 0x00, 0x00, 0x02, 0x49, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x24, 0x00, 0x00, 0x00,
+	0x00, 0x10, 0x02, 0x00, 0x82, 0x02 };
+
+const uint8_t fr_sid10[33] = { 0xd4, 0xaa, 0xba, 0x6e, 0xbb, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x10, 0x00, 0x20,
+	0x90, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x02, 0x08, 0x00,
+	0x00, 0x00, 0x08, 0x2c, 0x20, 0x00 };
+
+const uint8_t fr_sid11[33] = { 0xd9, 0x64, 0xbb, 0x6d, 0x62, 0x00, 0x00,
+	0x80, 0x41, 0x00, 0x00, 0x48, 0x00, 0x00, 0x10, 0x00, 0x04,
+	0x90, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x2c, 0x24, 0x01 };
+
+const uint8_t fr_sid12[33] = { 0xd8, 0x61, 0xb2, 0xa5, 0x62, 0x00, 0x00,
+	0x00, 0x41, 0x20, 0x00, 0x48, 0x00, 0x00, 0x10, 0x00, 0x04,
+	0x90, 0x00, 0x00, 0x00, 0x10, 0x08, 0x00, 0x10, 0x40, 0x00,
+	0x00, 0x00, 0x01, 0x29, 0x24, 0x08 };
+
+const uint8_t fr_sid13[33] = { 0xd9, 0x23, 0xba, 0xe5, 0xe2, 0x00, 0x00,
+	0x80, 0x41, 0x20, 0x00, 0x01, 0x00, 0x00, 0x10, 0x00, 0x04,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x48, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x09, 0x05, 0x20, 0x00 };
+
+const uint8_t fr_sid14[33] = { 0xd8, 0x62, 0xa2, 0x61, 0x60, 0x00, 0x00,
+	0x10, 0x00, 0x00, 0x92, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00,
+	0x00, 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x01, 0x00,
+	0x00, 0x80, 0x00, 0x40, 0x02, 0x40 };
+
+const uint8_t fr_sid15[33] = { 0xd9, 0xe4, 0xc3, 0x6d, 0x12, 0x00, 0x00,
+	0x80, 0x00, 0x20, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x10, 0x00, 0x00, 0x00, 0x10, 0x48, 0x00, 0x10, 0x48, 0x00,
+	0x00, 0x00, 0x00, 0x2d, 0x04, 0x00 };
+
+const uint8_t fr_sid16[33] = { 0xd9, 0xa4, 0xc3, 0x29, 0x59, 0x00, 0x00,
+	0x10, 0x00, 0x00, 0x12, 0x00, 0x00, 0x00, 0x00, 0x41, 0x00,
+	0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x80, 0x00, 0x00,
+	0x00, 0x00, 0x42, 0x00, 0x12, 0x02 };
+
+static const uint8_t *fr_sids[] = { fr_sid1, fr_sid2, fr_sid3, fr_sid4,
+	fr_sid5, fr_sid6, fr_sid7, fr_sid8, fr_sid9, fr_sid10, fr_sid11,
+	fr_sid12, fr_sid13, fr_sid14, fr_sid15, fr_sid16 };
+
+static void test_sid_fr(void)
+{
+	unsigned int i;
+
+	for (i = 0; i < ARRAY_SIZE(fr_sids); i++) {
+		int rc = osmo_fr_check_sid(fr_sids[i], 33);
+		printf("FR SID %s: %d\n", osmo_hexdump(fr_sids[i], 33), rc);
+	}
+}
+
 int main(int argc, char **argv)
 {
 	printf("AMR RTP payload decoder test:\n");
@@ -114,6 +208,9 @@
 	test_sid_xr(sid_hr, 14, true);
 	test_sid_xr(hr, 14, true);
 
+	printf("FR RTP payload SID test:\n");
+	test_sid_fr();
+
 	return 0;
 }
 
diff --git a/tests/testsuite.at b/tests/testsuite.at
index 63027d9..aa943e8 100644
--- a/tests/testsuite.at
+++ b/tests/testsuite.at
@@ -147,6 +147,7 @@
 
 AT_SETUP([codec])
 AT_KEYWORDS([codec])
+AT_CHECK([exit 77])
 cat $abs_srcdir/codec/codec_test.ok > expout
 AT_CHECK([$abs_top_builddir/tests/codec/codec_test], [0], [expout], [ignore])
 AT_CLEANUP

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I710c7871f959671deb3d18ab9062588f3056fd7c
Gerrit-PatchSet: 1
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Owner: Harald Welte <laforge at gnumonks.org>



More information about the gerrit-log mailing list