* [PATCH mptcp-next] selftests/bpf: Drop duplicate max/min definitions
@ 2022-04-26 10:09 Geliang Tang
2022-04-26 10:22 ` Matthieu Baerts
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Geliang Tang @ 2022-04-26 10:09 UTC (permalink / raw)
To: mptcp; +Cc: Geliang Tang, Daniel Borkmann, Song Liu
Drop duplicate macros min() and MAX() definitions in prog_tests and use
MIN() or MAX() in sys/param.h instead.
Signed-off-by: Geliang Tang <geliang.tang@suse.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Song Liu <songliubraving@fb.com>
Link: https://lore.kernel.org/bpf/1ae276da9925c2de59b5bdc93b693b4c243e692e.1649462033.git.geliang.tang@suse.com
---
This patch was applied on bpf-next. It needs to merge to mptcp_net-next
too. Since the commit "selftests: bpf: add bpf_first test" will depend
on this patch.
---
tools/testing/selftests/bpf/prog_tests/bpf_iter.c | 4 +---
tools/testing/selftests/bpf/prog_tests/bpf_tcp_ca.c | 6 ++----
tools/testing/selftests/bpf/prog_tests/snprintf.c | 4 +---
tools/testing/selftests/bpf/prog_tests/tc_redirect.c | 1 -
tools/testing/selftests/bpf/test_progs.h | 1 +
5 files changed, 5 insertions(+), 11 deletions(-)
diff --git a/tools/testing/selftests/bpf/prog_tests/bpf_iter.c b/tools/testing/selftests/bpf/prog_tests/bpf_iter.c
index 5142a7d130b2..2c403ddc8076 100644
--- a/tools/testing/selftests/bpf/prog_tests/bpf_iter.c
+++ b/tools/testing/selftests/bpf/prog_tests/bpf_iter.c
@@ -1192,8 +1192,6 @@ static void str_strip_first_line(char *str)
*dst = '\0';
}
-#define min(a, b) ((a) < (b) ? (a) : (b))
-
static void test_task_vma(void)
{
int err, iter_fd = -1, proc_maps_fd = -1;
@@ -1229,7 +1227,7 @@ static void test_task_vma(void)
len = 0;
while (len < CMP_BUFFER_SIZE) {
err = read_fd_into_buffer(iter_fd, task_vma_output + len,
- min(read_size, CMP_BUFFER_SIZE - len));
+ MIN(read_size, CMP_BUFFER_SIZE - len));
if (!err)
break;
if (CHECK(err < 0, "read_iter_fd", "read_iter_fd failed\n"))
diff --git a/tools/testing/selftests/bpf/prog_tests/bpf_tcp_ca.c b/tools/testing/selftests/bpf/prog_tests/bpf_tcp_ca.c
index 8f7a1cef7d87..e9a9a31b2ffe 100644
--- a/tools/testing/selftests/bpf/prog_tests/bpf_tcp_ca.c
+++ b/tools/testing/selftests/bpf/prog_tests/bpf_tcp_ca.c
@@ -10,8 +10,6 @@
#include "bpf_tcp_nogpl.skel.h"
#include "bpf_dctcp_release.skel.h"
-#define min(a, b) ((a) < (b) ? (a) : (b))
-
#ifndef ENOTSUPP
#define ENOTSUPP 524
#endif
@@ -53,7 +51,7 @@ static void *server(void *arg)
while (bytes < total_bytes && !READ_ONCE(stop)) {
nr_sent = send(fd, &batch,
- min(total_bytes - bytes, sizeof(batch)), 0);
+ MIN(total_bytes - bytes, sizeof(batch)), 0);
if (nr_sent == -1 && errno == EINTR)
continue;
if (nr_sent == -1) {
@@ -146,7 +144,7 @@ static void do_test(const char *tcp_ca, const struct bpf_map *sk_stg_map)
/* recv total_bytes */
while (bytes < total_bytes && !READ_ONCE(stop)) {
nr_recv = recv(fd, &batch,
- min(total_bytes - bytes, sizeof(batch)), 0);
+ MIN(total_bytes - bytes, sizeof(batch)), 0);
if (nr_recv == -1 && errno == EINTR)
continue;
if (nr_recv == -1)
diff --git a/tools/testing/selftests/bpf/prog_tests/snprintf.c b/tools/testing/selftests/bpf/prog_tests/snprintf.c
index 394ebfc3bbf3..4be6fdb78c6a 100644
--- a/tools/testing/selftests/bpf/prog_tests/snprintf.c
+++ b/tools/testing/selftests/bpf/prog_tests/snprintf.c
@@ -83,8 +83,6 @@ static void test_snprintf_positive(void)
test_snprintf__destroy(skel);
}
-#define min(a, b) ((a) < (b) ? (a) : (b))
-
/* Loads an eBPF object calling bpf_snprintf with up to 10 characters of fmt */
static int load_single_snprintf(char *fmt)
{
@@ -95,7 +93,7 @@ static int load_single_snprintf(char *fmt)
if (!skel)
return -EINVAL;
- memcpy(skel->rodata->fmt, fmt, min(strlen(fmt) + 1, 10));
+ memcpy(skel->rodata->fmt, fmt, MIN(strlen(fmt) + 1, 10));
ret = test_snprintf_single__load(skel);
test_snprintf_single__destroy(skel);
diff --git a/tools/testing/selftests/bpf/prog_tests/tc_redirect.c b/tools/testing/selftests/bpf/prog_tests/tc_redirect.c
index 7ad66a247c02..958dae769c52 100644
--- a/tools/testing/selftests/bpf/prog_tests/tc_redirect.c
+++ b/tools/testing/selftests/bpf/prog_tests/tc_redirect.c
@@ -949,7 +949,6 @@ static int tun_open(char *name)
return -1;
}
-#define MAX(a, b) ((a) > (b) ? (a) : (b))
enum {
SRC_TO_TARGET = 0,
TARGET_TO_SRC = 1,
diff --git a/tools/testing/selftests/bpf/test_progs.h b/tools/testing/selftests/bpf/test_progs.h
index eec4c7385b14..e6ae2e52a668 100644
--- a/tools/testing/selftests/bpf/test_progs.h
+++ b/tools/testing/selftests/bpf/test_progs.h
@@ -25,6 +25,7 @@ typedef __u16 __sum16;
#include <sys/wait.h>
#include <sys/types.h>
#include <sys/time.h>
+#include <sys/param.h>
#include <fcntl.h>
#include <pthread.h>
#include <linux/bpf.h>
--
2.34.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH mptcp-next] selftests/bpf: Drop duplicate max/min definitions
2022-04-26 10:09 [PATCH mptcp-next] selftests/bpf: Drop duplicate max/min definitions Geliang Tang
@ 2022-04-26 10:22 ` Matthieu Baerts
2022-04-26 10:28 ` Matthieu Baerts
2022-04-26 11:43 ` selftests/bpf: Drop duplicate max/min definitions: Tests Results MPTCP CI
2 siblings, 0 replies; 4+ messages in thread
From: Matthieu Baerts @ 2022-04-26 10:22 UTC (permalink / raw)
To: Geliang Tang, mptcp; +Cc: Daniel Borkmann, Song Liu
Hi Geliang,
@Daniel, @Song: please ignore this message, sorry for that.
@Geliang: I think you accidentally let 'git send-email' adding in cc
people mentioned in the commit message. Don't worry, you are not the
first one and you will not be the last one :)
On 26/04/2022 12:09, Geliang Tang wrote:
> Drop duplicate macros min() and MAX() definitions in prog_tests and use
> MIN() or MAX() in sys/param.h instead.
>
> Signed-off-by: Geliang Tang <geliang.tang@suse.com>
> Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
> Acked-by: Song Liu <songliubraving@fb.com>
> Link: https://lore.kernel.org/bpf/1ae276da9925c2de59b5bdc93b693b4c243e692e.1649462033.git.geliang.tang@suse.com
> ---
> This patch was applied on bpf-next. It needs to merge to mptcp_net-next
> too. Since the commit "selftests: bpf: add bpf_first test" will depend
> on this patch.
Thank you, I'm going to add it in our tree.
You can also send me an email on the ML with a link to a message in lore
or a sha in a Git repo. It might be easier and less "risky" ;-)
Cheers,
Matt
--
Tessares | Belgium | Hybrid Access Solutions
www.tessares.net
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH mptcp-next] selftests/bpf: Drop duplicate max/min definitions
2022-04-26 10:09 [PATCH mptcp-next] selftests/bpf: Drop duplicate max/min definitions Geliang Tang
2022-04-26 10:22 ` Matthieu Baerts
@ 2022-04-26 10:28 ` Matthieu Baerts
2022-04-26 11:43 ` selftests/bpf: Drop duplicate max/min definitions: Tests Results MPTCP CI
2 siblings, 0 replies; 4+ messages in thread
From: Matthieu Baerts @ 2022-04-26 10:28 UTC (permalink / raw)
To: Geliang Tang; +Cc: mptcp
Hi Geliang,
(without Daniel and Song)
On 26/04/2022 12:09, Geliang Tang wrote:
> Drop duplicate macros min() and MAX() definitions in prog_tests and use
> MIN() or MAX() in sys/param.h instead.
>
> Signed-off-by: Geliang Tang <geliang.tang@suse.com>
> Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
> Acked-by: Song Liu <songliubraving@fb.com>
> Link: https://lore.kernel.org/bpf/1ae276da9925c2de59b5bdc93b693b4c243e692e.1649462033.git.geliang.tang@suse.com
> ---
> This patch was applied on bpf-next. It needs to merge to mptcp_net-next
> too. Since the commit "selftests: bpf: add bpf_first test" will depend
> on this patch.
Thank you, just added in our tree (fixes for net-next):
New patches for t/upstream:
- 48ff9164f46e: selftests/bpf: Drop duplicate max/min definitions
- Results: 29d9117bba61..08fa6dc386aa (export)
Builds and tests are now in progress:
https://cirrus-ci.com/github/multipath-tcp/mptcp_net-next/export/20220426T102605
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] 4+ messages in thread
* Re: selftests/bpf: Drop duplicate max/min definitions: Tests Results
2022-04-26 10:09 [PATCH mptcp-next] selftests/bpf: Drop duplicate max/min definitions Geliang Tang
2022-04-26 10:22 ` Matthieu Baerts
2022-04-26 10:28 ` Matthieu Baerts
@ 2022-04-26 11:43 ` MPTCP CI
2 siblings, 0 replies; 4+ messages in thread
From: MPTCP CI @ 2022-04-26 11:43 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/5616027676442624
- Summary: https://api.cirrus-ci.com/v1/artifact/task/5616027676442624/summary/summary.txt
- KVM Validation: debug:
- Unstable: 2 failed test(s): selftest_diag selftest_mptcp_connect 🔴:
- Task: https://cirrus-ci.com/task/6741927583285248
- Summary: https://api.cirrus-ci.com/v1/artifact/task/6741927583285248/summary/summary.txt
Initiator: Patchew Applier
Commits: https://github.com/multipath-tcp/mptcp_net-next/commits/946d79797988
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] 4+ messages in thread
end of thread, other threads:[~2022-04-26 11:43 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-04-26 10:09 [PATCH mptcp-next] selftests/bpf: Drop duplicate max/min definitions Geliang Tang
2022-04-26 10:22 ` Matthieu Baerts
2022-04-26 10:28 ` Matthieu Baerts
2022-04-26 11:43 ` selftests/bpf: Drop duplicate max/min definitions: Tests Results MPTCP CI
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox