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
This commit is contained in:
Harald Welte 2017-05-31 02:42:46 +02:00
parent 0d49f47aeb
commit 3851e8ea7a
2 changed files with 98 additions and 0 deletions

View File

@ -94,6 +94,100 @@ static void test_sid_xr(uint8_t *t, size_t len, bool hr)
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 @@ int main(int argc, char **argv)
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;
}

View File

@ -147,6 +147,7 @@ AT_CLEANUP
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