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/.
Max gerrit-no-reply at lists.osmocom.orgMax has submitted this change and it was merged. Change subject: Make power test more verbose ...................................................................... Make power test more verbose Power control loop test outputs next to nothing which is not very helpful. Make it more verbose. While at it, also move duplicated code into static function to make test cases less cluttered. Change-Id: I0a5e65e23e62442ef8758ecbcf8e7820b4f15d7b Related: OS#2223 --- M tests/power/power_test.c M tests/power/power_test.ok 2 files changed, 20 insertions(+), 16 deletions(-) Approvals: Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/tests/power/power_test.c b/tests/power/power_test.c index c1d6a5a..3099217 100644 --- a/tests/power/power_test.c +++ b/tests/power/power_test.c @@ -23,6 +23,15 @@ #include <stdio.h> +static inline void apply_power_test(struct gsm_lchan *lchan, int rxlev, int exp_ret, uint8_t exp_current) +{ + int ret = lchan_ms_pwr_ctrl(lchan, lchan->ms_power_ctrl.current, rxlev); + + printf("power control [%d]: MS current power %u\n", ret, lchan->ms_power_ctrl.current); + OSMO_ASSERT(ret == exp_ret); + OSMO_ASSERT(lchan->ms_power_ctrl.current == exp_current); +} + static void test_power_loop(void) { struct gsm_bts bts; @@ -46,39 +55,29 @@ trx.ms_power_control = 1; btsb.ul_power_target = -75; - /* Simply clamping */ lchan->state = LCHAN_S_NONE; lchan->ms_power_ctrl.current = ms_pwr_ctl_lvl(GSM_BAND_1800, 0); OSMO_ASSERT(lchan->ms_power_ctrl.current == 15); - ret = lchan_ms_pwr_ctrl(lchan, lchan->ms_power_ctrl.current, -60); - OSMO_ASSERT(ret == 0); - OSMO_ASSERT(lchan->ms_power_ctrl.current == 15); + /* Simply clamping */ + apply_power_test(lchan, -60, 0, 15); /* * Now 15 dB too little and we should power it up. Could be a * power level of 7 or 8 for 15 dBm */ - ret = lchan_ms_pwr_ctrl(lchan, lchan->ms_power_ctrl.current, -90); - OSMO_ASSERT(ret == 1); - OSMO_ASSERT(lchan->ms_power_ctrl.current == 7); + apply_power_test(lchan, -90, 1, 7); /* It should be clamped to level 0 and 30 dBm */ - ret = lchan_ms_pwr_ctrl(lchan, lchan->ms_power_ctrl.current, -100); - OSMO_ASSERT(ret == 1); - OSMO_ASSERT(lchan->ms_power_ctrl.current == 0); + apply_power_test(lchan, -100, 1, 0); /* Fix it and jump down */ lchan->ms_power_ctrl.fixed = 1; - ret = lchan_ms_pwr_ctrl(lchan, lchan->ms_power_ctrl.current, -60); - OSMO_ASSERT(ret == 0); - OSMO_ASSERT(lchan->ms_power_ctrl.current == 0); + apply_power_test(lchan, -60, 0, 0); /* And leave it again */ lchan->ms_power_ctrl.fixed = 0; - ret = lchan_ms_pwr_ctrl(lchan, lchan->ms_power_ctrl.current, -40); - OSMO_ASSERT(ret == 1); - OSMO_ASSERT(lchan->ms_power_ctrl.current == 15); + apply_power_test(lchan, -40, 1, 15); } int main(int argc, char **argv) diff --git a/tests/power/power_test.ok b/tests/power/power_test.ok index 6bf508b..cf0a38b 100644 --- a/tests/power/power_test.ok +++ b/tests/power/power_test.ok @@ -1,2 +1,7 @@ Testing power loop... +power control [0]: MS current power 15 +power control [1]: MS current power 7 +power control [1]: MS current power 0 +power control [0]: MS current power 0 +power control [1]: MS current power 15 Power loop test OK -- To view, visit https://gerrit.osmocom.org/4223 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I0a5e65e23e62442ef8758ecbcf8e7820b4f15d7b Gerrit-PatchSet: 2 Gerrit-Project: osmo-bts Gerrit-Branch: master Gerrit-Owner: Max <msuraev at sysmocom.de> Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max <msuraev at sysmocom.de>