pespin has submitted this change. (
https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/38882?usp=email )
Change subject: Osmocom_CTRL_Functions.ttcn: Use Misc_Helpers.f_shutdown() everywhere
......................................................................
Osmocom_CTRL_Functions.ttcn: Use Misc_Helpers.f_shutdown() everywhere
Change-Id: I3b11a4dee35da89b2fec0cc66021dd57db04beb4
---
M library/Osmocom_CTRL_Functions.ttcn
1 file changed, 27 insertions(+), 24 deletions(-)
Approvals:
daniel: Looks good to me, but someone else must approve
Jenkins Builder: Verified
laforge: Looks good to me, but someone else must approve
pespin: Looks good to me, approved
diff --git a/library/Osmocom_CTRL_Functions.ttcn b/library/Osmocom_CTRL_Functions.ttcn
index cf19f7e..ac18695 100644
--- a/library/Osmocom_CTRL_Functions.ttcn
+++ b/library/Osmocom_CTRL_Functions.ttcn
@@ -21,6 +21,7 @@
import from Osmocom_CTRL_Types all;
+ import from Misc_Helpers all;
import from IPA_Emulation all;
type record of charstring charstring_list;
@@ -42,15 +43,15 @@
[] pt.receive(tr_CtrlMsgTrap) { repeat; }
[] pt.receive(tr_CtrlMsgError) -> value rx {
if (istemplatekind(on_err, "omit")) {
- setverdict(fail, "Error in CTRL GET ", variable, ": ",
rx.err.reason);
- mtc.stop;
+ Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail,
+ log2str("Error in CTRL GET ", variable, ": ",
rx.err.reason));
} else {
rx.resp.val := valueof(on_err);
}
}
[] T.timeout {
- setverdict(fail, "Timeout waiting for CTRL GET REPLY ", variable);
- mtc.stop;
+ Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail,
+ log2str("Timeout waiting for CTRL GET REPLY ", variable));
}
}
return rx.resp.val;
@@ -67,12 +68,12 @@
[] pt.receive(tr_CtrlMsgSetRepl(id, variable, val)) { }
[] pt.receive(tr_CtrlMsgTrap) { repeat; }
[] pt.receive(tr_CtrlMsgError) -> value rx {
- setverdict(fail, "Error in CTRL SET ", variable, ": ",
rx.err.reason);
- mtc.stop;
+ Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail,
+ log2str("Error in CTRL SET ", variable, ": ", rx.err.reason));
}
[] T.timeout {
- setverdict(fail, "Timeout waiting for CTRL SET REPLY ", variable);
- mtc.stop;
+ Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail,
+ log2str("Timeout waiting for CTRL SET REPLY ", variable));
}
}
}
@@ -93,8 +94,8 @@
[] pt.receive(tr_CtrlMsgTrap(variable, val)) -> value rx {
}
[] T.timeout {
- setverdict(fail, "Timeout waiting for TRAP ", variable);
- mtc.stop;
+ Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail,
+ log2str("Timeout waiting for TRAP ", variable));
}
}
return rx.trap.val;
@@ -116,8 +117,8 @@
}
}
[] T.timeout {
- setverdict(fail, "Timeout waiting for SET ", variable);
- mtc.stop;
+ Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail,
+ log2str("Timeout waiting for SET ", variable));
}
}
return rx.cmd.val;
@@ -137,8 +138,8 @@
}
}
[] T.timeout {
- setverdict(fail, "Timeout waiting for GET ", variable);
- mtc.stop;
+ Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail,
+ log2str("Timeout waiting for GET ", variable));
}
}
}
@@ -148,8 +149,8 @@
var charstring ctrl_resp;
ctrl_resp := f_ctrl_get(pt, variable);
if (not match(ctrl_resp, exp)) {
- setverdict(fail, "Unexpected " & variable & ":" &
ctrl_resp);
- mtc.stop;
+ Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail,
+ log2str("Unexpected ", variable, ":", ctrl_resp, " vs exp
", exp));
}
}
@@ -168,8 +169,8 @@
var CtrlVariable variable := valueof(ts_ctrl_ratectr(grp, instance, name));
ctrl_resp := f_ctrl_get(pt, variable);
if (not match(str2int(ctrl_resp), exp)) {
- setverdict(fail, variable & " value " & ctrl_resp & "
didn't match ", exp);
- mtc.stop;
+ Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail,
+ log2str(variable & " value " & ctrl_resp & " didn't
match ", exp));
}
}
@@ -310,12 +311,13 @@
var CounterNameVals last := f_counter_name_vals_get(pt, instance_name, instance_nr,
vals);
for (var integer i := 0; i < lengthof(vals); i := i + 1) {
if (last[i].name != vals[i].name) {
- setverdict(fail, "Internal error");
+ Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Internal error");
}
if (last[i].val != vals[i].val) {
- setverdict(fail, "Rate counter mismatch: " & instance_name & "
" & int2str(instance_nr)
- & " " & vals[i].name & " is " &
f_counter_val_to_str(last[i].val)
- & " but expected " & f_counter_val_to_str(vals[i].val));
+ Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail,
+ "Rate counter mismatch: " & instance_name & " " &
int2str(instance_nr)
+ & " " & vals[i].name & " is " &
f_counter_val_to_str(last[i].val)
+ & " but expected " & f_counter_val_to_str(vals[i].val));
}
}
setverdict(pass);
@@ -338,7 +340,7 @@
var CounterNameVals last := f_counter_name_vals_get(pt, instance_name, instance_nr,
vals);
for (var integer i := 0; i < lengthof(vals); i := i + 1) {
if (last[i].name != vals[i].name) {
- setverdict(fail, "Internal error");
+ Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Internal error");
}
if (last[i].val != vals[i].val) {
changed := changed & { instance_name & "." &
int2str(instance_nr) & "." & vals[i].name };
@@ -400,7 +402,8 @@
}
if (lengthof(diff) > 0) {
log("ERROR\nExpected: ", expect_list, "\nGot: ", got_list);
- setverdict(fail, "Rate counters did not change as expected:" & diff);
+ Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail,
+ "Rate counters did not change as expected:" & diff);
} else {
setverdict(pass);
}
--
To view, visit
https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/38882?usp=email
To unsubscribe, or for help writing mail filters, visit
https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: merged
Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Change-Id: I3b11a4dee35da89b2fec0cc66021dd57db04beb4
Gerrit-Change-Number: 38882
Gerrit-PatchSet: 3
Gerrit-Owner: pespin <pespin(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: daniel <dwillmann(a)sysmocom.de>
Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: osmith <osmith(a)sysmocom.de>
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>