[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20250528034712.138701-23-dongml2@chinatelecom.cn>
Date: Wed, 28 May 2025 11:47:09 +0800
From: Menglong Dong <menglong8.dong@...il.com>
To: alexei.starovoitov@...il.com,
rostedt@...dmis.org,
jolsa@...nel.org
Cc: bpf@...r.kernel.org,
Menglong Dong <dongml2@...natelecom.cn>,
linux-kernel@...r.kernel.org
Subject: [PATCH bpf-next 22/25] selftests/bpf: use the glob_match() from libbpf in test_progs.c
The glob_match() in test_progs.c has almost the same logic with the
glob_match() in libbpf.c, so we replace it to make the code simple.
Signed-off-by: Menglong Dong <dongml2@...natelecom.cn>
---
tools/testing/selftests/bpf/test_progs.c | 23 +----------------------
1 file changed, 1 insertion(+), 22 deletions(-)
diff --git a/tools/testing/selftests/bpf/test_progs.c b/tools/testing/selftests/bpf/test_progs.c
index 309d9d4a8ace..e246fe4b7b70 100644
--- a/tools/testing/selftests/bpf/test_progs.c
+++ b/tools/testing/selftests/bpf/test_progs.c
@@ -17,6 +17,7 @@
#include <sys/un.h>
#include <bpf/btf.h>
#include <time.h>
+#include "bpf/libbpf_internal.h"
#include "json_writer.h"
#include "network_helpers.h"
@@ -129,28 +130,6 @@ static int traffic_monitor_print_fn(const char *format, va_list args)
return 0;
}
-/* Adapted from perf/util/string.c */
-static bool glob_match(const char *str, const char *pat)
-{
- while (*str && *pat && *pat != '*') {
- if (*str != *pat)
- return false;
- str++;
- pat++;
- }
- /* Check wild card */
- if (*pat == '*') {
- while (*pat == '*')
- pat++;
- if (!*pat) /* Tail wild card matches all */
- return true;
- while (*str)
- if (glob_match(str++, pat))
- return true;
- }
- return !*str && !*pat;
-}
-
#define EXIT_NO_TEST 2
#define EXIT_ERR_SETUP_INFRA 3
--
2.39.5
Powered by blists - more mailing lists