[M] Change in libosmo-netif[master]: stream_test: Improve mem mgmt, fix connection mgmt

2023-10-19 Thread arehbein
arehbein has submitted this change. ( 
https://gerrit.osmocom.org/c/libosmo-netif/+/34799?usp=email )

Change subject: stream_test: Improve mem mgmt, fix connection mgmt
..

stream_test: Improve mem mgmt, fix connection mgmt

 - Use tall_test as root context everywhere, don't create any other contexts
 - change .*_(cli|srv)_run_client() signature by adding talloc context as 
parameter
 - Open and Close server link inside test_recon()

Related: OS#6222
Change-Id: I9ef02ed113bc049ae430b93d0eb69641e2ee809b
---
M tests/stream/stream_test.c
M tests/stream/stream_test.ok
2 files changed, 93 insertions(+), 81 deletions(-)

Approvals:
  laforge: Looks good to me, approved
  Jenkins Builder: Verified
  pespin: Looks good to me, but someone else must approve




diff --git a/tests/stream/stream_test.c b/tests/stream/stream_test.c
index 4830302..0851558 100644
--- a/tests/stream/stream_test.c
+++ b/tests/stream/stream_test.c
@@ -340,10 +340,17 @@
   bool autoreconnect)
 {
struct timeval tv;
-   struct osmo_stream_cli *cli = make_client(ctx, host, port, 
autoreconnect);
+   struct osmo_stream_cli *cli;
+   if (osmo_stream_srv_link_open(lnk) < 0) {
+   printf("Unable to open server\n");
+   osmo_stream_srv_link_destroy(lnk);
+   return;
+   }
+   cli = make_client(ctx, host, port, autoreconnect);
if (!cli)
return;

+
printf("===\n");
printf("Client/Server entering %s event loop...\n", 
ASTR(autoreconnect));
printf("===\n");
@@ -368,6 +375,7 @@
}

osmo_stream_cli_destroy(cli);
+   osmo_stream_srv_link_close(lnk);
printf("{%lu.%06lu} %s test complete.\n\n", tv.tv_sec, tv.tv_usec, 
ASTR(autoreconnect));
 }

@@ -531,12 +539,10 @@
return 0;
 }

-struct osmo_stream_cli *test_segm_ipa_stream_srv_run_client(void)
+struct osmo_stream_cli *test_segm_ipa_stream_srv_run_client(void *ctx)
 {
struct osmo_stream_cli *osc;
-   void *ctx = talloc_named_const(NULL, 0, __func__);

-   (void) msgb_talloc_ctx_init(ctx, 0);
osc = osmo_stream_cli_create(ctx);
if (osc == NULL) {
fprintf(stderr, "osmo_stream_cli_create_iofd()\n");
@@ -546,7 +552,6 @@
osmo_stream_cli_set_local_port(osc, 8977);
osmo_stream_cli_set_port(osc, );
osmo_stream_cli_set_connect_cb(osc, 
test_segm_ipa_stream_srv_cli_connect_cb);
-   osmo_stream_cli_set_data(osc, ctx);
osmo_stream_cli_set_read_cb2(osc, test_segm_ipa_stream_srv_cli_read_cb);
osmo_stream_cli_set_nodelay(osc, true);
if (osmo_stream_cli_open(osc) < 0) {
@@ -590,7 +595,7 @@

 static int test_segm_ipa_stream_srv_srv_accept_cb(struct osmo_stream_srv_link 
*srv, int fd)
 {
-   void *ctx = talloc_named_const(NULL, 0, __func__);
+   void *ctx = osmo_stream_srv_link_get_data(srv);
struct osmo_stream_srv *oss =
osmo_stream_srv_create2(ctx, srv, fd, NULL);
if (oss == NULL) {
@@ -613,7 +618,7 @@
printf("Unable to open server\n");
exit(1);
}
-   osc = test_segm_ipa_stream_srv_run_client();
+   osc = test_segm_ipa_stream_srv_run_client(ctx);

printf("__Running test 
%s__\n", testname);
alarm(2);
@@ -714,7 +719,7 @@

 static int test_segm_ipa_stream_cli_srv_accept_cb(struct osmo_stream_srv_link 
*srv, int fd)
 {
-   void *ctx = talloc_named_const(NULL, 0, __func__);
+   void *ctx = osmo_stream_srv_link_get_data(srv);
struct osmo_stream_srv *oss =
osmo_stream_srv_create2(ctx, srv, fd, NULL);
unsigned char *data;
@@ -781,12 +786,10 @@
return 0;
 }

-static void *test_segm_ipa_stream_cli_run_client(void)
+static void *test_segm_ipa_stream_cli_run_client(void *ctx)
 {
struct osmo_stream_cli *osc;
-   void *ctx = talloc_named_const(NULL, 0, __func__);

-   (void) msgb_talloc_ctx_init(ctx, 0);
osc = osmo_stream_cli_create(ctx);
if (osc == NULL) {
fprintf(stderr, "osmo_stream_cli_create_iofd()\n");
@@ -795,7 +798,6 @@
osmo_stream_cli_set_addr(osc, "127.0.0.11");
osmo_stream_cli_set_local_port(osc, 8977);
osmo_stream_cli_set_port(osc, 1112);
-   osmo_stream_cli_set_data(osc, ctx);
osmo_stream_cli_set_read_cb2(osc, test_segm_ipa_stream_cli_cli_read_cb);
osmo_stream_cli_set_nodelay(osc, true);
osmo_stream_cli_set_segmentation_cb(osc, osmo_ipa_segmentation_cb);
@@ -818,7 +820,7 @@
printf("Unable to open server\n");
exit(1);
}
-   test_segm_ipa_stream_cli_run_client();
+   test_segm_ipa_stream_cli_run_client(ctx);


[M] Change in libosmo-netif[master]: stream_test: Improve mem mgmt, fix connection mgmt

2023-10-19 Thread laforge
Attention is currently required from: arehbein.

laforge has posted comments on this change. ( 
https://gerrit.osmocom.org/c/libosmo-netif/+/34799?usp=email )

Change subject: stream_test: Improve mem mgmt, fix connection mgmt
..


Patch Set 3: Code-Review+2


--
To view, visit https://gerrit.osmocom.org/c/libosmo-netif/+/34799?usp=email
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: libosmo-netif
Gerrit-Branch: master
Gerrit-Change-Id: I9ef02ed113bc049ae430b93d0eb69641e2ee809b
Gerrit-Change-Number: 34799
Gerrit-PatchSet: 3
Gerrit-Owner: arehbein 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge 
Gerrit-Reviewer: pespin 
Gerrit-Attention: arehbein 
Gerrit-Comment-Date: Thu, 19 Oct 2023 07:31:02 +
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment


[M] Change in libosmo-netif[master]: stream_test: Improve mem mgmt, fix connection mgmt

2023-10-18 Thread pespin
Attention is currently required from: arehbein.

pespin has posted comments on this change. ( 
https://gerrit.osmocom.org/c/libosmo-netif/+/34799?usp=email )

Change subject: stream_test: Improve mem mgmt, fix connection mgmt
..


Patch Set 3: Code-Review+1


--
To view, visit https://gerrit.osmocom.org/c/libosmo-netif/+/34799?usp=email
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: libosmo-netif
Gerrit-Branch: master
Gerrit-Change-Id: I9ef02ed113bc049ae430b93d0eb69641e2ee809b
Gerrit-Change-Number: 34799
Gerrit-PatchSet: 3
Gerrit-Owner: arehbein 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: pespin 
Gerrit-Attention: arehbein 
Gerrit-Comment-Date: Wed, 18 Oct 2023 14:15:08 +
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment


[M] Change in libosmo-netif[master]: stream_test: Improve mem mgmt, fix connection mgmt

2023-10-18 Thread arehbein
Attention is currently required from: pespin.

arehbein has posted comments on this change. ( 
https://gerrit.osmocom.org/c/libosmo-netif/+/34799?usp=email )

Change subject: stream_test: Improve mem mgmt, fix connection mgmt
..


Patch Set 3:

(3 comments)

File tests/stream/stream_test.c:

https://gerrit.osmocom.org/c/libosmo-netif/+/34799/comment/83301c5d_16fff92c
PS3, Line 549:  osmo_stream_cli_set_data(osc, ctx);
@pes...@sysmocom.de removal of instruction to set data


https://gerrit.osmocom.org/c/libosmo-netif/+/34799/comment/eccf3c5e_ac5540a5
PS3, Line 798:  osmo_stream_cli_set_data(osc, ctx);
@pes...@sysmocom.de removal of instruction to set data


File tests/stream/stream_test.ok:

https://gerrit.osmocom.org/c/libosmo-netif/+/34799/comment/01da628c_a1cd3d7f
PS3, Line 52: {20.20} [NA] Client's 
test_segm_ipa_stream_srv_cli_connect_cb(): [1-cli] Appending msg of type 
IPAC_MSGT_PING into buffer
> why this this output change?
It's due to the change of memory management in the test. Before the patch, the 
client side would set newly created talloc contexts as data for the client 
connection, this has been removed.

I have tagged you in the respective lines.



--
To view, visit https://gerrit.osmocom.org/c/libosmo-netif/+/34799?usp=email
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: libosmo-netif
Gerrit-Branch: master
Gerrit-Change-Id: I9ef02ed113bc049ae430b93d0eb69641e2ee809b
Gerrit-Change-Number: 34799
Gerrit-PatchSet: 3
Gerrit-Owner: arehbein 
Gerrit-Reviewer: Jenkins Builder
Gerrit-CC: pespin 
Gerrit-Attention: pespin 
Gerrit-Comment-Date: Wed, 18 Oct 2023 13:58:21 +
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: pespin 
Gerrit-MessageType: comment


[M] Change in libosmo-netif[master]: stream_test: Improve mem mgmt, fix connection mgmt

2023-10-18 Thread pespin
Attention is currently required from: arehbein.

pespin has posted comments on this change. ( 
https://gerrit.osmocom.org/c/libosmo-netif/+/34799?usp=email )

Change subject: stream_test: Improve mem mgmt, fix connection mgmt
..


Patch Set 3:

(1 comment)

File tests/stream/stream_test.ok:

https://gerrit.osmocom.org/c/libosmo-netif/+/34799/comment/0a152637_9a97b013
PS3, Line 52: {20.20} [NA] Client's 
test_segm_ipa_stream_srv_cli_connect_cb(): [1-cli] Appending msg of type 
IPAC_MSGT_PING into buffer
why this this output change?



--
To view, visit https://gerrit.osmocom.org/c/libosmo-netif/+/34799?usp=email
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: libosmo-netif
Gerrit-Branch: master
Gerrit-Change-Id: I9ef02ed113bc049ae430b93d0eb69641e2ee809b
Gerrit-Change-Number: 34799
Gerrit-PatchSet: 3
Gerrit-Owner: arehbein 
Gerrit-Reviewer: Jenkins Builder
Gerrit-CC: pespin 
Gerrit-Attention: arehbein 
Gerrit-Comment-Date: Wed, 18 Oct 2023 10:15:01 +
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Gerrit-MessageType: comment


[M] Change in libosmo-netif[master]: stream_test: Improve mem mgmt, fix connection mgmt

2023-10-17 Thread arehbein
Attention is currently required from: arehbein.

Hello Jenkins Builder,

I'd like you to reexamine a change. Please visit

https://gerrit.osmocom.org/c/libosmo-netif/+/34799?usp=email

to look at the new patch set (#3).


Change subject: stream_test: Improve mem mgmt, fix connection mgmt
..

stream_test: Improve mem mgmt, fix connection mgmt

 - Use tall_test as root context everywhere, don't create any other contexts
 - change .*_(cli|srv)_run_client() signature by adding talloc context as 
parameter
 - Open and Close server link inside test_recon()

Related: OS#6222
Change-Id: I9ef02ed113bc049ae430b93d0eb69641e2ee809b
---
M tests/stream/stream_test.c
M tests/stream/stream_test.ok
2 files changed, 93 insertions(+), 81 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/libosmo-netif refs/changes/99/34799/3
--
To view, visit https://gerrit.osmocom.org/c/libosmo-netif/+/34799?usp=email
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: libosmo-netif
Gerrit-Branch: master
Gerrit-Change-Id: I9ef02ed113bc049ae430b93d0eb69641e2ee809b
Gerrit-Change-Number: 34799
Gerrit-PatchSet: 3
Gerrit-Owner: arehbein 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Attention: arehbein 
Gerrit-MessageType: newpatchset


[M] Change in libosmo-netif[master]: stream_test: Improve mem mgmt, fix connection mgmt

2023-10-17 Thread arehbein
Attention is currently required from: arehbein.

Hello Jenkins Builder,

I'd like you to reexamine a change. Please visit

https://gerrit.osmocom.org/c/libosmo-netif/+/34799?usp=email

to look at the new patch set (#2).

The following approvals got outdated and were removed:
Verified-1 by Jenkins Builder


Change subject: stream_test: Improve mem mgmt, fix connection mgmt
..

stream_test: Improve mem mgmt, fix connection mgmt

 - Use tall_test as root context everywhere, don't create any other contexts
 - change .*_(cli|srv)_run_client() signature by adding talloc context as 
parameter
 - Open and Close server link inside test_recon()
 - Print full talloc report

Related: OS#6222
Change-Id: I9ef02ed113bc049ae430b93d0eb69641e2ee809b
---
M tests/stream/stream_test.c
M tests/stream/stream_test.ok
2 files changed, 94 insertions(+), 81 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/libosmo-netif refs/changes/99/34799/2
--
To view, visit https://gerrit.osmocom.org/c/libosmo-netif/+/34799?usp=email
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: libosmo-netif
Gerrit-Branch: master
Gerrit-Change-Id: I9ef02ed113bc049ae430b93d0eb69641e2ee809b
Gerrit-Change-Number: 34799
Gerrit-PatchSet: 2
Gerrit-Owner: arehbein 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Attention: arehbein 
Gerrit-MessageType: newpatchset


[M] Change in libosmo-netif[master]: stream_test: Improve mem mgmt, fix connection mgmt

2023-10-17 Thread arehbein
arehbein has uploaded this change for review. ( 
https://gerrit.osmocom.org/c/libosmo-netif/+/34799?usp=email )


Change subject: stream_test: Improve mem mgmt, fix connection mgmt
..

stream_test: Improve mem mgmt, fix connection mgmt

 - Use tall_test as root context everywhere, don't create any other contexts
 - change .*_(cli|srv)_run_client() signature by adding talloc context as 
parameter
 - Open and Close server link inside test_recon()
 - Print full talloc report

Related: OS#6222
Change-Id: I9ef02ed113bc049ae430b93d0eb69641e2ee809b
---
M tests/stream/stream_test.c
M tests/stream/stream_test.err
M tests/stream/stream_test.ok
3 files changed, 121 insertions(+), 81 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/libosmo-netif refs/changes/99/34799/1

diff --git a/tests/stream/stream_test.c b/tests/stream/stream_test.c
index 4830302..383059a 100644
--- a/tests/stream/stream_test.c
+++ b/tests/stream/stream_test.c
@@ -340,10 +340,17 @@
   bool autoreconnect)
 {
struct timeval tv;
-   struct osmo_stream_cli *cli = make_client(ctx, host, port, 
autoreconnect);
+   struct osmo_stream_cli *cli;
+   if (osmo_stream_srv_link_open(lnk) < 0) {
+   printf("Unable to open server\n");
+   osmo_stream_srv_link_destroy(lnk);
+   return;
+   }
+   cli = make_client(ctx, host, port, autoreconnect);
if (!cli)
return;

+
printf("===\n");
printf("Client/Server entering %s event loop...\n", 
ASTR(autoreconnect));
printf("===\n");
@@ -368,6 +375,7 @@
}

osmo_stream_cli_destroy(cli);
+   osmo_stream_srv_link_close(lnk);
printf("{%lu.%06lu} %s test complete.\n\n", tv.tv_sec, tv.tv_usec, 
ASTR(autoreconnect));
 }

@@ -531,12 +539,10 @@
return 0;
 }

-struct osmo_stream_cli *test_segm_ipa_stream_srv_run_client(void)
+struct osmo_stream_cli *test_segm_ipa_stream_srv_run_client(void *ctx)
 {
struct osmo_stream_cli *osc;
-   void *ctx = talloc_named_const(NULL, 0, __func__);
 
-   (void) msgb_talloc_ctx_init(ctx, 0);
osc = osmo_stream_cli_create(ctx);
if (osc == NULL) {
fprintf(stderr, "osmo_stream_cli_create_iofd()\n");
@@ -546,7 +552,6 @@
osmo_stream_cli_set_local_port(osc, 8977);
osmo_stream_cli_set_port(osc, );
osmo_stream_cli_set_connect_cb(osc, 
test_segm_ipa_stream_srv_cli_connect_cb);
-   osmo_stream_cli_set_data(osc, ctx);
osmo_stream_cli_set_read_cb2(osc, test_segm_ipa_stream_srv_cli_read_cb);
osmo_stream_cli_set_nodelay(osc, true);
if (osmo_stream_cli_open(osc) < 0) {
@@ -590,7 +595,7 @@

 static int test_segm_ipa_stream_srv_srv_accept_cb(struct osmo_stream_srv_link 
*srv, int fd)
 {
-   void *ctx = talloc_named_const(NULL, 0, __func__);
+   void *ctx = osmo_stream_srv_link_get_data(srv);
struct osmo_stream_srv *oss =
osmo_stream_srv_create2(ctx, srv, fd, NULL);
if (oss == NULL) {
@@ -613,7 +618,7 @@
printf("Unable to open server\n");
exit(1);
}
-   osc = test_segm_ipa_stream_srv_run_client();
+   osc = test_segm_ipa_stream_srv_run_client(ctx);

printf("__Running test 
%s__\n", testname);
alarm(2);
@@ -714,7 +719,7 @@

 static int test_segm_ipa_stream_cli_srv_accept_cb(struct osmo_stream_srv_link 
*srv, int fd)
 {
-   void *ctx = talloc_named_const(NULL, 0, __func__);
+   void *ctx = osmo_stream_srv_link_get_data(srv);
struct osmo_stream_srv *oss =
osmo_stream_srv_create2(ctx, srv, fd, NULL);
unsigned char *data;
@@ -781,12 +786,10 @@
return 0;
 }

-static void *test_segm_ipa_stream_cli_run_client(void)
+static void *test_segm_ipa_stream_cli_run_client(void *ctx)
 {
struct osmo_stream_cli *osc;
-   void *ctx = talloc_named_const(NULL, 0, __func__);

-   (void) msgb_talloc_ctx_init(ctx, 0);
osc = osmo_stream_cli_create(ctx);
if (osc == NULL) {
fprintf(stderr, "osmo_stream_cli_create_iofd()\n");
@@ -795,7 +798,6 @@
osmo_stream_cli_set_addr(osc, "127.0.0.11");
osmo_stream_cli_set_local_port(osc, 8977);
osmo_stream_cli_set_port(osc, 1112);
-   osmo_stream_cli_set_data(osc, ctx);
osmo_stream_cli_set_read_cb2(osc, test_segm_ipa_stream_cli_cli_read_cb);
osmo_stream_cli_set_nodelay(osc, true);
osmo_stream_cli_set_segmentation_cb(osc, osmo_ipa_segmentation_cb);
@@ -818,7 +820,7 @@
printf("Unable to open server\n");
exit(1);
}
-   test_segm_ipa_stream_cli_run_client();
+   test_segm_ipa_stream_cli_run_client(ctx);