diff options
author | Pau Espin Pedrol <pespin@sysmocom.de> | 2020-08-18 16:23:26 +0200 |
---|---|---|
committer | Pau Espin Pedrol <pespin@sysmocom.de> | 2020-08-18 17:22:01 +0200 |
commit | 1565d16a0acf6f373499710fe2af0cce4d62a6fa (patch) | |
tree | 2a41dea9e75e2703b9a059094cdcc7a79a5b8f9a /tests/tx_power | |
parent | 624b5cdc221ebb254b6091bacd4630b8a9339290 (diff) |
tests: tx_power: Extend and add extra power_ramp buggy case
The test code is extended to support testing more than one ramping loop.
A new test ramping test is added, which shows buggy behavior, since
being in -10dBm and targeting 10dBm with max_initial_pout_mdBm=0 should
immediatelly jump -10->0 and then slowly ramp up (2dB) 0->10dB.
The issue will be fixed in next commit.
Change-Id: I5adc9008ac415eb23274755fc8270df8eebdc6fb
Diffstat (limited to 'tests/tx_power')
-rw-r--r-- | tests/tx_power/tx_power_test.c | 52 | ||||
-rw-r--r-- | tests/tx_power/tx_power_test.err | 21 | ||||
-rw-r--r-- | tests/tx_power/tx_power_test.ok | 13 |
3 files changed, 76 insertions, 10 deletions
diff --git a/tests/tx_power/tx_power_test.c b/tests/tx_power/tx_power_test.c index 12c51c6d..dbabc876 100644 --- a/tests/tx_power/tx_power_test.c +++ b/tests/tx_power/tx_power_test.c @@ -20,6 +20,7 @@ */ #include <stdint.h> +#include <errno.h> #include <osmocom/core/utils.h> #include <osmocom/core/talloc.h> @@ -30,6 +31,7 @@ #include <osmo-bts/logging.h> #include <osmo-bts/tx_power.h> +static bool power_ramp_finished = false; static const struct trx_power_params tpp_1002 = { .trx_p_max_out_mdBm = to_mdB(23), @@ -182,25 +184,56 @@ static void test_sbts2050(struct gsm_bts_trx *trx) int bts_model_change_power(struct gsm_bts_trx *trx, int p_trxout_mdBm) { - struct trx_power_params *tpp = &trx->power_params; printf("CHANGE_POWER(%d)\n", p_trxout_mdBm); - if (tpp->ramp.attenuation_mdB == 0) - exit(0); - power_trx_change_compl(trx, p_trxout_mdBm); return 0; } -static void test_power_ramp(struct gsm_bts_trx *trx, int dBm) +static void test_ramp_compl_cb(struct gsm_bts_trx *trx) +{ + power_ramp_finished = true; + printf("power_ramp finished\n"); +} + +static int test_power_ramp(struct gsm_bts_trx *trx, int dBm) { printf("Testing tx_power ramping for sysmoBTS 1020\n"); + int rc; + trx->power_params = tpp_1020; trx->power_params.ramp.step_interval_sec = 0; /* speedup test */ trx->max_power_red = 0; - power_ramp_start(trx, to_mdB(dBm), 0, NULL); + power_ramp_finished = false; + if ((rc = power_ramp_start(trx, to_mdB(dBm), 0, test_ramp_compl_cb))) + return rc; + while (!power_ramp_finished) + osmo_select_main(0); + return 0; +} + + +static int test_power_ramp_from_minus10(struct gsm_bts_trx *trx, int dBm) +{ + printf("Testing tx_power ramping for osmo-bts-trx after lock\n"); + int rc; + + trx->power_params = tpp_1002; + trx->power_params.trx_p_max_out_mdBm = to_mdB(20); + trx->power_params.p_total_tgt_mdBm = to_mdB(-10); + trx->power_params.p_total_cur_mdBm = to_mdB(-10); + trx->power_params.ramp.max_initial_pout_mdBm = to_mdB(0); + trx->power_params.ramp.step_interval_sec = 0; /* speedup test */ + trx->max_power_red = 10; + + power_ramp_finished = false; + if ((rc = power_ramp_start(trx, to_mdB(dBm), 0, test_ramp_compl_cb))) + return rc; + while (!power_ramp_finished) + osmo_select_main(0); + return 0; } int main(int argc, char **argv) @@ -239,11 +272,10 @@ int main(int argc, char **argv) test_sbts2050(trx); /* test error case / excess power (40 dBm is too much) */ - test_power_ramp(trx, 40); + OSMO_ASSERT(test_power_ramp(trx, 40) == -ERANGE); /* test actual ramping to full 33 dBm */ test_power_ramp(trx, 33); + /* Test ramp up from -10dBm (locked) to 10dBm */ + test_power_ramp_from_minus10(trx, 10); - while (1) { - osmo_select_main(0); - } } diff --git a/tests/tx_power/tx_power_test.err b/tests/tx_power/tx_power_test.err index 344fa164..3ef12c96 100644 --- a/tests/tx_power/tx_power_test.err +++ b/tests/tx_power/tx_power_test.err @@ -35,3 +35,24 @@ (bts=0,trx=1) ramping TRX board output power to 22000 mdBm. (bts=0,trx=1) ramp_timer_cb(cur_pout=33000, tgt_pout=33000, ramp_att=0, therm_att=0, user_gain=0) (bts=0,trx=1) ramping TRX board output power to 23000 mdBm. +(bts=0,trx=1) power_ramp_start(cur=-10000, tgt=10000) +(bts=0,trx=1) ramp_timer_cb(cur_pout=-8000, tgt_pout=10000, ramp_att=18000, therm_att=0, user_gain=0) +(bts=0,trx=1) ramping TRX board output power to -8000 mdBm. +(bts=0,trx=1) ramp_timer_cb(cur_pout=-6000, tgt_pout=10000, ramp_att=16000, therm_att=0, user_gain=0) +(bts=0,trx=1) ramping TRX board output power to -6000 mdBm. +(bts=0,trx=1) ramp_timer_cb(cur_pout=-4000, tgt_pout=10000, ramp_att=14000, therm_att=0, user_gain=0) +(bts=0,trx=1) ramping TRX board output power to -4000 mdBm. +(bts=0,trx=1) ramp_timer_cb(cur_pout=-2000, tgt_pout=10000, ramp_att=12000, therm_att=0, user_gain=0) +(bts=0,trx=1) ramping TRX board output power to -2000 mdBm. +(bts=0,trx=1) ramp_timer_cb(cur_pout=0, tgt_pout=10000, ramp_att=10000, therm_att=0, user_gain=0) +(bts=0,trx=1) ramping TRX board output power to 0 mdBm. +(bts=0,trx=1) ramp_timer_cb(cur_pout=2000, tgt_pout=10000, ramp_att=8000, therm_att=0, user_gain=0) +(bts=0,trx=1) ramping TRX board output power to 2000 mdBm. +(bts=0,trx=1) ramp_timer_cb(cur_pout=4000, tgt_pout=10000, ramp_att=6000, therm_att=0, user_gain=0) +(bts=0,trx=1) ramping TRX board output power to 4000 mdBm. +(bts=0,trx=1) ramp_timer_cb(cur_pout=6000, tgt_pout=10000, ramp_att=4000, therm_att=0, user_gain=0) +(bts=0,trx=1) ramping TRX board output power to 6000 mdBm. +(bts=0,trx=1) ramp_timer_cb(cur_pout=8000, tgt_pout=10000, ramp_att=2000, therm_att=0, user_gain=0) +(bts=0,trx=1) ramping TRX board output power to 8000 mdBm. +(bts=0,trx=1) ramp_timer_cb(cur_pout=10000, tgt_pout=10000, ramp_att=0, therm_att=0, user_gain=0) +(bts=0,trx=1) ramping TRX board output power to 10000 mdBm. diff --git a/tests/tx_power/tx_power_test.ok b/tests/tx_power/tx_power_test.ok index ceb88ab4..ec3ea613 100644 --- a/tests/tx_power/tx_power_test.ok +++ b/tests/tx_power/tx_power_test.ok @@ -21,3 +21,16 @@ CHANGE_POWER(18000) CHANGE_POWER(20000) CHANGE_POWER(22000) CHANGE_POWER(23000) +power_ramp finished +Testing tx_power ramping for osmo-bts-trx after lock +CHANGE_POWER(-8000) +CHANGE_POWER(-6000) +CHANGE_POWER(-4000) +CHANGE_POWER(-2000) +CHANGE_POWER(0) +CHANGE_POWER(2000) +CHANGE_POWER(4000) +CHANGE_POWER(6000) +CHANGE_POWER(8000) +CHANGE_POWER(10000) +power_ramp finished |