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
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 1:
(1 comment)
File bsc/BSC_Tests.ttcn:
https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/26617/comment/97c11097_7ee3…
PS1, Line 1069: if (g_vty_initialized) {
> good idea!
I would have done that, but f_logp() is not on MSC_ConnHdlr and hence doesn't know g_* variables. Is there a way to find out from the state of the TELNETasp_PT whether it is connected?
--
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: 1
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 22:56:54 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: laforge <laforge(a)osmocom.org>
Comment-In-Reply-To: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-MessageType: comment
Attention is currently required from: pespin.
neels has posted comments on this change. ( https://gerrit.osmocom.org/c/libosmocore/+/26608 )
Change subject: add osmo_sockaddr_to_str_c(), osmo_sockaddr_to_str_buf2()
......................................................................
Patch Set 2:
(6 comments)
Patchset:
PS2:
the function was defined to return null for short buf.
The new version is better, it returns a truncated string and the would-be-required length.
File src/socket.c:
https://gerrit.osmocom.org/c/libosmocore/+/26608/comment/6efb1de2_9815eff3
PS1, Line 1827: /*! string-format a given osmo_sockaddr address into a user-supplied buffer.
> I think you are changing how this function used to worked here, and imho it's unexpected. […]
Previously, the function would return NULL in case of errors, just in a specific corner case it didn't. Read the API doc: "or NULL if too short". The C test shows this.
File tests/socket/socket_test.c:
https://gerrit.osmocom.org/c/libosmocore/+/26608/comment/4d53c597_41a7e44d
PS2, Line 350: OSMO_ASSERT(!strncmp("[::1]:4", result, sizeof(buf)));
here for some reason, even though the port number should be 42, the function failed to return NULL.
https://gerrit.osmocom.org/c/libosmocore/+/26608/comment/7d6b93bc_a59aebae
PS2, Line 350: OSMO_ASSERT(result == NULL);
Now this corner case is fixed.
https://gerrit.osmocom.org/c/libosmocore/+/26608/comment/877da413_f3e9b34f
PS2, Line 357: OSMO_ASSERT(result == NULL);
here and
https://gerrit.osmocom.org/c/libosmocore/+/26608/comment/5c7fc121_72005a9d
PS2, Line 363: OSMO_ASSERT(result == NULL);
here it was always verified to return NULL for a short buffer
--
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/26608
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: I12771bf8a021e6785217b1faad03c09ec1cfef0e
Gerrit-Change-Number: 26608
Gerrit-PatchSet: 2
Gerrit-Owner: neels <nhofmeyr(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: lynxis lazus <lynxis(a)fe80.eu>
Gerrit-CC: pespin <pespin(a)sysmocom.de>
Gerrit-Attention: pespin <pespin(a)sysmocom.de>
Gerrit-Comment-Date: Sat, 22 Jan 2022 22:46:20 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: pespin <pespin(a)sysmocom.de>
Gerrit-MessageType: comment