Change in osmo-ttcn3-hacks[master]: bsc CBSP: fix tr_CBSP_KILL_FAIL, no lengthof() on record-of with '*'

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
Thu Aug 13 13:28:29 UTC 2020


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


Change subject: bsc CBSP: fix tr_CBSP_KILL_FAIL, no lengthof() on record-of with '*'
......................................................................

bsc CBSP: fix tr_CBSP_KILL_FAIL, no lengthof() on record-of with '*'

Keep a local next_idx so that lengthof() doesn't fail after adding a '*' entry.
Fixes this error in BSC_Tests_CBSP.TC_cbsp_write_then_kill:

 Dynamic test case error: Performing lengthof() operation on a template of type @CBSP_Types.CBSP_IEs with no exact length.

Change-Id: I4d95a8ca311f145fa5ea371b6aed099db771d7b8
---
M library/CBSP_Templates.ttcn
1 file changed, 15 insertions(+), 6 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-ttcn3-hacks refs/changes/31/19631/1

diff --git a/library/CBSP_Templates.ttcn b/library/CBSP_Templates.ttcn
index 49906fe..8d62742 100644
--- a/library/CBSP_Templates.ttcn
+++ b/library/CBSP_Templates.ttcn
@@ -581,20 +581,29 @@
 		tr_CbspMsgId(msg_id),
 		tr_OldSerNo(old_ser_nr)
 	};
+	/* As soon as adding a '*' IE item, lengthof() no longer works on the ies record. So keep track of the
+	 * next index to use separately. */
+	var integer next_idx := lengthof(ies);
 	if (istemplatekind(compl_list, "*")) {
-		ies[lengthof(ies)] := *;
+		ies[next_idx] := *;
+		next_idx := next_idx + 1;
 	} else if (not istemplatekind(compl_list, "omit")) {
-		ies[lengthof(ies)] := tr_CbspNumComplList(compl_list);
+		ies[next_idx] := tr_CbspNumComplList(compl_list);
+		next_idx := next_idx + 1;
 	}
 	if (istemplatekind(cell_list, "*")) {
-		ies[lengthof(ies)] := *;
+		ies[next_idx] := *;
+		next_idx := next_idx + 1;
 	} else if (not istemplatekind(cell_list, "omit")) {
-		ies[lengthof(ies)] := tr_CbspCellList(cell_list);
+		ies[next_idx] := tr_CbspCellList(cell_list);
+		next_idx := next_idx + 1;
 	}
 	if (istemplatekind(channel_ind, "*")) {
-		ies[lengthof(ies)] := *;
+		ies[next_idx] := *;
+		next_idx := next_idx + 1;
 	} else if (not istemplatekind(channel_ind, "omit")) {
-		ies[lengthof(ies)] := tr_CbspChannelInd(channel_ind);
+		ies[next_idx] := tr_CbspChannelInd(channel_ind);
+		next_idx := next_idx + 1;
 	}
 	return tr_CBSP(CBSP_MSGT_KILL_COMPL, ies);
 }

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

Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Change-Id: I4d95a8ca311f145fa5ea371b6aed099db771d7b8
Gerrit-Change-Number: 19631
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/20200813/52845b16/attachment.htm>


More information about the gerrit-log mailing list