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


Change subject: bsc CBSP: TC_cbsp_write_bss: run a fixed series of payload 
lengths
......................................................................

bsc CBSP: TC_cbsp_write_bss: run a fixed series of payload lengths

Recently fixed errors in the last_block counting as well as encoding ask for a
proper test coverage of various lengths, which also verifies the expected
blocks count explicitly.

Implement this in TC_cbsp_write_bss():

Run f_tc_cbsp_write_bss() multiple times with differing fixed payload lengths,
at all block count transitions, plus some arbitrary lengths in-between.

Before this patch, TC_cbsp_write_bss() would pick a different random payload
length for every test run, which, until recently, then sporadically hit
last_block value errors. That's not good for reproducability.

Change-Id: I3cace19f9e5adc8ebab13ef2328a36dc150b2b31
---
M bsc/BSC_Tests_CBSP.ttcn
1 file changed, 33 insertions(+), 7 deletions(-)



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

diff --git a/bsc/BSC_Tests_CBSP.ttcn b/bsc/BSC_Tests_CBSP.ttcn
index f1f0240..edbaddc 100644
--- a/bsc/BSC_Tests_CBSP.ttcn
+++ b/bsc/BSC_Tests_CBSP.ttcn
@@ -377,20 +377,46 @@
 }

 /* Write to entire BSS; three cells succeed; one fails (no CBCH) */
-testcase TC_cbsp_write_bss() runs on cbsp_test_CT {
-       var CBSP_IEs pages := {f_gen_page()};
+function f_tc_cbsp_write_bss(integer payload_len := -1, integer expect_blocks 
:= -1) runs on cbsp_test_CT {
+       var CBSP_IEs pages := {f_gen_page(payload_len := payload_len)};
        var template (value) BSSMAP_FIELD_CellIdentificationList cell_list;
        cell_list := ts_BSSMAP_CIL_BSS;
-       f_cbsp_init_server();
        f_cbsp_write(1, 1001, cell_list, content:=pages,
                     success_list:=tr_BSSMAP_CIL_CGI({?,?,?}), fail_list:={?});

-       var template RSL_Message tr := f_page2rsl(pages[0], 1, 1001);
+       var template RSL_Message tr := f_page2rsl(pages[0], 1, 1001, 
expect_blocks := expect_blocks);
+       log("RSL[0,1,2] EXPECTING ", tr_ASP_RSL_UD(tr));
        interleave {
-       [] IPA_RSL[0].receive(tr_ASP_RSL_UD(tr)) {}
-       [] IPA_RSL[1].receive(tr_ASP_RSL_UD(tr)) {}
-       [] IPA_RSL[2].receive(tr_ASP_RSL_UD(tr)) {}
+       [] IPA_RSL[0].receive(tr_ASP_RSL_UD(tr)) { log("Got SMSCB CMD on 
RSL[0]"); }
+       [] IPA_RSL[1].receive(tr_ASP_RSL_UD(tr)) { log("Got SMSCB CMD on 
RSL[1]"); }
+       [] IPA_RSL[2].receive(tr_ASP_RSL_UD(tr)) { log("Got SMSCB CMD on 
RSL[2]"); }
        }
+       setverdict(pass);
+}
+testcase TC_cbsp_write_bss() runs on cbsp_test_CT {
+       f_cbsp_init_server(guard_timeout := 60.0);
+       /* In the SMSCB message, there is a head followed by payload,
+        * and the resulting data is segmented in blocks of 22 octets (<= 4 
blocks).
+        *
+        * 
[head][...payload....]|[....................]|[....................]|[....................]
+        *       0               |16                    |38                    
|60                   |82
+        * 0    5                |22                    |44                    
|66                   |88
+        *
+        *         blocks count:   1     | 2      | 3      | 4
+        * payload octets count:   1..16 | 17..38 | 39..60 | 61..82
+        */
+       f_tc_cbsp_write_bss(payload_len := 1, expect_blocks := 1);
+       f_tc_cbsp_write_bss(payload_len := 2, expect_blocks := 1);
+       f_tc_cbsp_write_bss(payload_len := 16, expect_blocks := 1);
+       f_tc_cbsp_write_bss(payload_len := 17, expect_blocks := 2);
+       f_tc_cbsp_write_bss(payload_len := 23, expect_blocks := 2);
+       f_tc_cbsp_write_bss(payload_len := 38, expect_blocks := 2);
+       f_tc_cbsp_write_bss(payload_len := 39, expect_blocks := 3);
+       f_tc_cbsp_write_bss(payload_len := 42, expect_blocks := 3);
+       f_tc_cbsp_write_bss(payload_len := 60, expect_blocks := 3);
+       f_tc_cbsp_write_bss(payload_len := 61, expect_blocks := 4);
+       f_tc_cbsp_write_bss(payload_len := 77, expect_blocks := 4);
+       f_tc_cbsp_write_bss(payload_len := 82, expect_blocks := 4);
 }

 /* Write to single BTS supporting CBCH: success */

--
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/19439
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: I3cace19f9e5adc8ebab13ef2328a36dc150b2b31
Gerrit-Change-Number: 19439
Gerrit-PatchSet: 1
Gerrit-Owner: neels <nhofm...@sysmocom.de>
Gerrit-MessageType: newchange

Reply via email to