MPTCP Linux Development
 help / color / mirror / Atom feed
* [PATCH mptcp-next] Squash to "selftests: bpf: verify ca_name of struct mptcp_sock"
@ 2022-03-13 11:48 Geliang Tang
  0 siblings, 0 replies; 5+ messages in thread
From: Geliang Tang @ 2022-03-13 11:48 UTC (permalink / raw)
  To: mptcp; +Cc: Geliang Tang

Drop 'err' label.

Signed-off-by: Geliang Tang <geliang.tang@suse.com>
---
 tools/testing/selftests/bpf/prog_tests/mptcp.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/tools/testing/selftests/bpf/prog_tests/mptcp.c b/tools/testing/selftests/bpf/prog_tests/mptcp.c
index aff35ab33379..a8c0082dbd01 100644
--- a/tools/testing/selftests/bpf/prog_tests/mptcp.c
+++ b/tools/testing/selftests/bpf/prog_tests/mptcp.c
@@ -93,12 +93,9 @@ void get_msk_ca_name(char ca_name[])
 	}
 
 	len = read(fd, ca_name, TCP_CA_NAME_MAX);
-	if (CHECK_FAIL(len < 0)) {
+	if (CHECK_FAIL(len < 0))
 		log_err("Failed to read %s", TCP_CA_SYSCTL);
-		goto err;
-	}
 
-err:
 	close(fd);
 }
 
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH mptcp-next] Squash to "selftests: bpf: verify ca_name of struct mptcp_sock"
@ 2022-04-30 14:31 Geliang Tang
  2022-04-30 16:14 ` Squash to "selftests: bpf: verify ca_name of struct mptcp_sock": Tests Results MPTCP CI
  2022-05-02 20:43 ` [PATCH mptcp-next] Squash to "selftests: bpf: verify ca_name of struct mptcp_sock" Matthieu Baerts
  0 siblings, 2 replies; 5+ messages in thread
From: Geliang Tang @ 2022-04-30 14:31 UTC (permalink / raw)
  To: mptcp; +Cc: Geliang Tang

Read /proc/sys/net/ipv4/tcp_congestion_control directly, instead of
using sysctl.

Signed-off-by: Geliang Tang <geliang.tang@suse.com>
---
 .../testing/selftests/bpf/prog_tests/mptcp.c  | 20 ++++++++++++++++---
 1 file changed, 17 insertions(+), 3 deletions(-)

diff --git a/tools/testing/selftests/bpf/prog_tests/mptcp.c b/tools/testing/selftests/bpf/prog_tests/mptcp.c
index 7e704f5aab05..ed5773c26045 100644
--- a/tools/testing/selftests/bpf/prog_tests/mptcp.c
+++ b/tools/testing/selftests/bpf/prog_tests/mptcp.c
@@ -88,12 +88,26 @@ static __u32 get_msk_token(void)
 
 void get_msk_ca_name(char ca_name[])
 {
-	FILE *stream = popen("sysctl -b net.ipv4.tcp_congestion_control", "r");
+	size_t len;
+	int fd;
+
+	fd = open("/proc/sys/net/ipv4/tcp_congestion_control", O_RDONLY);
+	if (CHECK_FAIL(fd < 0)) {
+		log_err("Failed to open tcp_congestion_control");
+		return;
+	}
 
-	if (!fgets(ca_name, TCP_CA_NAME_MAX, stream))
+	len = read(fd, ca_name, TCP_CA_NAME_MAX);
+	if (CHECK_FAIL(len < 0)) {
 		log_err("Failed to read ca_name");
+		goto err;
+	}
+
+	if (len > 0 && ca_name[len - 1] == '\n')
+		ca_name[len - 1] = '\0';
 
-	pclose(stream);
+err:
+	close(fd);
 }
 
 static int verify_msk(int map_fd, int client_fd)
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: Squash to "selftests: bpf: verify ca_name of struct mptcp_sock": Tests Results
  2022-04-30 14:31 [PATCH mptcp-next] Squash to "selftests: bpf: verify ca_name of struct mptcp_sock" Geliang Tang
@ 2022-04-30 16:14 ` MPTCP CI
  2022-05-02 20:43 ` [PATCH mptcp-next] Squash to "selftests: bpf: verify ca_name of struct mptcp_sock" Matthieu Baerts
  1 sibling, 0 replies; 5+ messages in thread
From: MPTCP CI @ 2022-04-30 16:14 UTC (permalink / raw)
  To: Geliang Tang; +Cc: mptcp

Hi Geliang,

Thank you for your modifications, that's great!

Our CI did some validations and here is its report:

- KVM Validation: normal:
  - Success! ✅:
  - Task: https://cirrus-ci.com/task/5168408332337152
  - Summary: https://api.cirrus-ci.com/v1/artifact/task/5168408332337152/summary/summary.txt

- KVM Validation: debug:
  - Unstable: 1 failed test(s): selftest_diag - Critical: 1 Call Trace(s) ❌:
  - Task: https://cirrus-ci.com/task/6294308239179776
  - Summary: https://api.cirrus-ci.com/v1/artifact/task/6294308239179776/summary/summary.txt

Initiator: Patchew Applier
Commits: https://github.com/multipath-tcp/mptcp_net-next/commits/c71199312813


If there are some issues, you can reproduce them using the same environment as
the one used by the CI thanks to a docker image, e.g.:

    $ cd [kernel source code]
    $ docker run -v "${PWD}:${PWD}:rw" -w "${PWD}" --privileged --rm -it \
        --pull always mptcp/mptcp-upstream-virtme-docker:latest \
        auto-debug

For more details:

    https://github.com/multipath-tcp/mptcp-upstream-virtme-docker


Please note that despite all the efforts that have been already done to have a
stable tests suite when executed on a public CI like here, it is possible some
reported issues are not due to your modifications. Still, do not hesitate to
help us improve that ;-)

Cheers,
MPTCP GH Action bot
Bot operated by Matthieu Baerts (Tessares)

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH mptcp-next] Squash to "selftests: bpf: verify ca_name of struct mptcp_sock"
  2022-04-30 14:31 [PATCH mptcp-next] Squash to "selftests: bpf: verify ca_name of struct mptcp_sock" Geliang Tang
  2022-04-30 16:14 ` Squash to "selftests: bpf: verify ca_name of struct mptcp_sock": Tests Results MPTCP CI
@ 2022-05-02 20:43 ` Matthieu Baerts
  1 sibling, 0 replies; 5+ messages in thread
From: Matthieu Baerts @ 2022-05-02 20:43 UTC (permalink / raw)
  To: Geliang Tang, mptcp

Hi Geliang,

On 30/04/2022 16:31, Geliang Tang wrote:
> Read /proc/sys/net/ipv4/tcp_congestion_control directly, instead of
> using sysctl.

Thank you for the patch!

Now in our tree:

- 7578ba9005cf: "squashed" in "selftests: bpf: verify ca_name of struct
mptcp_sock"
- Results: 8ae619c5e009..929d7e14ecf1 (export)


Builds and tests are now in progress:

https://cirrus-ci.com/github/multipath-tcp/mptcp_net-next/export/20220502T203959
https://github.com/multipath-tcp/mptcp_net-next/actions/workflows/build-validation.yml?query=branch:export

Cheers,
Matt
-- 
Tessares | Belgium | Hybrid Access Solutions
www.tessares.net

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH mptcp-next] Squash to "selftests: bpf: verify ca_name of struct mptcp_sock"
  2022-05-07  6:17 [PATCH mptcp-next] Squash to "selftests: bpf: add MPTCP test base" Geliang Tang
@ 2022-05-07  6:17 ` Geliang Tang
  0 siblings, 0 replies; 5+ messages in thread
From: Geliang Tang @ 2022-05-07  6:17 UTC (permalink / raw)
  To: mptcp; +Cc: Geliang Tang

Address to Andrii's comments:
- use ASSERT_* instead of CHECK_FAIL

Signed-off-by: Geliang Tang <geliang.tang@suse.com>
---
 tools/testing/selftests/bpf/prog_tests/mptcp.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/tools/testing/selftests/bpf/prog_tests/mptcp.c b/tools/testing/selftests/bpf/prog_tests/mptcp.c
index ad7f91d35e96..ebc9a187acd6 100644
--- a/tools/testing/selftests/bpf/prog_tests/mptcp.c
+++ b/tools/testing/selftests/bpf/prog_tests/mptcp.c
@@ -86,16 +86,12 @@ void get_msk_ca_name(char ca_name[])
 	int fd;
 
 	fd = open("/proc/sys/net/ipv4/tcp_congestion_control", O_RDONLY);
-	if (CHECK_FAIL(fd < 0)) {
-		log_err("Failed to open tcp_congestion_control");
+	if (!ASSERT_GT(fd, 0, "Failed to open tcp_congestion_control"))
 		return;
-	}
 
 	len = read(fd, ca_name, TCP_CA_NAME_MAX);
-	if (CHECK_FAIL(len < 0)) {
-		log_err("Failed to read ca_name");
+	if (!ASSERT_GT(len, 0, "Failed to read ca_name"))
 		goto err;
-	}
 
 	if (len > 0 && ca_name[len - 1] == '\n')
 		ca_name[len - 1] = '\0';
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2022-05-07  6:18 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-04-30 14:31 [PATCH mptcp-next] Squash to "selftests: bpf: verify ca_name of struct mptcp_sock" Geliang Tang
2022-04-30 16:14 ` Squash to "selftests: bpf: verify ca_name of struct mptcp_sock": Tests Results MPTCP CI
2022-05-02 20:43 ` [PATCH mptcp-next] Squash to "selftests: bpf: verify ca_name of struct mptcp_sock" Matthieu Baerts
  -- strict thread matches above, loose matches on Subject: below --
2022-05-07  6:17 [PATCH mptcp-next] Squash to "selftests: bpf: add MPTCP test base" Geliang Tang
2022-05-07  6:17 ` [PATCH mptcp-next] Squash to "selftests: bpf: verify ca_name of struct mptcp_sock" Geliang Tang
2022-03-13 11:48 Geliang Tang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox