diff options
author | Vadim Yanitskiy <axilirator@gmail.com> | 2017-01-19 17:01:15 +0700 |
---|---|---|
committer | Vadim Yanitskiy <axilirator@gmail.com> | 2017-04-30 02:59:42 +0700 |
commit | 33e03065a508f1238056f36841b97d38083ac18b (patch) | |
tree | 70d51d4763293829835b53d71dca1113920f788a | |
parent | f74cfd35acadbebe7ccd9fc02d05920958f43ad3 (diff) |
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
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | tests/Makefile.am | 17 | ||||
-rw-r--r-- | tests/conv/conv.h | 4 | ||||
-rw-r--r-- | tests/conv/conv_gsm0503_test.c | 28 | ||||
-rw-r--r-- | tests/conv/conv_gsm0503_test.ok | 304 | ||||
-rw-r--r-- | tests/testsuite.at | 6 |
6 files changed, 355 insertions, 5 deletions
@@ -122,6 +122,7 @@ src/gsm/gsm0503_conv.c 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 3ce76208..d9816ef4 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -15,7 +15,8 @@ check_PROGRAMS = timer/timer_test sms/sms_test ussd/ussd_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 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 @@ -64,6 +65,10 @@ bits_bitcomp_test_LDADD = $(top_builddir)/src/libosmocore.la 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 = $(AM_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 @@ EXTRA_DIST = testsuite.at $(srcdir)/package.m4 $(TESTSUITE) \ 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 @@ AUTOTEST = $(AUTOM4TE) --language=autotest $(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 676c5aff..0604859c 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 00000000..67041290 --- /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 00000000..e6e25727 --- /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 7ee01645..2f9cfe74 100644 --- a/tests/testsuite.at +++ b/tests/testsuite.at @@ -51,6 +51,12 @@ cat $abs_srcdir/conv/conv_test.ok > expout 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 |