neels has submitted this change. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/26619 )
Change subject: bsc: detect subscr and conn leaks during f_shutdown_helper()
......................................................................
bsc: detect subscr and conn leaks during f_shutdown_helper()
Invoke f_verify_talloc_count() for bsc_subscr and
gsm_subscriber_connection, expecting none to remain after each test.
This makes numerous tests fail, where the test does not properly release
the RSL and BSSAP connections. An upcoming patch fixes all of those
cases: I9396efcabc085d2850244c6468b83c5f3a3ff3a2
Related: OS#5337
Change-Id: I69d4c5c6f8d499bb7f0b96a48af045361433c57b
---
M bsc/BSC_Tests.ttcn
1 file changed, 5 insertions(+), 0 deletions(-)
Approvals:
Jenkins Builder: Verified
laforge: Looks good to me, but someone else must approve
fixeria: Looks good to me, but someone else must approve
pespin: Looks good to me, but someone else must approve
diff --git a/bsc/BSC_Tests.ttcn b/bsc/BSC_Tests.ttcn
index 891d340..d68cba2 100644
--- a/bsc/BSC_Tests.ttcn
+++ b/bsc/BSC_Tests.ttcn
@@ -857,6 +857,11 @@
friend function f_shutdown_helper() runs on test_CT {
+ /* Run the subscr and conn leak test only when the VTY is initialized */
+ if (BSCVTY.checkstate("Mapped")) {
+ f_verify_talloc_count(BSCVTY, {"struct bsc_subscr", "struct gsm_subscriber_connection"});
+ }
+
all component.stop;
setverdict(pass);
mtc.stop;
null--
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/26619
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: I69d4c5c6f8d499bb7f0b96a48af045361433c57b
Gerrit-Change-Number: 26619
Gerrit-PatchSet: 3
Gerrit-Owner: neels <nhofmeyr(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
Gerrit-MessageType: merged
neels has submitted this change. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/26618 )
Change subject: vty: add f_verify_talloc_count()
......................................................................
vty: add f_verify_talloc_count()
Counts talloc objects via VTY and waits for a specific object count.
Useful to test against leaks.
The intended use is to check against leakage of bsc_subscr and
gsm_subscriber_connection after each BSC_Tests.*, see patch in 'Related'
below.
Related: OS#5337
Related: I69d4c5c6f8d499bb7f0b96a48af045361433c57b (osmo-ttcn3-hacks)
Change-Id: Iafe720a4931270e868f40c4f623d10bb9c14dc80
---
M library/Osmocom_VTY_Functions.ttcn
1 file changed, 64 insertions(+), 0 deletions(-)
Approvals:
Jenkins Builder: Verified
diff --git a/library/Osmocom_VTY_Functions.ttcn b/library/Osmocom_VTY_Functions.ttcn
index 49f587d..e4a9182 100644
--- a/library/Osmocom_VTY_Functions.ttcn
+++ b/library/Osmocom_VTY_Functions.ttcn
@@ -14,6 +14,7 @@
import from Misc_Helpers all;
import from TELNETasp_PortType all;
import from Osmocom_Types all;
+ import from TCCConversion_Functions all;
modulepar {
charstring mp_prompt_prefix := "OpenBSC";
@@ -226,4 +227,67 @@
return "";
}
+/* Return a count of how many times sub_str occurs in str. */
+function f_strstr_count(in charstring str, in charstring sub_str) return integer
+{
+ var integer count := 0;
+ var integer pos := 0;
+
+ while (true) {
+ var integer at := f_strstr(str, sub_str, pos);
+ if (at < 0) {
+ break;
+ }
+ count := count + 1;
+ pos := at + 1;
+ }
+ return count;
+}
+
+private type record of charstring StrList;
+
+/* Perform a 'show talloc-context' to get a count of the given object_strs that are still allocated.
+ * Retry 'attempts' times until the actual talloc object count matches 'expect_count'.
+ * Useful to ensure that no mem leaks remain after running a test. */
+function f_verify_talloc_count(TELNETasp_PT pt, StrList object_strs, integer expect_count := 0,
+ integer attempts := 5, float wait_time := 3.0)
+{
+ var charstring show_cmd := "show talloc-context application full filter ";
+ for (var integer i := 0; i < lengthof(object_strs); i := i + 1) {
+ var charstring obj_str := object_strs[i];
+ /* spaces confuse the VTY command */
+ obj_str := f_replaceEveryOccurenceOfSubstring(obj_str, " ", ".");
+ /* In the regexp, expect word start and word end to bound the obj name */
+ obj_str := "\\<" & obj_str & "\\>";
+ if (i > 0) {
+ show_cmd := show_cmd & "\\|";
+ }
+ show_cmd := show_cmd & obj_str;
+ }
+
+ while (attempts > 0) {
+ attempts := attempts - 1;
+ var charstring ret := f_vty_transceive_ret(pt, show_cmd);
+
+ var boolean ok := true;
+ for (var integer i := 0; i < lengthof(object_strs); i := i + 1) {
+ var charstring object_str := object_strs[i];
+ var integer count := f_strstr_count(ret, object_str);
+ log("talloc reports ", object_str, " x ", count, ", expecting ", expect_count);
+ if (count != expect_count) {
+ ok := false;
+ }
+ }
+ if (ok) {
+ return;
+ }
+ if (attempts == 0) {
+ break;
+ }
+ log("count mismatch, retrying in ", wait_time);
+ f_sleep(wait_time);
+ }
+ setverdict(fail, "talloc count mismatch");
+}
+
}
null--
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/26618
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: Iafe720a4931270e868f40c4f623d10bb9c14dc80
Gerrit-Change-Number: 26618
Gerrit-PatchSet: 3
Gerrit-Owner: neels <nhofmeyr(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-CC: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-CC: pespin <pespin(a)sysmocom.de>
Gerrit-MessageType: merged
neels has submitted this change. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/26617 )
Change subject: bsc: make perform_clear() work when VTY is not initialized
......................................................................
bsc: make perform_clear() work when VTY is not initialized
To be able to invoke perform_clear() also in tests where the VTY isn't
used, in f_logp() only access the VTY when it is actually ready.
Otherwise this causes an error and a failed test, for no good reason.
Related: OS#5337
Change-Id: I8116075f32937bd06ba14b426010bf6fec2ef402
---
M bsc/BSC_Tests.ttcn
1 file changed, 3 insertions(+), 1 deletion(-)
Approvals:
Jenkins Builder: Verified
diff --git a/bsc/BSC_Tests.ttcn b/bsc/BSC_Tests.ttcn
index 0dd4440..891d340 100644
--- a/bsc/BSC_Tests.ttcn
+++ b/bsc/BSC_Tests.ttcn
@@ -1077,7 +1077,9 @@
// log on TTCN3 log output
log(log_msg);
// log in stderr log
- f_vty_transceive(pt, "logp lglobal notice TTCN3 f_logp(): " & log_msg);
+ if (pt.checkstate("Mapped")) {
+ f_vty_transceive(pt, "logp lglobal notice TTCN3 f_logp(): " & log_msg);
+ }
}
private function f_sysinfo_seen(integer rsl_idx, RSL_Message rsl) runs on test_CT
null--
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/26617
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: I8116075f32937bd06ba14b426010bf6fec2ef402
Gerrit-Change-Number: 26617
Gerrit-PatchSet: 3
Gerrit-Owner: neels <nhofmeyr(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
Gerrit-CC: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-MessageType: merged
Attention is currently required from: fixeria.
neels has posted comments on this change. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/26618 )
Change subject: vty: add f_verify_talloc_count()
......................................................................
Patch Set 3:
(1 comment)
File library/Osmocom_VTY_Functions.ttcn:
https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/26618/comment/4ad3ee0d_b084…
PS1, Line 254: "
> No semicolon?
funky!! how does that even compile!?
titan insists on no-trailing-comma in lists and insists on {} for 'if', but then it ignores a missing semicolon.
--
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/26618
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: Iafe720a4931270e868f40c4f623d10bb9c14dc80
Gerrit-Change-Number: 26618
Gerrit-PatchSet: 3
Gerrit-Owner: neels <nhofmeyr(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-CC: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-CC: pespin <pespin(a)sysmocom.de>
Gerrit-Attention: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Comment-Date: Sun, 23 Jan 2022 00:24:08 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-MessageType: comment
Attention is currently required from: laforge, fixeria.
Hello Jenkins Builder, laforge, pespin,
I'd like you to reexamine a change. Please visit
https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/26617
to look at the new patch set (#3).
Change subject: bsc: make perform_clear() work when VTY is not initialized
......................................................................
bsc: make perform_clear() work when VTY is not initialized
To be able to invoke perform_clear() also in tests where the VTY isn't
used, in f_logp() only access the VTY when it is actually ready.
Otherwise this causes an error and a failed test, for no good reason.
Related: OS#5337
Change-Id: I8116075f32937bd06ba14b426010bf6fec2ef402
---
M bsc/BSC_Tests.ttcn
1 file changed, 3 insertions(+), 1 deletion(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-ttcn3-hacks refs/changes/17/26617/3
--
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/26617
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: I8116075f32937bd06ba14b426010bf6fec2ef402
Gerrit-Change-Number: 26617
Gerrit-PatchSet: 3
Gerrit-Owner: neels <nhofmeyr(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
Gerrit-CC: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Attention: laforge <laforge(a)osmocom.org>
Gerrit-Attention: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-MessageType: newpatchset
Hello Jenkins Builder, laforge, pespin, fixeria,
I'd like you to reexamine a change. Please visit
https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/26620
to look at the new patch set (#3).
Change subject: bsc: f_perform_clear: ack all DLCX and RSL REL REQ
......................................................................
bsc: f_perform_clear: ack all DLCX and RSL REL REQ
ACK any MGCP DLCX or RLL REL REQ during f_perform_clear(), which makes
it more universally applicable to invoke at the end of a test.
Related: OS#5337
Change-Id: Ie5b77c266a5d8f47edd187c474df281a799a81de
---
M bsc/BSC_Tests.ttcn
1 file changed, 20 insertions(+), 0 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-ttcn3-hacks refs/changes/20/26620/3
--
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/26620
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: Ie5b77c266a5d8f47edd187c474df281a799a81de
Gerrit-Change-Number: 26620
Gerrit-PatchSet: 3
Gerrit-Owner: neels <nhofmeyr(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
Gerrit-MessageType: newpatchset
Attention is currently required from: laforge, fixeria.
neels has posted comments on this change. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/26617 )
Change subject: bsc: make perform_clear() work when VTY is not initialized
......................................................................
Patch Set 2:
(1 comment)
File bsc/BSC_Tests.ttcn:
https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/26617/comment/7f1e004c_9761…
PS1, Line 1069: if (g_vty_initialized) {
> I would have done that, but f_logp() is not on MSC_ConnHdlr and hence doesn't know g_* variables. […]
oh apparently i found a way in a subsequent patch:
if (BSCVTY.checkstate("Mapped"))
--
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/26617
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: I8116075f32937bd06ba14b426010bf6fec2ef402
Gerrit-Change-Number: 26617
Gerrit-PatchSet: 2
Gerrit-Owner: neels <nhofmeyr(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
Gerrit-CC: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Attention: laforge <laforge(a)osmocom.org>
Gerrit-Attention: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Comment-Date: Sat, 22 Jan 2022 23:10:04 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: neels <nhofmeyr(a)sysmocom.de>
Comment-In-Reply-To: laforge <laforge(a)osmocom.org>
Comment-In-Reply-To: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-MessageType: comment
Hello Jenkins Builder, laforge,
I'd like you to reexamine a change. Please visit
https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/26618
to look at the new patch set (#2).
Change subject: vty: add f_verify_talloc_count()
......................................................................
vty: add f_verify_talloc_count()
Counts talloc objects via VTY and waits for a specific object count.
Useful to test against leaks.
The intended use is to check against leakage of bsc_subscr and
gsm_subscriber_connection after each BSC_Tests.*, see patch in 'Related'
below.
Related: OS#5337
Related: I69d4c5c6f8d499bb7f0b96a48af045361433c57b (osmo-ttcn3-hacks)
Change-Id: Iafe720a4931270e868f40c4f623d10bb9c14dc80
---
M library/Osmocom_VTY_Functions.ttcn
1 file changed, 64 insertions(+), 0 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-ttcn3-hacks refs/changes/18/26618/2
--
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/26618
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: Iafe720a4931270e868f40c4f623d10bb9c14dc80
Gerrit-Change-Number: 26618
Gerrit-PatchSet: 2
Gerrit-Owner: neels <nhofmeyr(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-CC: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-CC: pespin <pespin(a)sysmocom.de>
Gerrit-MessageType: newpatchset