On 4/8/22 3:36 PM, Geliang Tang wrote:
Drop duplicate macros min() and MAX() definitions in prog_tests, use MIN()
or MAX() in sys/param.h instead.
Signed-off-by: Geliang Tang <geliang.tang@xxxxxxxx>
[...]
Thanks Geliang! One small final nit and then it's good to go to bpf-next:
diff --git a/tools/testing/selftests/bpf/prog_tests/bpf_iter.c b/tools/testing/selftests/bpf/prog_tests/bpf_iter.c
index 5142a7d130b2..86561c0b0dea 100644
--- a/tools/testing/selftests/bpf/prog_tests/bpf_iter.c
+++ b/tools/testing/selftests/bpf/prog_tests/bpf_iter.c
@@ -1,5 +1,6 @@
// SPDX-License-Identifier: GPL-2.0
/* Copyright (c) 2020 Facebook */
+#include <sys/param.h>
#include <test_progs.h>
#include "bpf_iter_ipv6_route.skel.h"
#include "bpf_iter_netlink.skel.h"
[...]
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..ceed369361fc 100644
--- a/tools/testing/selftests/bpf/prog_tests/bpf_tcp_ca.c
+++ b/tools/testing/selftests/bpf/prog_tests/bpf_tcp_ca.c
@@ -3,6 +3,7 @@
#include <linux/err.h>
#include <netinet/tcp.h>
+#include <sys/param.h>
#include <test_progs.h>
#include "network_helpers.h"
#include "bpf_dctcp.skel.h"
[...]
diff --git a/tools/testing/selftests/bpf/prog_tests/snprintf.c b/tools/testing/selftests/bpf/prog_tests/snprintf.c
index 394ebfc3bbf3..5ca70aa15c4a 100644
--- a/tools/testing/selftests/bpf/prog_tests/snprintf.c
+++ b/tools/testing/selftests/bpf/prog_tests/snprintf.c
@@ -1,6 +1,7 @@
// SPDX-License-Identifier: GPL-2.0
/* Copyright (c) 2021 Google LLC. */
+#include <sys/param.h>
#include <test_progs.h>
#include "test_snprintf.skel.h"
#include "test_snprintf_single.skel.h"
@@ -83,8 +84,6 @@ static void test_snprintf_positive(void)
[...]
diff --git a/tools/testing/selftests/bpf/prog_tests/tc_redirect.c b/tools/testing/selftests/bpf/prog_tests/tc_redirect.c
index 7ad66a247c02..52f1b9139145 100644
--- a/tools/testing/selftests/bpf/prog_tests/tc_redirect.c
+++ b/tools/testing/selftests/bpf/prog_tests/tc_redirect.c
@@ -20,6 +20,7 @@
#include <stdbool.h>
#include <stdio.h>
#include <sys/stat.h>
+#include <sys/param.h>
#include <unistd.h>
#include "test_progs.h"
Just add the sys/param.h to the test_progs.h header in BPF selftests where we also pull
in other sys headers; then all the duplicate includes above are not needed.
Thanks,
Daniel