bts: Early terminate TC_rec_invalid_frame on error

Extra debugging is added because otherwise it's extremely difficul to
find at which state the test is when debugging sporadic failures.

In f_TC_rec_invalid_frame, timer T is reused because it was actually not
being used before, only defined in there.

Change-Id: If24a81bf20d293b87adf9f37111fc7d344f169f5
This commit is contained in:
Pau Espin 2019-12-10 14:35:30 +01:00 committed by laforge
parent a1f7d24efe
commit 26b562c1bd
1 changed files with 32 additions and 21 deletions

View File

@ -813,11 +813,16 @@ testcase TC_nr_seq_error() runs on test_CT {
f_testmatrix_each_chan(pars, refers(f_TC_nr_seq_error));
}
private function f_TC_rec_invalid_frame_txrx(integer sapi, LapdmFrame x) runs on ConnHdlr {
private function f_TC_rec_invalid_frame_txrx(integer sapi, LapdmFrame x, integer line_nr) runs on ConnHdlr {
LAPDM.send(t_PH_DATA(0, false, x));
f_sleep(2.0); // T200
LAPDM.send(t_PH_DATA(0, false, ts_LAPDm_RR(sapi, c_r:=cr_MO_CMD, p:=true, nr:=0)));
LAPDM.receive(t_PH_DATA(0, false, tr_LAPDm_RR(sapi, c_r:=cr_MT_RSP, p:=true , nr := 0)));
timer T1 := 2.0;
T1.start;
alt {
[] LAPDM.receive(t_PH_DATA(0, false, tr_LAPDm_RR(sapi, c_r:=cr_MT_RSP, p:=true , nr := 0))) { T1.stop; }
[] T1.timeout{ Misc_Helpers.f_shutdown(__BFILE__, line_nr, fail, "Missing LAPDm_RR RSP"); }
}
}
/* 25.2.7 Test on receipt of invalid frames
@ -842,84 +847,90 @@ private function f_TC_rec_invalid_frame(charstring id) runs on ConnHdlr {
/* MO Establish Request via LADPm: SAPI = 0, C = 0, P = 1, M = 0, 0 ≤ L ≤ N201.. */
LAPDM.send(t_PH_DATA(0, false, ts_LAPDm_SABM(sapi, c_r:=cr_MO_CMD, p:=true, l3:=l3_mo)));
RSL.receive(tr_RSL_EST_IND(g_chan_nr, link_id, l3_mo));
T.start
alt {
[] RSL.receive(tr_RSL_EST_IND(g_chan_nr, link_id, l3_mo)) {}
[] T.timeout{ Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Missing RSL EST IND"); }
}
alt {
/* UA: SAPI = 0, R = 0, F = 1, M = 0, L = L of SABM. */
LAPDM.receive(t_PH_DATA(0, false, tr_LAPDm_UA(sapi, cr_MT_RSP, f:=true, l3:=l3_mo)));
[] LAPDM.receive(t_PH_DATA(0, false, tr_LAPDm_UA(sapi, cr_MT_RSP, f:=true, l3:=l3_mo))) { T.stop; }
[] T.timeout{ Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Missing LAPDm UA RSP"); }
}
/* 1: One RR frame: SAPI = 0, R = 0, F = 0, M = 0, L > 0, N(R) = 1.
RR frame with the Length indicator greater than zero and a faulty N(R); */
var LapdmFrame x:= valueof(ts_LAPDm_RR(sapi, c_r:=cr_MO_CMD, p:=false, nr:=1));
x.ab.payload := f_rnd_octstring(5);
f_TC_rec_invalid_frame_txrx(0, x);
f_TC_rec_invalid_frame_txrx(0, x, __LINE__);
/* 3: One REJ frame: SAPI = 0, R = 0, F = 0, M = 0, L = 0, N(R) = 1, EA = 0.
EJ frame with the EA bit set to zero and a faulty N(R); */
x:= valueof(ts_LAPDm_REJ(sapi, c_r:=cr_MO_CMD, p:=false, nr:=1));
x.ab.addr.ea := false;
f_TC_rec_invalid_frame_txrx(0, x);
f_TC_rec_invalid_frame_txrx(0, x, __LINE__);
/* 4: One SABM frame: SAPI = 0, C = 1, P = 1, M = 0, L = 0, EL = 0.
SABM frame with the EL bit set to zero; */
l3_mo := ''O;
x:= valueof(ts_LAPDm_SABM(sapi, c_r:=cr_MO_CMD, p:=true, l3:=l3_mo));
x.ab.el := 0;
f_TC_rec_invalid_frame_txrx(0, x);
f_TC_rec_invalid_frame_txrx(0, x, __LINE__);
/* 5: One DM frame: SAPI = 0, R = 0, F = 1, M = 0, L > 0.
DM frame with the Length indicator greater than zero;*/
x:= valueof(ts_LAPDm_DM(sapi, c_r:=cr_MO_CMD, f:=true));
x.ab.payload := f_rnd_octstring(5);
f_TC_rec_invalid_frame_txrx(0, x);
f_TC_rec_invalid_frame_txrx(0, x, __LINE__);
/* 6: One DISC frame: SAPI = 0, C = 1, P = 1, M = 1, L = 0.
DISC frame with the M bit set to 1; */
x:= valueof(ts_LAPDm_DISC(sapi, c_r:=cr_MO_CMD, p:=true));
x.ab.m := true;
f_TC_rec_invalid_frame_txrx(0, x);
f_TC_rec_invalid_frame_txrx(0, x, __LINE__);
/* 7: One UA frame: SAPI = 0, R = 0, F = 0, M = 0, L = 0, EA = 0.
UA frame with the EA bit set to zero*/
x:= valueof(ts_LAPDm_UA(sapi, c_r:=cr_MO_CMD, f:=false, l3:=''O));
x.ab.addr.ea := false;
f_TC_rec_invalid_frame_txrx(0, x);
f_TC_rec_invalid_frame_txrx(0, x, __LINE__);
/* 8: One I frame: SAPI = 0, C = 1, P = 0, M = 0, L > N201, N(R) = 0, N(S) = 6.
I frame with the Length indicator greater than N201;*/
x:= valueof(ts_LAPDm_I(sapi, c_r:=cr_MO_CMD, p:=true, nr := 0, ns := 6, l3 := f_rnd_octstring(25)))
f_TC_rec_invalid_frame_txrx(0, x);
f_TC_rec_invalid_frame_txrx(0, x, __LINE__);
/* 9: One I frame: SAPI = 0, C = 1, P = 0, M = 1, L < N201, N(R) = 0, N(S) = 7.
I frame with the M bit set to 1 and the Length indicator less than N201;*/
x:= valueof(ts_LAPDm_I(sapi, c_r:=cr_MO_CMD, p:=true, nr := 0, ns := 7, l3 := f_rnd_octstring(5)))
x.ab.m := true;
f_TC_rec_invalid_frame_txrx(0, x);
f_TC_rec_invalid_frame_txrx(0, x, __LINE__);
/* 10: One RR frame: SAPI = 0, C = 1, P = 1, M = 0, L = 0, N(R) = 0. */
x:= valueof(ts_LAPDm_RR(sapi, c_r:=cr_MO_CMD, p:=true, nr:=0));
f_TC_rec_invalid_frame_txrx(0, x);
f_TC_rec_invalid_frame_txrx(0, x, __LINE__);
/* command frames with correct Address and Length indicator field and a non-implemented control field */
/* 12: One command frame with Control Field = xxx1 1101. */
x:= valueof(ts_LAPDm_RR(sapi, c_r:=cr_MO_CMD, p:=false, nr:=1));
x.ab.ctrl.other := bit2int('00011101'B);
f_TC_rec_invalid_frame_txrx(0, x);
f_TC_rec_invalid_frame_txrx(0, x, __LINE__);
/* 13: One command frame with Control field = xxx1 1011. */
x:= valueof(ts_LAPDm_RR(sapi, c_r:=cr_MO_CMD, p:=false, nr:=1));
x.ab.ctrl.other := bit2int('00011011'B);
f_TC_rec_invalid_frame_txrx(0, x);
f_TC_rec_invalid_frame_txrx(0, x, __LINE__);
/* 14: One command frame with Control field = xxx1 0111. */
x:= valueof(ts_LAPDm_RR(sapi, c_r:=cr_MO_CMD, p:=false, nr:=1));
x.ab.ctrl.other := bit2int('00010001'B);
f_TC_rec_invalid_frame_txrx(0, x);
f_TC_rec_invalid_frame_txrx(0, x, __LINE__);
/* 15: One command frame with Control field = 01x1 1111. */
x:= valueof(ts_LAPDm_RR(sapi, c_r:=cr_MO_CMD, p:=false, nr:=1));
x.ab.ctrl.other := bit2int('01011111'B);
f_TC_rec_invalid_frame_txrx(0, x);
f_TC_rec_invalid_frame_txrx(0, x, __LINE__);
/* 16: One command frame with Control field = 1xx1 1111. */
x:= valueof(ts_LAPDm_RR(sapi, c_r:=cr_MO_CMD, p:=false, nr:=1));
x.ab.ctrl.other := bit2int('10011111'B);
f_TC_rec_invalid_frame_txrx(0, x);
f_TC_rec_invalid_frame_txrx(0, x, __LINE__);
/* 17: One command frame with Control field = 0011 0011. */
x:= valueof(ts_LAPDm_RR(sapi, c_r:=cr_MO_CMD, p:=false, nr:=1));
x.ab.ctrl.other := bit2int('00110011'B);
f_TC_rec_invalid_frame_txrx(0, x);
f_TC_rec_invalid_frame_txrx(0, x, __LINE__);
/* 18: One command frame with Control field = 1xx1 0011. */
x:= valueof(ts_LAPDm_RR(sapi, c_r:=cr_MO_CMD, p:=false, nr:=1));
x.ab.ctrl.other := bit2int('10010011'B);
f_TC_rec_invalid_frame_txrx(0, x);
f_TC_rec_invalid_frame_txrx(0, x, __LINE__);
deactivate(d);
fp_common_fini();