[PATCH] libosmocore[master]: tests/conv: add GSM 05.03 specific test

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

Vadim Yanitskiy gerrit-no-reply at lists.osmocom.org
Sat Apr 29 19:53:30 UTC 2017


Hello Max, Harald Welte, Jenkins Builder,

I'd like you to reexamine a change.  Please visit

    https://gerrit.osmocom.org/1628

to look at the new patch set (#6).

tests/conv: add GSM 05.03 specific test

This change extends the convolutional code test coverage, adding
the GSM 05.03 specific test vectors, generated by the conv_gen.py.

Inspired by Tom's patch:
http://lists.osmocom.org/pipermail/openbsc/2014-April/007364.html

Change-Id: I76d1cd4032d2f74c5bb93bde4fab99aa655b7f1a
---
M .gitignore
M tests/Makefile.am
M tests/conv/conv.h
A tests/conv/conv_gsm0503_test.c
A tests/conv/conv_gsm0503_test.ok
M tests/testsuite.at
6 files changed, 355 insertions(+), 5 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/28/1628/6

diff --git a/.gitignore b/.gitignore
index 4c6a78f..5111b25 100644
--- a/.gitignore
+++ b/.gitignore
@@ -122,6 +122,7 @@
 include/osmocom/core/crc*gen.h
 include/osmocom/core/bit*gen.h
 include/osmocom/gsm/gsm0503.h
+tests/conv/gsm0503_test_vectors.c
 
 # vi files
 *.sw?
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 3ce7620..ce7e0cb 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -15,7 +15,8 @@
 		 bitvec/bitvec_test msgb/msgb_test bits/bitcomp_test	\
 		 tlv/tlv_test gsup/gsup_test oap/oap_test fsm/fsm_test	\
 		 write_queue/wqueue_test socket/socket_test		\
-		 coding/coding_test abis/abis_test
+		 coding/coding_test conv/conv_gsm0503_test		\
+		 abis/abis_test
 
 if ENABLE_MSGFILE
 check_PROGRAMS += msgfile/msgfile_test
@@ -63,6 +64,10 @@
 
 conv_conv_test_SOURCES = conv/conv_test.c conv/conv.c
 conv_conv_test_LDADD = $(top_builddir)/src/libosmocore.la $(top_builddir)/src/gsm/libgsmint.la
+
+conv_conv_gsm0503_test_SOURCES = conv/conv_gsm0503_test.c conv/conv.c conv/gsm0503_test_vectors.c
+conv_conv_gsm0503_test_LDADD = $(top_builddir)/src/libosmocore.la $(top_builddir)/src/gsm/libgsmint.la
+conv_conv_gsm0503_test_CPPFLAGS = -I$(top_srcdir)/tests/conv
 
 gsm0808_gsm0808_test_SOURCES = gsm0808/gsm0808_test.c
 gsm0808_gsm0808_test_LDADD = $(top_builddir)/src/libosmocore.la $(top_builddir)/src/gsm/libosmogsm.la
@@ -198,9 +203,11 @@
 	     socket/socket_test.err coding/coding_test.ok		\
 	     osmo-auc-gen/osmo-auc-gen_test.sh				\
 	     osmo-auc-gen/osmo-auc-gen_test.ok				\
-	     osmo-auc-gen/osmo-auc-gen_test.err
+	     osmo-auc-gen/osmo-auc-gen_test.err				\
+	     conv/conv_gsm0503_test.ok
 
-DISTCLEANFILES = atconfig atlocal
+DISTCLEANFILES = atconfig atlocal conv/gsm0503_test_vectors.c
+BUILT_SOURCES = conv/gsm0503_test_vectors.c
 noinst_HEADERS = conv/conv.h
 
 TESTSUITE = $(srcdir)/testsuite
@@ -221,3 +228,7 @@
 $(TESTSUITE): $(srcdir)/testsuite.at $(srcdir)/package.m4
 	$(AUTOTEST) -I '$(srcdir)' -o $@.tmp $@.at
 	mv $@.tmp $@
+
+conv/gsm0503_test_vectors.c: $(top_srcdir)/utils/conv_gen.py $(top_srcdir)/utils/conv_codes_gsm.py
+	$(AM_V_GEN)python2 $(top_srcdir)/utils/conv_gen.py gen_vectors gsm \
+		--target-path $(builddir)/conv
diff --git a/tests/conv/conv.h b/tests/conv/conv.h
index 676c5af..0604859 100644
--- a/tests/conv/conv.h
+++ b/tests/conv/conv.h
@@ -1,7 +1,7 @@
 #pragma once
 
-#define MAX_LEN_BITS	512
-#define MAX_LEN_BYTES	(512/8)
+#define MAX_LEN_BITS	2048
+#define MAX_LEN_BYTES	(2048 / 8)
 
 struct conv_test_vector {
 	const char *name;
diff --git a/tests/conv/conv_gsm0503_test.c b/tests/conv/conv_gsm0503_test.c
new file mode 100644
index 0000000..6704129
--- /dev/null
+++ b/tests/conv/conv_gsm0503_test.c
@@ -0,0 +1,28 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <time.h>
+
+#include <osmocom/core/bits.h>
+#include <osmocom/core/conv.h>
+#include <osmocom/core/utils.h>
+#include <osmocom/gsm/gsm0503.h>
+
+#include "conv.h"
+
+/* Forward declaration of GSM 05.03 specific test vectors */
+extern const struct conv_test_vector gsm0503_vectors[];
+extern const int gsm0503_vectors_len;
+
+int main(int argc, char *argv[])
+{
+	int rc, i;
+
+	for (i = 0; i < gsm0503_vectors_len; i++) {
+		rc = do_check(&gsm0503_vectors[i]);
+		if (rc)
+			return rc;
+	}
+
+	return 0;
+}
diff --git a/tests/conv/conv_gsm0503_test.ok b/tests/conv/conv_gsm0503_test.ok
new file mode 100644
index 0000000..e6e2572
--- /dev/null
+++ b/tests/conv/conv_gsm0503_test.ok
@@ -0,0 +1,304 @@
+[+] Testing: gsm0503_xcch
+[.] Input length  : ret = 224  exp = 224 -> OK
+[.] Output length : ret = 456  exp = 456 -> OK
+[.] Random vector checks:
+[..] Encoding / Decoding cycle : OK
+[..] Encoding / Decoding cycle : OK
+[..] Encoding / Decoding cycle : OK
+
+[+] Testing: gsm0503_rach
+[.] Input length  : ret =  14  exp =  14 -> OK
+[.] Output length : ret =  36  exp =  36 -> OK
+[.] Random vector checks:
+[..] Encoding / Decoding cycle : OK
+[..] Encoding / Decoding cycle : OK
+[..] Encoding / Decoding cycle : OK
+
+[+] Testing: gsm0503_sch
+[.] Input length  : ret =  35  exp =  35 -> OK
+[.] Output length : ret =  78  exp =  78 -> OK
+[.] Random vector checks:
+[..] Encoding / Decoding cycle : OK
+[..] Encoding / Decoding cycle : OK
+[..] Encoding / Decoding cycle : OK
+
+[+] Testing: gsm0503_cs2
+[.] Input length  : ret = 290  exp = 290 -> OK
+[.] Output length : ret = 456  exp = 456 -> OK
+[.] Random vector checks:
+[..] Encoding / Decoding cycle : OK
+[..] Encoding / Decoding cycle : OK
+[..] Encoding / Decoding cycle : OK
+
+[+] Testing: gsm0503_cs3
+[.] Input length  : ret = 334  exp = 334 -> OK
+[.] Output length : ret = 456  exp = 456 -> OK
+[.] Random vector checks:
+[..] Encoding / Decoding cycle : OK
+[..] Encoding / Decoding cycle : OK
+[..] Encoding / Decoding cycle : OK
+
+[+] Testing: gsm0503_cs2_np
+[.] Input length  : ret = 290  exp = 290 -> OK
+[.] Output length : ret = 588  exp = 588 -> OK
+[.] Random vector checks:
+[..] Encoding / Decoding cycle : OK
+[..] Encoding / Decoding cycle : OK
+[..] Encoding / Decoding cycle : OK
+
+[+] Testing: gsm0503_cs3_np
+[.] Input length  : ret = 334  exp = 334 -> OK
+[.] Output length : ret = 676  exp = 676 -> OK
+[.] Random vector checks:
+[..] Encoding / Decoding cycle : OK
+[..] Encoding / Decoding cycle : OK
+[..] Encoding / Decoding cycle : OK
+
+[+] Testing: gsm0503_tch_afs_12_2
+[.] Input length  : ret = 250  exp = 250 -> OK
+[.] Output length : ret = 448  exp = 448 -> OK
+[.] Random vector checks:
+[..] Encoding / Decoding cycle : OK
+[..] Encoding / Decoding cycle : OK
+[..] Encoding / Decoding cycle : OK
+
+[+] Testing: gsm0503_tch_afs_10_2
+[.] Input length  : ret = 210  exp = 210 -> OK
+[.] Output length : ret = 448  exp = 448 -> OK
+[.] Random vector checks:
+[..] Encoding / Decoding cycle : OK
+[..] Encoding / Decoding cycle : OK
+[..] Encoding / Decoding cycle : OK
+
+[+] Testing: gsm0503_tch_afs_7_95
+[.] Input length  : ret = 165  exp = 165 -> OK
+[.] Output length : ret = 448  exp = 448 -> OK
+[.] Random vector checks:
+[..] Encoding / Decoding cycle : OK
+[..] Encoding / Decoding cycle : OK
+[..] Encoding / Decoding cycle : OK
+
+[+] Testing: gsm0503_tch_afs_7_4
+[.] Input length  : ret = 154  exp = 154 -> OK
+[.] Output length : ret = 448  exp = 448 -> OK
+[.] Random vector checks:
+[..] Encoding / Decoding cycle : OK
+[..] Encoding / Decoding cycle : OK
+[..] Encoding / Decoding cycle : OK
+
+[+] Testing: gsm0503_tch_afs_6_7
+[.] Input length  : ret = 140  exp = 140 -> OK
+[.] Output length : ret = 448  exp = 448 -> OK
+[.] Random vector checks:
+[..] Encoding / Decoding cycle : OK
+[..] Encoding / Decoding cycle : OK
+[..] Encoding / Decoding cycle : OK
+
+[+] Testing: gsm0503_tch_afs_5_9
+[.] Input length  : ret = 124  exp = 124 -> OK
+[.] Output length : ret = 448  exp = 448 -> OK
+[.] Random vector checks:
+[..] Encoding / Decoding cycle : OK
+[..] Encoding / Decoding cycle : OK
+[..] Encoding / Decoding cycle : OK
+
+[+] Testing: gsm0503_tch_afs_5_15
+[.] Input length  : ret = 109  exp = 109 -> OK
+[.] Output length : ret = 448  exp = 448 -> OK
+[.] Random vector checks:
+[..] Encoding / Decoding cycle : OK
+[..] Encoding / Decoding cycle : OK
+[..] Encoding / Decoding cycle : OK
+
+[+] Testing: gsm0503_tch_afs_4_75
+[.] Input length  : ret = 101  exp = 101 -> OK
+[.] Output length : ret = 448  exp = 448 -> OK
+[.] Random vector checks:
+[..] Encoding / Decoding cycle : OK
+[..] Encoding / Decoding cycle : OK
+[..] Encoding / Decoding cycle : OK
+
+[+] Testing: gsm0503_tch_fr
+[.] Input length  : ret = 185  exp = 185 -> OK
+[.] Output length : ret = 378  exp = 378 -> OK
+[.] Random vector checks:
+[..] Encoding / Decoding cycle : OK
+[..] Encoding / Decoding cycle : OK
+[..] Encoding / Decoding cycle : OK
+
+[+] Testing: gsm0503_tch_hr
+[.] Input length  : ret =  98  exp =  98 -> OK
+[.] Output length : ret = 211  exp = 211 -> OK
+[.] Random vector checks:
+[..] Encoding / Decoding cycle : OK
+[..] Encoding / Decoding cycle : OK
+[..] Encoding / Decoding cycle : OK
+
+[+] Testing: gsm0503_tch_ahs_7_95
+[.] Input length  : ret = 129  exp = 129 -> OK
+[.] Output length : ret = 188  exp = 188 -> OK
+[.] Random vector checks:
+[..] Encoding / Decoding cycle : OK
+[..] Encoding / Decoding cycle : OK
+[..] Encoding / Decoding cycle : OK
+
+[+] Testing: gsm0503_tch_ahs_7_4
+[.] Input length  : ret = 126  exp = 126 -> OK
+[.] Output length : ret = 196  exp = 196 -> OK
+[.] Random vector checks:
+[..] Encoding / Decoding cycle : OK
+[..] Encoding / Decoding cycle : OK
+[..] Encoding / Decoding cycle : OK
+
+[+] Testing: gsm0503_tch_ahs_6_7
+[.] Input length  : ret = 116  exp = 116 -> OK
+[.] Output length : ret = 200  exp = 200 -> OK
+[.] Random vector checks:
+[..] Encoding / Decoding cycle : OK
+[..] Encoding / Decoding cycle : OK
+[..] Encoding / Decoding cycle : OK
+
+[+] Testing: gsm0503_tch_ahs_5_9
+[.] Input length  : ret = 108  exp = 108 -> OK
+[.] Output length : ret = 208  exp = 208 -> OK
+[.] Random vector checks:
+[..] Encoding / Decoding cycle : OK
+[..] Encoding / Decoding cycle : OK
+[..] Encoding / Decoding cycle : OK
+
+[+] Testing: gsm0503_tch_ahs_5_15
+[.] Input length  : ret =  97  exp =  97 -> OK
+[.] Output length : ret = 212  exp = 212 -> OK
+[.] Random vector checks:
+[..] Encoding / Decoding cycle : OK
+[..] Encoding / Decoding cycle : OK
+[..] Encoding / Decoding cycle : OK
+
+[+] Testing: gsm0503_tch_ahs_4_75
+[.] Input length  : ret =  89  exp =  89 -> OK
+[.] Output length : ret = 212  exp = 212 -> OK
+[.] Random vector checks:
+[..] Encoding / Decoding cycle : OK
+[..] Encoding / Decoding cycle : OK
+[..] Encoding / Decoding cycle : OK
+
+[+] Testing: gsm0503_mcs1_dl_hdr
+[.] Input length  : ret =  36  exp =  36 -> OK
+[.] Output length : ret = 108  exp = 108 -> OK
+[.] Random vector checks:
+[..] Encoding / Decoding cycle : OK
+[..] Encoding / Decoding cycle : OK
+[..] Encoding / Decoding cycle : OK
+
+[+] Testing: gsm0503_mcs1_ul_hdr
+[.] Input length  : ret =  39  exp =  39 -> OK
+[.] Output length : ret = 117  exp = 117 -> OK
+[.] Random vector checks:
+[..] Encoding / Decoding cycle : OK
+[..] Encoding / Decoding cycle : OK
+[..] Encoding / Decoding cycle : OK
+
+[+] Testing: gsm0503_mcs1
+[.] Input length  : ret = 190  exp = 190 -> OK
+[.] Output length : ret = 588  exp = 588 -> OK
+[.] Random vector checks:
+[..] Encoding / Decoding cycle : OK
+[..] Encoding / Decoding cycle : OK
+[..] Encoding / Decoding cycle : OK
+
+[+] Testing: gsm0503_mcs2
+[.] Input length  : ret = 238  exp = 238 -> OK
+[.] Output length : ret = 732  exp = 732 -> OK
+[.] Random vector checks:
+[..] Encoding / Decoding cycle : OK
+[..] Encoding / Decoding cycle : OK
+[..] Encoding / Decoding cycle : OK
+
+[+] Testing: gsm0503_mcs3
+[.] Input length  : ret = 310  exp = 310 -> OK
+[.] Output length : ret = 948  exp = 948 -> OK
+[.] Random vector checks:
+[..] Encoding / Decoding cycle : OK
+[..] Encoding / Decoding cycle : OK
+[..] Encoding / Decoding cycle : OK
+
+[+] Testing: gsm0503_mcs4
+[.] Input length  : ret = 366  exp = 366 -> OK
+[.] Output length : ret = 1116  exp = 1116 -> OK
+[.] Random vector checks:
+[..] Encoding / Decoding cycle : OK
+[..] Encoding / Decoding cycle : OK
+[..] Encoding / Decoding cycle : OK
+
+[+] Testing: gsm0503_mcs5_dl_hdr
+[.] Input length  : ret =  33  exp =  33 -> OK
+[.] Output length : ret =  99  exp =  99 -> OK
+[.] Random vector checks:
+[..] Encoding / Decoding cycle : OK
+[..] Encoding / Decoding cycle : OK
+[..] Encoding / Decoding cycle : OK
+
+[+] Testing: gsm0503_mcs5_ul_hdr
+[.] Input length  : ret =  45  exp =  45 -> OK
+[.] Output length : ret = 135  exp = 135 -> OK
+[.] Random vector checks:
+[..] Encoding / Decoding cycle : OK
+[..] Encoding / Decoding cycle : OK
+[..] Encoding / Decoding cycle : OK
+
+[+] Testing: gsm0503_mcs5
+[.] Input length  : ret = 462  exp = 462 -> OK
+[.] Output length : ret = 1404  exp = 1404 -> OK
+[.] Random vector checks:
+[..] Encoding / Decoding cycle : OK
+[..] Encoding / Decoding cycle : OK
+[..] Encoding / Decoding cycle : OK
+
+[+] Testing: gsm0503_mcs6
+[.] Input length  : ret = 606  exp = 606 -> OK
+[.] Output length : ret = 1836  exp = 1836 -> OK
+[.] Random vector checks:
+[..] Encoding / Decoding cycle : OK
+[..] Encoding / Decoding cycle : OK
+[..] Encoding / Decoding cycle : OK
+
+[+] Testing: gsm0503_mcs7_dl_hdr
+[.] Input length  : ret =  45  exp =  45 -> OK
+[.] Output length : ret = 135  exp = 135 -> OK
+[.] Random vector checks:
+[..] Encoding / Decoding cycle : OK
+[..] Encoding / Decoding cycle : OK
+[..] Encoding / Decoding cycle : OK
+
+[+] Testing: gsm0503_mcs7_ul_hdr
+[.] Input length  : ret =  54  exp =  54 -> OK
+[.] Output length : ret = 162  exp = 162 -> OK
+[.] Random vector checks:
+[..] Encoding / Decoding cycle : OK
+[..] Encoding / Decoding cycle : OK
+[..] Encoding / Decoding cycle : OK
+
+[+] Testing: gsm0503_mcs7
+[.] Input length  : ret = 462  exp = 462 -> OK
+[.] Output length : ret = 1404  exp = 1404 -> OK
+[.] Random vector checks:
+[..] Encoding / Decoding cycle : OK
+[..] Encoding / Decoding cycle : OK
+[..] Encoding / Decoding cycle : OK
+
+[+] Testing: gsm0503_mcs8
+[.] Input length  : ret = 558  exp = 558 -> OK
+[.] Output length : ret = 1692  exp = 1692 -> OK
+[.] Random vector checks:
+[..] Encoding / Decoding cycle : OK
+[..] Encoding / Decoding cycle : OK
+[..] Encoding / Decoding cycle : OK
+
+[+] Testing: gsm0503_mcs9
+[.] Input length  : ret = 606  exp = 606 -> OK
+[.] Output length : ret = 1836  exp = 1836 -> OK
+[.] Random vector checks:
+[..] Encoding / Decoding cycle : OK
+[..] Encoding / Decoding cycle : OK
+[..] Encoding / Decoding cycle : OK
+
diff --git a/tests/testsuite.at b/tests/testsuite.at
index 7ee0164..2f9cfe7 100644
--- a/tests/testsuite.at
+++ b/tests/testsuite.at
@@ -51,6 +51,12 @@
 AT_CHECK([$abs_top_builddir/tests/conv/conv_test], [0], [expout])
 AT_CLEANUP
 
+AT_SETUP([conv_gsm0503])
+AT_KEYWORDS([conv_gsm0503])
+cat $abs_srcdir/conv/conv_gsm0503_test.ok > expout
+AT_CHECK([$abs_top_builddir/tests/conv/conv_gsm0503_test], [0], [expout])
+AT_CLEANUP
+
 AT_SETUP([coding])
 AT_KEYWORDS([coding])
 cat $abs_srcdir/coding/coding_test.ok > expout

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

Gerrit-MessageType: newpatchset
Gerrit-Change-Id: I76d1cd4032d2f74c5bb93bde4fab99aa655b7f1a
Gerrit-PatchSet: 6
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Owner: Vadim Yanitskiy <axilirator at gmail.com>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Max <msuraev at sysmocom.de>
Gerrit-Reviewer: Neels Hofmeyr <nhofmeyr at sysmocom.de>
Gerrit-Reviewer: Tom Tsou <tom at tsou.cc>
Gerrit-Reviewer: Vadim Yanitskiy <axilirator at gmail.com>
Gerrit-Reviewer: tnt <tnt at 246tNt.com>



More information about the gerrit-log mailing list