Change in osmo-bsc[master]: handover_test: saner chan act handling

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

neels gerrit-no-reply at lists.osmocom.org
Tue Jan 5 22:28:50 UTC 2021


neels has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-bsc/+/21982 )


Change subject: handover_test: saner chan act handling
......................................................................

handover_test: saner chan act handling

Do not clear pending chan act requests when sending a measurement report
or starting congestion check. This potentially left channel activations
unnoticed and dangling, e.g. for repeated meas-rep.

A typical test should indeed handle pending channel activation requests
before potentially triggering more, safeguard against this by asserting
that only one channel activation is pending.

Place unhandled channel activations in new_chan_req pointer, moving to
last_chan_req upon handling it. Instead of the got_chan_req flag and
additional chan_req_lchan pointer, just keep a last_chan_req pointer.

Change-Id: If06587058798d96afca86358030dc0c1c3c6df39
---
M tests/handover/handover_test.c
1 file changed, 27 insertions(+), 46 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-bsc refs/changes/82/21982/1

diff --git a/tests/handover/handover_test.c b/tests/handover/handover_test.c
index 3747bd8..eddf753 100644
--- a/tests/handover/handover_test.c
+++ b/tests/handover/handover_test.c
@@ -525,20 +525,8 @@
 
 /* parse channel request */
 
-static int got_chan_req = 0;
-static struct gsm_lchan *chan_req_lchan = NULL;
-
-static int parse_chan_act(struct gsm_lchan *lchan, uint8_t *data)
-{
-	chan_req_lchan = lchan;
-	return 0;
-}
-
-static int parse_chan_rel(struct gsm_lchan *lchan, uint8_t *data)
-{
-	chan_req_lchan = lchan;
-	return 0;
-}
+static struct gsm_lchan *new_chan_req = NULL;
+static struct gsm_lchan *last_chan_req = NULL;
 
 /* parse handover request */
 
@@ -703,35 +691,30 @@
 
 	switch (dh->c.msg_type) {
 	case RSL_MT_CHAN_ACTIV:
-		rc = parse_chan_act(lchan, dh->data);
-		if (rc == 0) {
-			if (got_chan_req) {
-				fprintf(stderr, "Test script is erratic: a channel is requested"
-					" while a previous channel request is still unhandled\n");
-				exit(1);
-			}
-			got_chan_req = 1;
+		if (new_chan_req) {
+			fprintf(stderr, "Test script is erratic: a channel is requested"
+				" while a previous channel request is still unhandled\n");
+			exit(1);
 		}
+		new_chan_req = lchan;
 		break;
 	case RSL_MT_RF_CHAN_REL:
-		rc = parse_chan_rel(lchan, dh->data);
-		if (rc == 0)
-			send_chan_act_ack(chan_req_lchan, 0);
+		send_chan_act_ack(lchan, 0);
 
 		/* send dyn TS back to PDCH if unused */
-		switch (chan_req_lchan->ts->pchan_on_init) {
+		switch (lchan->ts->pchan_on_init) {
 		case GSM_PCHAN_TCH_F_TCH_H_PDCH:
 		case GSM_PCHAN_TCH_F_PDCH:
-			switch (chan_req_lchan->ts->pchan_is) {
+			switch (lchan->ts->pchan_is) {
 			case GSM_PCHAN_TCH_H:
-				other_lchan = &chan_req_lchan->ts->lchan[
-					(chan_req_lchan == &chan_req_lchan->ts->lchan[0])?
+				other_lchan = &lchan->ts->lchan[
+					(lchan == &lchan->ts->lchan[0])?
 					1 : 0];
 				if (lchan_state_is(other_lchan, LCHAN_ST_ESTABLISHED))
 					break;
 				/* else fall thru */
 			case GSM_PCHAN_TCH_F:
-				chan_req_lchan->ts->pchan_is = GSM_PCHAN_PDCH;
+				lchan->ts->pchan_is = GSM_PCHAN_PDCH;
 				break;
 			default:
 				break;
@@ -895,7 +878,6 @@
 			fprintf(stderr, " * Neighbor cell #%d, actual BTS %d: rxlev=%d\n", i, neighbor_bts_nr,
 				nm[i].rxlev);
 	}
-	got_chan_req = 0;
 	gen_meas_rep(lc, rxlev, rxqual, ta, argc, nm);
 	return CMD_SUCCESS;
 }
@@ -943,7 +925,6 @@
       "Trigger a congestion check\n")
 {
 	fprintf(stderr, "- Triggering congestion check\n");
-	got_chan_req = 0;
 	hodec2_congestion_check(bsc_gsmnet);
 	return CMD_SUCCESS;
 }
@@ -953,8 +934,8 @@
       "Expect that no channel request was sent from BSC to any cell\n")
 {
 	fprintf(stderr, "- Expecting no channel request\n");
-	if (got_chan_req) {
-		fprintf(stderr, " * Got channel request at %s\n", gsm_lchan_name(chan_req_lchan));
+	if (new_chan_req) {
+		fprintf(stderr, " * Got channel request at %s\n", gsm_lchan_name(new_chan_req));
 		fprintf(stderr, "Test failed, because channel was requested\n");
 		exit(1);
 	}
@@ -966,18 +947,19 @@
 {
 	fprintf(stderr, "- Expecting channel request at %s\n",
 		gsm_lchan_name(lchan));
-	if (!got_chan_req) {
+	if (!new_chan_req) {
 		fprintf(stderr, "Test failed, because no channel was requested\n");
 		exit(1);
 	}
-	fprintf(stderr, " * Got channel request at %s\n", gsm_lchan_name(chan_req_lchan));
-	if (lchan != chan_req_lchan) {
+	last_chan_req = new_chan_req;
+	new_chan_req = NULL;
+	fprintf(stderr, " * Got channel request at %s\n", gsm_lchan_name(last_chan_req));
+	if (lchan != last_chan_req) {
 		fprintf(stderr, "Test failed, because channel was requested on a different lchan than expected\n"
 		       "expected: %s  got: %s\n",
-		       gsm_lchan_name(lchan), gsm_lchan_name(chan_req_lchan));
+		       gsm_lchan_name(lchan), gsm_lchan_name(last_chan_req));
 		exit(1);
 	}
-	got_ho_req = 0;
 	send_chan_act_ack(lchan, 1);
 }
 
@@ -1019,7 +1001,7 @@
       "ho-detect",
       "Send Handover Detection to the most recent HO target lchan\n")
 {
-	if (!got_chan_req) {
+	if (!last_chan_req) {
 		fprintf(stderr, "Cannot ack handover/assignment, because no chan request\n");
 		exit(1);
 	}
@@ -1027,7 +1009,7 @@
 		fprintf(stderr, "Cannot ack handover/assignment, because no ho request\n");
 		exit(1);
 	}
-	send_ho_detect(chan_req_lchan);
+	send_ho_detect(last_chan_req);
 	return CMD_SUCCESS;
 }
 
@@ -1035,7 +1017,7 @@
       "ho-complete",
       "Send Handover Complete for the most recent HO target lchan\n")
 {
-	if (!got_chan_req) {
+	if (!last_chan_req) {
 		fprintf(stderr, "Cannot ack handover/assignment, because no chan request\n");
 		exit(1);
 	}
@@ -1043,7 +1025,7 @@
 		fprintf(stderr, "Cannot ack handover/assignment, because no ho request\n");
 		exit(1);
 	}
-	send_ho_complete(chan_req_lchan, true);
+	send_ho_complete(last_chan_req, true);
 	lchan_release_ack(ho_req_lchan);
 	return CMD_SUCCESS;
 }
@@ -1070,14 +1052,13 @@
       "ho-failed",
       "Fail the most recent handover request\n")
 {
-	if (!got_chan_req) {
+	if (!last_chan_req) {
 		fprintf(stderr, "Cannot fail handover, because no chan request\n");
 		exit(1);
 	}
-	got_chan_req = 0;
 	got_ho_req = 0;
 	send_ho_complete(ho_req_lchan, false);
-	lchan_release_ack(chan_req_lchan);
+	lchan_release_ack(last_chan_req);
 	return CMD_SUCCESS;
 }
 

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

Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-Change-Id: If06587058798d96afca86358030dc0c1c3c6df39
Gerrit-Change-Number: 21982
Gerrit-PatchSet: 1
Gerrit-Owner: neels <nhofmeyr at sysmocom.de>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20210105/2d8920ca/attachment.htm>


More information about the gerrit-log mailing list