diff options
author | Philipp Maier <pmaier@sysmocom.de> | 2018-08-16 14:19:52 +0200 |
---|---|---|
committer | Philipp Maier <pmaier@sysmocom.de> | 2018-08-16 18:14:10 +0200 |
commit | 1c3240c2f13d8e7bc2849c001ba794a446366adc (patch) | |
tree | 39efbb3d46c1c52e05b621817cfbc4100e12cadf /tests | |
parent | 22220915600248007fec4cf78d9346fad4769120 (diff) |
cosmetic: separate measurement testcase definitions
the testcase definitions in meas_test.c that define different test
situations for uplink measurement are quite large. Lets have them in a
separate file so that the code meas_test.c is easier to maintain.
- Move all mtc* and ulm* structs as well as the struct definitions
to meas_testcase.h.
Change-Id: I90139ec535056d2cea6de10e77f435d807ce496e
Related: OS#2987
Diffstat (limited to 'tests')
-rw-r--r-- | tests/meas/Makefile.am | 2 | ||||
-rw-r--r-- | tests/meas/meas_test.c | 156 | ||||
-rw-r--r-- | tests/meas/meas_testcases.h | 151 |
3 files changed, 153 insertions, 156 deletions
diff --git a/tests/meas/Makefile.am b/tests/meas/Makefile.am index 3c83e527..d8fa1182 100644 --- a/tests/meas/Makefile.am +++ b/tests/meas/Makefile.am @@ -2,7 +2,7 @@ AM_CPPFLAGS = $(all_includes) -I$(top_srcdir)/include AM_CFLAGS = -Wall $(LIBOSMOCORE_CFLAGS) $(LIBOSMOGSM_CFLAGS) $(LIBOSMOCODEC_CFLAGS) $(LIBOSMOTRAU_CFLAGS) $(LIBOSMOABIS_CFLAGS) LDADD = $(LIBOSMOCORE_LIBS) $(LIBOSMOGSM_LIBS) $(LIBOSMOCODEC_LIBS) $(LIBOSMOTRAU_LIBS) $(LIBOSMOABIS_LIBS) noinst_PROGRAMS = meas_test -noinst_HEADERS = sysmobts_fr_samples.h +noinst_HEADERS = sysmobts_fr_samples.h meas_testcases.h EXTRA_DIST = meas_test.ok meas_test_SOURCES = meas_test.c diff --git a/tests/meas/meas_test.c b/tests/meas/meas_test.c index e8893450..2ba44d38 100644 --- a/tests/meas/meas_test.c +++ b/tests/meas/meas_test.c @@ -21,6 +21,7 @@ struct fn_sample { }; #include "sysmobts_fr_samples.h" +#include "meas_testcases.h" void test_fn_sample(struct fn_sample *s, unsigned int len, uint8_t pchan, uint8_t tsmap) { @@ -63,161 +64,6 @@ void test_fn_sample(struct fn_sample *s, unsigned int len, uint8_t pchan, uint8_ OSMO_ASSERT(tsmap_result == tsmap); } -#define ULM(ber, ta, neg_rssi) \ - { .ber10k = (ber), .ta_offs_256bits = (ta), .c_i = 1.0, .is_sub = 0, .inv_rssi = (neg_rssi) } - -struct meas_testcase { - const char *name; - /* input data */ - const struct bts_ul_meas *ulm; - unsigned int ulm_count; - uint32_t final_fn; - /* results */ - struct { - int success; - uint8_t rx_lev_full; - uint8_t rx_qual_full; - int16_t toa256_mean; - int16_t toa256_min; - int16_t toa256_max; - uint16_t toa256_std_dev; - } res; -}; - -static struct bts_ul_meas ulm1[] = { - ULM(0, 0, 90), - ULM(0, 256, 90), - ULM(0, -256, 90), -}; -static const struct meas_testcase mtc1 = { - .name = "TOA256 Min-Max negative/positive", - .ulm = ulm1, - .ulm_count = ARRAY_SIZE(ulm1), - .final_fn = 25, - .res = { - .success = 1, - .rx_lev_full = 110-90, - .rx_qual_full = 0, - .toa256_mean = 0, - .toa256_max = 256, - .toa256_min = -256, - .toa256_std_dev = 209, - }, -}; - - -static struct bts_ul_meas ulm2[] = { - ULM(0, 256, 90), - ULM(0, 258, 90), - ULM(0, 254, 90), - ULM(0, 258, 90), - ULM(0, 254, 90), - ULM(0, 256, 90), -}; -static const struct meas_testcase mtc2 = { - .name = "TOA256 small jitter around 256", - .ulm = ulm2, - .ulm_count = ARRAY_SIZE(ulm2), - .final_fn = 25, - .res = { - .success = 1, - .rx_lev_full = 110-90, - .rx_qual_full = 0, - .toa256_mean = 256, - .toa256_max = 258, - .toa256_min = 254, - .toa256_std_dev = 1, - }, -}; - -static struct bts_ul_meas ulm3[] = { - ULM(0, 0, 90), - ULM(0, 0, 80), - ULM(0, 0, 80), - ULM(0, 0, 100), - ULM(0, 0, 100), -}; -static const struct meas_testcase mtc3 = { - .name = "RxLEv averaging", - .ulm = ulm3, - .ulm_count = ARRAY_SIZE(ulm3), - .final_fn = 25, - .res = { - .success = 1, - .rx_lev_full = 110-90, - .rx_qual_full = 0, - .toa256_mean = 0, - .toa256_max = 0, - .toa256_min = 0, - .toa256_std_dev = 0, - }, -}; - -static struct bts_ul_meas ulm4[] = { -}; -static const struct meas_testcase mtc4 = { - .name = "Empty measurements", - .ulm = ulm4, - .ulm_count = ARRAY_SIZE(ulm4), - .final_fn = 25, - .res = { - .success = 0, - .rx_lev_full = 0, - .rx_qual_full = 0, - .toa256_mean = 0, - .toa256_max = 0, - .toa256_min = 0, - .toa256_std_dev = 0, - }, -}; - -static struct bts_ul_meas ulm5[] = { - /* one 104 multiframe can at max contain 26 blocks (TCH/F), - * each of which can at maximum be 64 bits in advance (TA range) */ - ULM(0, 64*256, 90), - ULM(0, 64*256, 90), - ULM(0, 64*256, 90), - ULM(0, 64*256, 90), - ULM(0, 64*256, 90), - ULM(0, 64*256, 90), - ULM(0, 64*256, 90), - ULM(0, 64*256, 90), - ULM(0, 64*256, 90), - ULM(0, 64*256, 90), - ULM(0, 64*256, 90), - ULM(0, 64*256, 90), - ULM(0, 64*256, 90), - ULM(0, 64*256, 90), - ULM(0, 64*256, 90), - ULM(0, 64*256, 90), - ULM(0, 64*256, 90), - ULM(0, 64*256, 90), - ULM(0, 64*256, 90), - ULM(0, 64*256, 90), - ULM(0, 64*256, 90), - ULM(0, 64*256, 90), - ULM(0, 64*256, 90), - ULM(0, 64*256, 90), - ULM(0, 64*256, 90), - ULM(0, 64*256, 90), -}; -static const struct meas_testcase mtc5 = { - .name = "TOA256 26 blocks with max TOA256", - .ulm = ulm5, - .ulm_count = ARRAY_SIZE(ulm5), - .final_fn = 25, - .res = { - .success = 1, - .rx_lev_full = 110-90, - .rx_qual_full = 0, - .toa256_mean = 64*256, - .toa256_max = 64*256, - .toa256_min = 64*256, - .toa256_std_dev = 0, - }, -}; - - static void reset_lchan_meas(struct gsm_lchan *lchan) { lchan->state = LCHAN_S_ACTIVE; diff --git a/tests/meas/meas_testcases.h b/tests/meas/meas_testcases.h new file mode 100644 index 00000000..ff74a207 --- /dev/null +++ b/tests/meas/meas_testcases.h @@ -0,0 +1,151 @@ +#define ULM(ber, ta, neg_rssi) \ + { .ber10k = (ber), .ta_offs_256bits = (ta), .c_i = 1.0, .is_sub = 0, .inv_rssi = (neg_rssi) } + +struct meas_testcase { + const char *name; + /* input data */ + const struct bts_ul_meas *ulm; + unsigned int ulm_count; + uint32_t final_fn; + /* results */ + struct { + int success; + uint8_t rx_lev_full; + uint8_t rx_qual_full; + int16_t toa256_mean; + int16_t toa256_min; + int16_t toa256_max; + uint16_t toa256_std_dev; + } res; +}; + +static struct bts_ul_meas ulm1[] = { + ULM(0, 0, 90), + ULM(0, 256, 90), + ULM(0, -256, 90), +}; +static const struct meas_testcase mtc1 = { + .name = "TOA256 Min-Max negative/positive", + .ulm = ulm1, + .ulm_count = ARRAY_SIZE(ulm1), + .final_fn = 25, + .res = { + .success = 1, + .rx_lev_full = 110-90, + .rx_qual_full = 0, + .toa256_mean = 0, + .toa256_max = 256, + .toa256_min = -256, + .toa256_std_dev = 209, + }, +}; + +static struct bts_ul_meas ulm2[] = { + ULM(0, 256, 90), + ULM(0, 258, 90), + ULM(0, 254, 90), + ULM(0, 258, 90), + ULM(0, 254, 90), + ULM(0, 256, 90), +}; +static const struct meas_testcase mtc2 = { + .name = "TOA256 small jitter around 256", + .ulm = ulm2, + .ulm_count = ARRAY_SIZE(ulm2), + .final_fn = 25, + .res = { + .success = 1, + .rx_lev_full = 110-90, + .rx_qual_full = 0, + .toa256_mean = 256, + .toa256_max = 258, + .toa256_min = 254, + .toa256_std_dev = 1, + }, +}; + +static struct bts_ul_meas ulm3[] = { + ULM(0, 0, 90), + ULM(0, 0, 80), + ULM(0, 0, 80), + ULM(0, 0, 100), + ULM(0, 0, 100), +}; +static const struct meas_testcase mtc3 = { + .name = "RxLEv averaging", + .ulm = ulm3, + .ulm_count = ARRAY_SIZE(ulm3), + .final_fn = 25, + .res = { + .success = 1, + .rx_lev_full = 110-90, + .rx_qual_full = 0, + .toa256_mean = 0, + .toa256_max = 0, + .toa256_min = 0, + .toa256_std_dev = 0, + }, +}; + +static struct bts_ul_meas ulm4[] = {}; +static const struct meas_testcase mtc4 = { + .name = "Empty measurements", + .ulm = ulm4, + .ulm_count = ARRAY_SIZE(ulm4), + .final_fn = 25, + .res = { + .success = 0, + .rx_lev_full = 0, + .rx_qual_full = 0, + .toa256_mean = 0, + .toa256_max = 0, + .toa256_min = 0, + .toa256_std_dev = 0, + }, +}; + +static struct bts_ul_meas ulm5[] = { + /* one 104 multiframe can at max contain 26 blocks (TCH/F), + * each of which can at maximum be 64 bits in advance (TA range) */ + ULM(0, 64*256, 90), + ULM(0, 64*256, 90), + ULM(0, 64*256, 90), + ULM(0, 64*256, 90), + ULM(0, 64*256, 90), + ULM(0, 64*256, 90), + ULM(0, 64*256, 90), + ULM(0, 64*256, 90), + ULM(0, 64*256, 90), + ULM(0, 64*256, 90), + ULM(0, 64*256, 90), + ULM(0, 64*256, 90), + ULM(0, 64*256, 90), + ULM(0, 64*256, 90), + ULM(0, 64*256, 90), + ULM(0, 64*256, 90), + ULM(0, 64*256, 90), + ULM(0, 64*256, 90), + ULM(0, 64*256, 90), + ULM(0, 64*256, 90), + ULM(0, 64*256, 90), + ULM(0, 64*256, 90), + ULM(0, 64*256, 90), + ULM(0, 64*256, 90), + ULM(0, 64*256, 90), + ULM(0, 64*256, 90), +}; +static const struct meas_testcase mtc5 = { + .name = "TOA256 26 blocks with max TOA256", + .ulm = ulm5, + .ulm_count = ARRAY_SIZE(ulm5), + .final_fn = 25, + .res = { + .success = 1, + .rx_lev_full = 110-90, + .rx_qual_full = 0, + .toa256_mean = 64*256, + .toa256_max = 64*256, + .toa256_min = 64*256, + .toa256_std_dev = 0, + }, +}; |