[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
Thu Jan 19 10:15:19 UTC 2017


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

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
A tests/conv/conv_gsm0503_test.c
A tests/conv/conv_gsm0503_test.ok
M tests/testsuite.at
5 files changed, 229 insertions(+), 3 deletions(-)


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

diff --git a/.gitignore b/.gitignore
index c1bde0f..d5caa61 100644
--- a/.gitignore
+++ b/.gitignore
@@ -117,6 +117,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 889eb8d..f8761de 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -14,7 +14,7 @@
 		 smscb/gsm0341_test stats/stats_test			\
 		 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
+		 write_queue/wqueue_test conv/conv_gsm0503_test
 
 if ENABLE_MSGFILE
 check_PROGRAMS += msgfile/msgfile_test
@@ -56,6 +56,9 @@
 
 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
 
 gsm0808_gsm0808_test_SOURCES = gsm0808/gsm0808_test.c
 gsm0808_gsm0808_test_LDADD = $(top_builddir)/src/libosmocore.la $(top_builddir)/src/gsm/libosmogsm.la
@@ -176,9 +179,9 @@
 	     bitvec/bitvec_test.ok msgb/msgb_test.ok bits/bitcomp_test.ok \
 	     sim/sim_test.ok tlv/tlv_test.ok gsup/gsup_test.ok		\
 	     oap/oap_test.ok fsm/fsm_test.ok fsm/fsm_test.err		\
-	     write_queue/wqueue_test.ok
+	     write_queue/wqueue_test.ok conv/conv_gsm0503_test.ok
 
-DISTCLEANFILES = atconfig atlocal
+DISTCLEANFILES = atconfig atlocal conv/gsm0503_test_vectors.c
 noinst_HEADERS = conv/conv.h
 
 TESTSUITE = $(srcdir)/testsuite
@@ -199,3 +202,8 @@
 $(TESTSUITE): $(srcdir)/testsuite.at $(srcdir)/package.m4
 	$(AUTOTEST) -I '$(srcdir)' -o $@.tmp $@.at
 	mv $@.tmp $@
+
+conv/gsm0503_test_vectors.c:
+	$(AM_V_GEN)python2 $(top_srcdir)/utils/conv_gen.py \
+		--action gen_vectors --code-family gsm \
+		--target-path $(top_srcdir)/tests/conv/
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..05761f2
--- /dev/null
+++ b/tests/conv/conv_gsm0503_test.ok
@@ -0,0 +1,183 @@
+[+] 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_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
diff --git a/tests/testsuite.at b/tests/testsuite.at
index 426c74c..be6f9bc 100644
--- a/tests/testsuite.at
+++ b/tests/testsuite.at
@@ -39,6 +39,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([msgb])
 AT_KEYWORDS([msgb])
 cat $abs_srcdir/msgb/msgb_test.ok > expout

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I76d1cd4032d2f74c5bb93bde4fab99aa655b7f1a
Gerrit-PatchSet: 1
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Owner: Vadim Yanitskiy <axilirator at gmail.com>



More information about the gerrit-log mailing list