From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mta1.migadu.com (out-149.mta1.migadu.com [95.215.58.149]) (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 380B642049E for ; Mon, 12 Oct 2026 14:02:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=95.215.58.149 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1791813763; cv=none; b=rXdYfRdURmrPY+9l8xgjvvbEsCintv1pMU8054UVk4ZSq3Usk1HsdZmbjb7LUVYtY6+G7+/oD9DaT0rBx/+HF3O9Q7ScA6BQb/7xSXuEnKM7aM+mNzSQXoeOJp17LL/lBBAElc5wCVU2zEV9TRsBJr8pmeesmHDIEcFEl3xF6WA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1791813763; c=relaxed/simple; bh=rOBeC0UygHARM0kn1ptuUKSyyn7TzM9JJoJzZ49+TdA=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=K2kkd6pAi/3wI9gGA6OCZ3RrMPuG75kU3nzlgI3Jj2QwgO+nGcYyQGOjHzfvZFl/YKJKfkRt9iExVdP7ZqnZplicl9gKiWYlZ0hVRgkJLItbu9IWQri5MGN72863ukeVUsHe4DtVcAKBWT7fjH6TOUDgBngL1Bs1cDk9ZarRCG8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=hVuoTGEr; arc=none smtp.client-ip=95.215.58.149 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="hVuoTGEr" X-Envelope-To: linux-kernel@vger.kernel.org DKIM-Signature: a=rsa-sha256; bh=rOBeC0UygHARM0kn1ptuUKSyyn7TzM9JJoJzZ49+TdA=; c=simple/simple; d=linux.dev; h=from:to:subject:date:message-id:mime-version:content-type; s=key1; t=1791813760; v=1; x=1792418560; b=hVuoTGErps+6UbjoIybOLFj0qJS8n7wjEHTpbQWyZZ1tWdn9LdnTbcpFMJBEl9UqIS0buKxX 0HaaU1gG2clAtEqdfzVfxrjkYx35h5ICXjw0GqbLjgT7GKdY9p0QOCW74IciA7qN1z9Mzz45tjc cMyglz6kKtFohiVWGE5KKAaY= X-Envelope-To: linux-kernel@vger.kernel.org Received: by mta10.migadu.com with ESMTPS id 3f5002008a70a5e4; Mon, 12 Oct 2026 14:02:39 +0000 X-Mizu-Trace-ID: 3f5002008a70a5e4 X-Migadu-Flow: FLOW_OUT From: KaFai Wan To: Andrii Nakryiko , Eduard Zingerman , Ihor Solodrai , Alexei Starovoitov , Daniel Borkmann , Kumar Kartikeya Dwivedi , Martin KaFai Lau , Song Liu , Yonghong Song , Jiri Olsa , Emil Tsalapatis , Shuah Khan , KaFai Wan , Mykola Lysenko , bpf@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH bpf-next 1/3] selftests/bpf: Fix prog_tests framework subtest count checks Date: Mon, 12 Oct 2026 22:01:59 +0800 Message-ID: <20261012140202.2754552-2-kafai.wan@linux.dev> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20261012140202.2754552-1-kafai.wan@linux.dev> References: <20261012140202.2754552-1-kafai.wan@linux.dev> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit The hardcoded expected skip_cnt/error_cnt in test_prog_tests_framework() mismatch the real count when the binary is run with -t or -n filters, since some subtests are not selected. Count the executed subtests and compare against that value instead. Fixes: 2324257dbd68 ("selftests/bpf: Refactor prog_tests logging and test execution") Signed-off-by: KaFai Wan --- .../selftests/bpf/prog_tests/prog_tests_framework.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/tools/testing/selftests/bpf/prog_tests/prog_tests_framework.c b/tools/testing/selftests/bpf/prog_tests/prog_tests_framework.c index d111fe105447..53347f379924 100644 --- a/tools/testing/selftests/bpf/prog_tests/prog_tests_framework.c +++ b/tools/testing/selftests/bpf/prog_tests/prog_tests_framework.c @@ -13,6 +13,7 @@ static void clear_test_state(struct test_state *state) void test_prog_tests_framework(void) { struct test_state *state = env.test_state; + int subtest_cnt; /* in all the ASSERT calls below we need to return on the first * error due to the fact that we are cleaning the test state after @@ -30,25 +31,30 @@ void test_prog_tests_framework(void) return; clear_test_state(state); + subtest_cnt = 0; if (test__start_subtest("test_skip_subtest")) { test__skip(); test__end_subtest(); + subtest_cnt++; } if (test__start_subtest("test_skip_subtest")) { test__skip(); test__end_subtest(); + subtest_cnt++; } - if (!ASSERT_EQ(state->skip_cnt, 2, "skip_cnt_check")) + if (!ASSERT_EQ(state->skip_cnt, subtest_cnt, "skip_cnt_check")) return; if (!ASSERT_EQ(state->subtest_num, 3, "subtest_num_check")) return; clear_test_state(state); + subtest_cnt = 0; if (test__start_subtest("test_fail_subtest")) { test__fail(); test__end_subtest(); + subtest_cnt++; } - if (!ASSERT_EQ(state->error_cnt, 1, "error_cnt_check")) + if (!ASSERT_EQ(state->error_cnt, subtest_cnt, "error_cnt_check")) return; if (!ASSERT_EQ(state->subtest_num, 4, "subtest_num_check")) return; -- 2.43.0