Change in osmo-bts[master]: tests: tx_power: Extend and add extra power_ramp buggy case

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/.

pespin gerrit-no-reply at lists.osmocom.org
Tue Aug 18 14:29:04 UTC 2020


pespin has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-bts/+/19702 )


Change subject: tests: tx_power: Extend and add extra power_ramp buggy case
......................................................................

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
---
M tests/tx_power/tx_power_test.c
M tests/tx_power/tx_power_test.ok
2 files changed, 55 insertions(+), 10 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-bts refs/changes/02/19702/1

diff --git a/tests/tx_power/tx_power_test.c b/tests/tx_power/tx_power_test.c
index 12c51c6..dbabc87 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 @@
 
 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 @@
 	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.ok b/tests/tx_power/tx_power_test.ok
index ceb88ab..ec3ea61 100644
--- a/tests/tx_power/tx_power_test.ok
+++ b/tests/tx_power/tx_power_test.ok
@@ -21,3 +21,16 @@
 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

-- 
To view, visit https://gerrit.osmocom.org/c/osmo-bts/+/19702
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-Change-Id: I5adc9008ac415eb23274755fc8270df8eebdc6fb
Gerrit-Change-Number: 19702
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <pespin at sysmocom.de>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20200818/69e8bbee/attachment.htm>


More information about the gerrit-log mailing list