From 4268e95fb98182137d6acf5c0e3ecb606e52d267 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= Date: Thu, 19 Mar 2026 11:43:08 +0100 Subject: [PATCH] test-bpf-token: convert "intro" to a test MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This file was a bit strange… It was shoehorning a manual test into the intro block and not using the rest of the TEST machinery. Let's convert it into a normal executable with a run function as we do in other similar cases. --- src/test/test-bpf-token.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/test/test-bpf-token.c b/src/test/test-bpf-token.c index f0ba50e715..7e83a048e5 100644 --- a/src/test/test-bpf-token.c +++ b/src/test/test-bpf-token.c @@ -4,9 +4,10 @@ #include #include "fd-util.h" -#include "tests.h" +#include "main-func.h" +#include "tests.h" /* NOLINT(misc-include-cleaner): this is needed conditionally */ -static int intro(void) { +static int run(int argc, char *argv[]) { #if defined(LIBBPF_MAJOR_VERSION) && (LIBBPF_MAJOR_VERSION > 1 || (LIBBPF_MAJOR_VERSION == 1 && LIBBPF_MINOR_VERSION >= 5)) _cleanup_close_ int bpffs_fd = open("/sys/fs/bpf", O_RDONLY); if (bpffs_fd < 0) @@ -16,10 +17,11 @@ static int intro(void) { if (token_fd < 0) return log_error_errno(errno, "Failed to create bpf token: %m"); - return EXIT_SUCCESS; + log_info("Successfully created token fd."); + return 0; #else return log_tests_skipped("libbpf is older than v1.5"); #endif } -DEFINE_TEST_MAIN_WITH_INTRO(LOG_DEBUG, intro); +DEFINE_MAIN_FUNCTION_WITH_POSITIVE_FAILURE(run);