From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-lf1-f54.google.com (mail-lf1-f54.google.com [209.85.167.54]) (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 054A646AF10 for ; Thu, 30 Apr 2026 16:02:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.54 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777564962; cv=none; b=H9AVOTyPIBHM54dUd0c5pnz4xfhGYT1tA2HTr/Nn0DCWcTUVP9arBNCPO+AMHrXGJitPt2oKQVkIV/HdHte1j4G6K9vBwvYvAt0ecu2bNwSdppUuOCZRfOE2gJbopvyfAjcI21cfkPssP57gFsXBR8a62GiUgfJ9PbhW99SVs/A= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777564962; c=relaxed/simple; bh=M6OJfT3qSdP4lnrHz8anqee8kUQRnD0Hidbc1/0+8Oc=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=JVET8Dn5jsbC99jjMylnzSnOZ3/upIn4jtdxxQgWcel4TDjmKdIIKrkF2IzLBexx2XpYeNmNT+VPLh0cgbFnaagvwbd7H2/OEsYNkzmIqwZh/mzQ3N5TGAqkYfaDew+LPAhkUbn+K5TrXYSoGcwuOnYpNQfWeQKg3YTkwcM2b5c= 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=RSsqUG7k; arc=none smtp.client-ip=209.85.167.54 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="RSsqUG7k" Received: by mail-lf1-f54.google.com with SMTP id 2adb3069b0e04-5a2c500750dso1938214e87.1 for ; Thu, 30 Apr 2026 09:02:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1777564958; x=1778169758; 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=RSsqUG7k7DDurLZXIQdSj4pL8BVMOGaRjGKW75jzOAtv/cJ6ElTGVM5IKIV7Zj+Dg4 WaZ1CP1SjjA1syHxufbAB2zev8zYRrIkdatpo0d0cQziDqf5vXX1omLH5c6q3p7Rvq0r s9CVzBHGkhEsLvK88oqNMDJhprNmwdYyHqk/t9QrJ1kaS+cHcAFeIlh2OR8JCkQ1jP9Y s2NTMcg9IZJI2NJ4z3h8MFYwJsHRnT2ZaTIQyP9PjiKoPRGTYL0wAY9R2WdDAI9sGL66 ialwfyFOEXfhTSXXTpIJ3qcOagmq55BbxLKvEsjE1D/QgnqfPqpnJwV2hVaR7Aw/+0W0 t0pw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1777564958; x=1778169758; 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=bd4ZKZjrLmSFVEytJ/NpAI77osJR43SOMaXhSNLg9IHFj86TK5ZkTB34R2QMiXLlFl jmVCz9qz2Tbg8Jbez5wvWgBG3YvE+70wxpKIdQPfpprQaQWFZ0KjFUrZN9EmkeG/+QMq 4x/oB+o8jQ0sLMD79f0fJJvnNXoIooXbrjEKUNOoT9YDv2NRVOyOaB0bynOwrS1bc+KJ VaQ6q3xq6FTaxT3u6jOTMQ4sqX/FuIXU5e2H7IYDO40hl2/342/GyL/BKEQTqfNGrKpG gBH5lmmF6bWXOaO55XvOobQOp6xq1HP2mFtNebjuYXMJ4rjvBE5nrcAmQZ+ysrYVPVvj cyJQ== X-Forwarded-Encrypted: i=1; AFNElJ/hAaYv8gtOfNskPVu/cEJarFYFvJTfcv1vXawVcIrz7s3wrzOSRBuUMybPY03Riw6tyzu6hZZYSLZbmtqsSJQ=@vger.kernel.org X-Gm-Message-State: AOJu0Yxcy9/gtB4xKMPtSKx7MOduPN+wjP+Pw7XEgsKdtU1q08W8tP/G DZDYofXYJcl6G4Sh9v6qARXsVBgzLm0rQ3Pe71tzh3VOW5Lw9x4gXwFjFbx5kQKrvuU= X-Gm-Gg: AeBDieu74VMaJQsfPBgJ+bsWu/FcR99WfwKfoJX88L/6PAsw2pzItdTduUDZ05cMUPB X00iw2aSPhIKZ3Y4xPzdNdyVLmTgPgJ0n3+Do1aYnY0jEIbIqmrWEIpEEASZUolxIVbFKYZJ7cQ u6f05+ni0StJphJ5PdJaKkFhhTaAifZd/JmXtdpAP5L9KcBe6ARP2fEnVjZKMnPrEOmAhibR4mQ 4Wtnz4gSJJehoB0yJaHnbU8ARi95jvwG8708xOc/M+FIplsI02lXsCxuQ1XdOqG2+oZmTLe2EFu 5dN6Ek0WWJOYaCgudBL8AesrtHymMF8jMK9cgjbFLe9ZRZXpUjSsFmfZ7U89UXrPnLBj2oayjZc v+vQD0PlYPQCnNCOOU0o5S8mengxqvZOUHJjgDSy6Wz3PleP+YX4OlNm0STNb5IAs45WBUQzrQ3 4uQ35zpnqGy2gzbB/O4orroNZl X-Received: by 2002:ac2:4944:0:b0:5a4:10b5:624e with SMTP id 2adb3069b0e04-5a8522d5a3fmr979564e87.24.1777564958059; Thu, 30 Apr 2026 09:02:38 -0700 (PDT) Received: from localhost ([2804:7f0:b765:105d:ce28:aaff:fe86:149c]) by smtp.gmail.com with ESMTPSA id 956f58d0204a3-65bff50386dsm2804916d50.8.2026.04.30.09.02.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 Apr 2026 09:02:36 -0700 (PDT) From: =?utf-8?q?Ricardo_B=2E_Marli=C3=A8re?= Date: Thu, 30 Apr 2026 13:02:08 -0300 Subject: [PATCH bpf-next v11 07/11] selftests/bpf: Skip tests whose objects were not built Precedence: bulk X-Mailing-List: linux-kselftest@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-v11-7-e11f7a8c4fdc@suse.com> References: <20260430-selftests-bpf_misconfig-v11-0-e11f7a8c4fdc@suse.com> In-Reply-To: <20260430-selftests-bpf_misconfig-v11-0-e11f7a8c4fdc@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=1777564926; l=5462; i=rbm@suse.com; h=from:subject:message-id; bh=M6OJfT3qSdP4lnrHz8anqee8kUQRnD0Hidbc1/0+8Oc=; b=U1NIU0lHAAAAAQAAADMAAAALc3NoLWVkMjU1MTkAAAAgguRCc5X8/UX9M40lkMnr//aFGOhce x5ezt8MFNUFlqYAAAAGcGF0YXR0AAAAAAAAAAZzaGE1MTIAAABTAAAAC3NzaC1lZDI1NTE5AAAA QJX8IYTTtAYURZkOuGNWx8NLc77j4itn8M4PvRoLfQpW0hqd5Do8v/NGZr/33JxgmELv88ZXXFq WA50O2q4viwQ= 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