From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wm1-f42.google.com (mail-wm1-f42.google.com [209.85.128.42]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7FDD340F8E0 for ; Thu, 30 Apr 2026 12:53:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.42 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777553630; cv=none; b=ulFpFNU9nBVFYCwXt15zV0rLS/KX7YkeCq7iO/BKxJnTYJzh9zUUlkjyasIhMayAWZjsLJfbVysVrM4dUxKBuR1shkXo8/xY0q/IaaIDsIMx8bH9F8ghPMeGJji5dhFYy+kAnVetfzg02vgm2hB1ZWGwg0wSaNONZX9p7IKUtr0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777553630; c=relaxed/simple; bh=M6OJfT3qSdP4lnrHz8anqee8kUQRnD0Hidbc1/0+8Oc=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=YfGWQliA4fjVcmoW075SUcUCE5FiGJS7+uoTB82bP68OOn/t2pcj+ZFmsSn1Tf+DTv4Xosnx0P0jRcYAx4RtgKbe1XzN08QdgocvvgSdTpeWd3uBr9naJwZfmXK1Ad/qnx2XLmvVYFV9gHT1cSxXO9DyXrI5XKJMY/JZZy2eVh0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com; spf=pass smtp.mailfrom=suse.com; dkim=pass (2048-bit key) header.d=suse.com header.i=@suse.com header.b=V/wNilpH; arc=none smtp.client-ip=209.85.128.42 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=suse.com header.i=@suse.com header.b="V/wNilpH" Received: by mail-wm1-f42.google.com with SMTP id 5b1f17b1804b1-488b0046078so7887175e9.1 for ; Thu, 30 Apr 2026 05:53:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1777553627; x=1778158427; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=gvXdowVtyuI/sQdPSdYXchM5M1PBQ4p+rahyvFeZ5AI=; b=V/wNilpHOG1q1hHDiUCLUFQaHQsmF8VfP3t7OPrtrr4EhiIlK5McSnXdmW6zTAYA2F 5e7vloE3EH0ms7QXH6NGnsdYfOaKCQdaj4PC9MK640le5DwIlm9mIrKtih/I3gZNzvQT VG8Qz0fCg6ug8ZREZwXeKti6Bkwch2OBn6TnFnLNfYwcMMrEqrHEqJWWc4vx0krZzdLn LCYfr9w5+jtORJptHHO+bH05f4JKrrpS7oa0cl9PM0jEGKJIY49szidL6l3uqNixAIXb AWiPY2bPM8YH7u8qHqtR+Q2p+hDKFeiT30IahdthoPDLD/43pE8FWY9CW/+Wqsq2PMF4 pWLA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1777553627; x=1778158427; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=gvXdowVtyuI/sQdPSdYXchM5M1PBQ4p+rahyvFeZ5AI=; b=e5iVrJri1PiJzYNqt81XV1VxBXe/W1s/wD4r/huzI+U1V8TZh56n8EKoK9ENlDeEot L+xoN9yHjMdgDrKG3z8hDLz41JZ/sBgH0KSfIRFeZ0LgFQ1yYDxD5yha0q4/R2JCkvLo W69oJWShYehUfKrTt9F2GwCp/ST14dB8I8rOa3fZ3bqgqhWCjyzSsTzgXlF2hNH3lP32 kfOF5i7lCYh829JVtBOk2OgcIf45DubmiyloP0zzTq0FXEGeb+7274VGJT/zH78zGILU tvQUeS6cazj+5w0uWJ5KEWt868fiRMCBKrs4ik2L2KFUlfeW+HDuDXE2MaMeCX6WIUoY bX2A== X-Forwarded-Encrypted: i=1; AFNElJ8LbqztpiWWsogP19snH8YsA3P4AsgITOG3neHFvwycY1nqnlSgc1IqdkupUmOFP7cU49pmP4ZDLoxJz6I=@vger.kernel.org X-Gm-Message-State: AOJu0Yyd+t3pqgDp+jzeaSwBpaEXUBYVUmKQeZkppOz+m8p/nQAQkopw 0nC4ln2pAGHbSR0mnMmK/k8MzBbo0w5eXy41pt2KdsuEpz4J0pXKnIBw+IwhqP8Omwye0AtejuH nj5cjVes= X-Gm-Gg: AeBDieuBI/ZWwCRm88hoC1t4ZfweNpiJg/C1XcyAUAG8rSsq+GMmyVQ+XHy0cbzNHw0 xPpIs2FcXorG85VPbs5xXOUDBBxbcBVaFQjrodhlP0m/Nr8PXH27Qok6UR12mhlGf2pfrGd/gGU gYAHXeqaoMfhJocwmZfG1fCvihxYMzna1bjroymC3hh0a0dFcS2xdxDBAHuHT8QKHiZDRjYC0HN vWpzEFoEjlrfQi23b0mDncbb1iWdwl/BH3PtJbwmTwWiMk8JFve/mGP5G/88BcpvtoE+baZ1T2R 3YBJeTFs94K8gDaumD/n0A+0dCQBYvRPJciNXBNcZJXjgHbiTinkzYrBQUkISICU8k6QMjeX9BD MkZBnoO8o4GJx8nLILGqj5Intw7kuRNFB1AJq+91YITAkFHjq0UhBrR1hZxZF7PNkQwutpduINM nPFuWL3H1MGVTjouNSEXY5aykYMehGi16RfsY= X-Received: by 2002:a05:600c:8599:b0:48a:568f:ae8a with SMTP id 5b1f17b1804b1-48a83d6c22fmr32217545e9.8.1777553626647; Thu, 30 Apr 2026 05:53:46 -0700 (PDT) Received: from localhost ([2804:7f0:b765:105d:ce28:aaff:fe86:149c]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-2ed1c0d218dsm6471548eec.27.2026.04.30.05.53.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 Apr 2026 05:53:45 -0700 (PDT) From: =?utf-8?q?Ricardo_B=2E_Marli=C3=A8re?= Date: Thu, 30 Apr 2026 09:53:19 -0300 Subject: [PATCH bpf-next v10 07/11] selftests/bpf: Skip tests whose objects were not built Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Message-Id: <20260430-selftests-bpf_misconfig-v10-7-cd302a31af16@suse.com> References: <20260430-selftests-bpf_misconfig-v10-0-cd302a31af16@suse.com> In-Reply-To: <20260430-selftests-bpf_misconfig-v10-0-cd302a31af16@suse.com> To: Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , Martin KaFai Lau , Eduard Zingerman , Kumar Kartikeya Dwivedi , Song Liu , Yonghong Song , Jiri Olsa , Shuah Khan , Nathan Chancellor , Nick Desaulniers , Bill Wendling , Justin Stitt Cc: bpf@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, llvm@lists.linux.dev, Alan Maguire , "Ricardo B. Marliere" X-Mailer: b4 0.15.2 X-Developer-Signature: v=1; a=openssh-sha256; t=1777553600; l=5462; i=rbm@suse.com; h=from:subject:message-id; bh=M6OJfT3qSdP4lnrHz8anqee8kUQRnD0Hidbc1/0+8Oc=; b=U1NIU0lHAAAAAQAAADMAAAALc3NoLWVkMjU1MTkAAAAgguRCc5X8/UX9M40lkMnr//aFGOhce x5ezt8MFNUFlqYAAAAGcGF0YXR0AAAAAAAAAAZzaGE1MTIAAABTAAAAC3NzaC1lZDI1NTE5AAAA QGz2iruQMv6+o+BVxXCvB3+eBI2v3HqK1g48+kye0ghRxPevrCXc9vl9d/bJxc5aHx8zxs3YUZl vAE7cDpHc+Qk= X-Developer-Key: i=rbm@suse.com; a=openssh; fpr=SHA256:pzhe0fJpYLz+3cZ33FFPhIfaUElk9CXPFFXmalIH+1g When both run_test and run_serial_test are NULL (because the corresponding .test.o was not compiled), mark the test as not built instead of fatally aborting. Report these tests as "SKIP (not built)" in per-test output and include them in the skip count so they remain visible in CI results and JSON output. The summary line shows the not-built count when nonzero: Summary: 50/55 PASSED, 5 SKIPPED (3 not built), 0 FAILED Tests filtered out by -t/-n remain invisible as before; only genuinely unbuilt tests are surfaced. Signed-off-by: Ricardo B. Marlière --- tools/testing/selftests/bpf/test_progs.c | 53 +++++++++++++++++++++++++++----- tools/testing/selftests/bpf/test_progs.h | 1 + 2 files changed, 46 insertions(+), 8 deletions(-) diff --git a/tools/testing/selftests/bpf/test_progs.c b/tools/testing/selftests/bpf/test_progs.c index cc14b13e23fe..7ba82974ee78 100644 --- a/tools/testing/selftests/bpf/test_progs.c +++ b/tools/testing/selftests/bpf/test_progs.c @@ -165,6 +165,8 @@ struct prog_test_def { void (*run_test)(void); void (*run_serial_test)(void); bool should_run; + bool not_built; + bool selected; bool need_cgroup_cleanup; bool should_tmon; }; @@ -372,6 +374,8 @@ static void print_test_result(const struct prog_test_def *test, const struct tes fprintf(env.stdout_saved, "#%-*d %s:", TEST_NUM_WIDTH, test->test_num, test->test_name); if (test_state->error_cnt) fprintf(env.stdout_saved, "FAIL"); + else if (test->not_built) + fprintf(env.stdout_saved, "SKIP (not built)"); else if (!skipped_cnt) fprintf(env.stdout_saved, "OK"); else if (skipped_cnt == subtests_cnt || !subtests_cnt) @@ -1641,6 +1645,7 @@ static void calculate_summary_and_print_errors(struct test_env *env) json_writer_t *w = NULL; for (i = 0; i < prog_test_cnt; i++) { + struct prog_test_def *test = &prog_test_defs[i]; struct test_state *state = &test_states[i]; if (!state->tested) @@ -1651,7 +1656,7 @@ static void calculate_summary_and_print_errors(struct test_env *env) if (state->error_cnt) fail_cnt++; - else + else if (!test->not_built) succ_cnt++; } @@ -1700,8 +1705,13 @@ static void calculate_summary_and_print_errors(struct test_env *env) if (env->json) fclose(env->json); - printf("Summary: %d/%d PASSED, %d SKIPPED, %d FAILED\n", - succ_cnt, sub_succ_cnt, skip_cnt, fail_cnt); + if (env->not_built_cnt) + printf("Summary: %d/%d PASSED, %d SKIPPED (%d not built), %d FAILED\n", + succ_cnt, sub_succ_cnt, skip_cnt, env->not_built_cnt, + fail_cnt); + else + printf("Summary: %d/%d PASSED, %d SKIPPED, %d FAILED\n", + succ_cnt, sub_succ_cnt, skip_cnt, fail_cnt); env->succ_cnt = succ_cnt; env->sub_succ_cnt = sub_succ_cnt; @@ -1772,6 +1782,19 @@ static void server_main(void) run_one_test(i); } + /* mark not-built tests as skipped */ + for (int i = 0; i < prog_test_cnt; i++) { + struct prog_test_def *test = &prog_test_defs[i]; + struct test_state *state = &test_states[i]; + + if (test->not_built && test->selected) { + state->tested = true; + state->skip_cnt = 1; + env.not_built_cnt++; + print_test_result(test, state); + } + } + /* generate summary */ fflush(stderr); fflush(stdout); @@ -2046,15 +2069,20 @@ int main(int argc, char **argv) struct prog_test_def *test = &prog_test_defs[i]; test->test_num = i + 1; - test->should_run = should_run(&env.test_selector, - test->test_num, test->test_name); + test->selected = should_run(&env.test_selector, + test->test_num, test->test_name); + test->should_run = test->selected; - if ((test->run_test == NULL && test->run_serial_test == NULL) || - (test->run_test != NULL && test->run_serial_test != NULL)) { + if (test->run_test && test->run_serial_test) { fprintf(stderr, "Test %d:%s must have either test_%s() or serial_test_%sl() defined.\n", test->test_num, test->test_name, test->test_name, test->test_name); exit(EXIT_ERR_SETUP_INFRA); } + if (!test->run_test && !test->run_serial_test) { + test->not_built = true; + test->should_run = false; + continue; + } if (test->should_run) test->should_tmon = should_tmon(&env.tmon_selector, test->test_name); } @@ -2106,9 +2134,18 @@ int main(int argc, char **argv) for (i = 0; i < prog_test_cnt; i++) { struct prog_test_def *test = &prog_test_defs[i]; + struct test_state *state = &test_states[i]; - if (!test->should_run) + if (!test->should_run) { + if (test->not_built && test->selected && + !env.get_test_cnt && !env.list_test_names) { + state->tested = true; + state->skip_cnt = 1; + env.not_built_cnt++; + print_test_result(test, state); + } continue; + } if (env.get_test_cnt) { env.succ_cnt++; diff --git a/tools/testing/selftests/bpf/test_progs.h b/tools/testing/selftests/bpf/test_progs.h index 37955a8ad385..2cf950afcd85 100644 --- a/tools/testing/selftests/bpf/test_progs.h +++ b/tools/testing/selftests/bpf/test_progs.h @@ -125,6 +125,7 @@ struct test_env { int sub_succ_cnt; /* successful sub-tests */ int fail_cnt; /* total failed tests + sub-tests */ int skip_cnt; /* skipped tests */ + int not_built_cnt; /* tests not built */ int saved_netns_fd; int workers; /* number of worker process */ -- 2.54.0