The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Chen Yu <yu.c.chen@intel.com>
To: ilpo.jarvinen@linux.intel.com, reinette.chatre@intel.com
Cc: linux-kernel@vger.kernel.org, shuah@kernel.org,
	linux-kselftest@vger.kernel.org, fenghua.yu@intel.com,
	Chen Yu <yu.c.chen@intel.com>
Subject: Re: [PATCH RFC v1 0/2] kselftest/resctrl: CAT functional tests
Date: Wed, 27 May 2026 16:04:36 +0800	[thread overview]
Message-ID: <20260527080000.1234-1-yu.c.chen@intel.com> (raw)
In-Reply-To: <20250616082453.3725-1-ilpo.jarvinen@linux.intel.com>

Hi Reinette, Ilpo,

On Fri, Jun 27, 2025, Reinette Chatre wrote:
> I agree that the test self will know best what went wrong. Tests can still
> use ksft_print_msg() for informational text.
>
> Doing something like:
>
> 	cat_ctrlgrp_msr_test() {
> 		...
> 		if (!msr_access_supported(uparams->cpu)) {
> 			ksft_print_msg("MSR access not supported\n");
> 			return KSFT_SKIP;
> 		...
> 	}
>
>
> 	run_single_test() {
> 		...
> 		ret = test->run_test(test, uparams);
> 		ksft_test_result_report(ret, "%s: test\n", test->name);
> 		...
> 	}
>
> Can result in output like:
> # MSR access not supported
> ok X SKIP CAT_GROUP_MASK: test
>
> As I understand this will keep accurate test counts and the user output
> seems intuitive enough to understand why a test may have been skipped.

I suppose what you are suggesting is like below. I did a test with this
adjustment applied on top of this patch set, and it works for me:

[root@dmr-301 chenyu]# ./resctrl_tests -t CAT_GROUP_TASKS
TAP version 13
# Pass: Check kernel supports resctrl filesystem
# Pass: Check resctrl mountpoint "/sys/fs/resctrl" exists
# resctrl filesystem not mounted
# dmesg: [   43.705792] resctrl: L3 allocation detected
# dmesg: [   43.712878] resctrl: L2 allocation detected
# dmesg: [   43.719856] resctrl: MB allocation detected
# dmesg: [   43.726800] resctrl: L3 monitoring detected
1..1
# Starting CAT_GROUP_TASKS test ...
# Mounting resctrl to "/sys/fs/resctrl"
# Writing benchmark parameters to resctrl FS
# Writing benchmark parameters to resctrl FS
ok 1 CAT_GROUP_TASKS: test
# Totals: pass:1 fail:0 xfail:0 xpass:0 skip:0 error:0

[root@dmr-301 chenyu]# ./resctrl_tests -t CAT_GROUP_MASK
TAP version 13
# Pass: Check kernel supports resctrl filesystem
# Pass: Check resctrl mountpoint "/sys/fs/resctrl" exists
# resctrl filesystem not mounted
# dmesg: [   43.705792] resctrl: L3 allocation detected
# dmesg: [   43.712878] resctrl: L2 allocation detected
# dmesg: [   43.719856] resctrl: MB allocation detected
# dmesg: [   43.726800] resctrl: L3 monitoring detected
1..1
# Starting CAT_GROUP_MASK test ...
# Mounting resctrl to "/sys/fs/resctrl"
# Placing task to ctrlgrp 'c1'
# Writing benchmark parameters to resctrl FS
# Write schema "L3:0=3" to resctrl FS
# Placing task to ctrlgrp 'c2'
# Writing benchmark parameters to resctrl FS
# Write schema "L3:0=6" to resctrl FS
# Adjusting CBM for unrelated ctrlgrp 'c1'
# Write schema "L3:0=c" to resctrl FS
# Adjusting CBM for ctrlgrp 'c2'
# Write schema "L3:0=3" to resctrl FS
# Placing task to ctrlgrp 'c1'
# Writing benchmark parameters to resctrl FS
ok 1 CAT_GROUP_MASK: test
# Totals: pass:1 fail:0 xfail:0 xpass:0 skip:0 error:0

---
diff --git a/tools/testing/selftests/resctrl/cat_test.c b/tools/testing/selftests/resctrl/cat_test.c
index 76791312da76..5718ecf3b35d 100644
--- a/tools/testing/selftests/resctrl/cat_test.c
+++ b/tools/testing/selftests/resctrl/cat_test.c
@@ -399,7 +399,7 @@ static int cat_ctrlgrp_tasks_test(const struct resctrl_test *test,
 		return ret;
 	if (!ret) {
 		ksft_print_msg("PID not found in the root group\n");
-		return 1;
+		return KSFT_FAIL;
 	}
 
 	/* Taskset benchmark to specified CPU */
@@ -411,7 +411,7 @@ static int cat_ctrlgrp_tasks_test(const struct resctrl_test *test,
 		goto reset_affinity;
 	if (!ret) {
 		ksft_print_msg("PID not found in the root group\n");
-		ret = 1;
+		ret = KSFT_FAIL;
 		goto reset_affinity;
 	}
 
@@ -423,7 +423,7 @@ static int cat_ctrlgrp_tasks_test(const struct resctrl_test *test,
 		goto reset_affinity;
 	if (!ret) {
 		ksft_print_msg("PID not found in the control group\n");
-		ret = 1;
+		ret = KSFT_FAIL;
 		goto reset_affinity;
 	}
 	ret = resctrl_grp_has_task(NULL, bm_pid);
@@ -431,7 +431,7 @@ static int cat_ctrlgrp_tasks_test(const struct resctrl_test *test,
 		goto reset_affinity;
 	if (ret) {
 		ksft_print_msg("PID duplicate remains in the root group\n");
-		ret = 1;
+		ret = KSFT_FAIL;
 		goto reset_affinity;
 	}
 
@@ -443,7 +443,7 @@ static int cat_ctrlgrp_tasks_test(const struct resctrl_test *test,
 		goto reset_affinity;
 	if (!ret) {
 		ksft_print_msg("PID not found in the new control group\n");
-		ret = 1;
+		ret = KSFT_FAIL;
 		goto reset_affinity;
 	}
 	ret = resctrl_grp_has_task("c1", bm_pid);
@@ -451,7 +451,7 @@ static int cat_ctrlgrp_tasks_test(const struct resctrl_test *test,
 		goto reset_affinity;
 	if (ret) {
 		ksft_print_msg("PID duplicate remains in the old control group\n");
-		ret = 1;
+		ret = KSFT_FAIL;
 		goto reset_affinity;
 	}
 
@@ -499,8 +499,8 @@ static int cat_ctrlgrp_msr_test(const struct resctrl_test *test,
 	bm_pid = getpid();
 
 	if (!msr_access_supported(uparams->cpu)) {
-		ksft_test_result_skip("Cannot access MSRs\n");
-		return 0;
+		ksft_print_msg("MSR access not supported\n");
+		return KSFT_SKIP;
 	}
 
 	ret = resctrl_grp_has_task(NULL, bm_pid);
@@ -508,7 +508,7 @@ static int cat_ctrlgrp_msr_test(const struct resctrl_test *test,
 		return ret;
 	if (!ret) {
 		ksft_print_msg("PID not found in the root group\n");
-		return 1;
+		return KSFT_FAIL;
 	}
 
 	/* Taskset benchmark to specified CPU */
diff --git a/tools/testing/selftests/resctrl/resctrl_tests.c b/tools/testing/selftests/resctrl/resctrl_tests.c
index a0390f045646..6989e1422588 100644
--- a/tools/testing/selftests/resctrl/resctrl_tests.c
+++ b/tools/testing/selftests/resctrl/resctrl_tests.c
@@ -163,7 +163,7 @@ static void run_single_test(const struct resctrl_test *test, const struct user_p
 	}
 
 	ret = test->run_test(test, uparams);
-	ksft_test_result(!ret, "%s: test\n", test->name);
+	ksft_test_result_report(ret, "%s: test\n", test->name);
 
 cleanup:
 	test_cleanup(test);

      parent reply	other threads:[~2026-05-27  8:13 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-16  8:24 [RFC PATCH v1 0/2] kselftest/resctrl: CAT functional tests Ilpo Järvinen
2025-06-16  8:24 ` [RFC PATCH v1 1/2] kselftest/resctrl: L3 CAT resctrl FS " Ilpo Järvinen
2025-06-16  8:24 ` [RFC PATCH v1 2/2] kselftest/resctrl: Add L3 CAT CBM functional test for Intel RDT Ilpo Järvinen
2025-06-27 18:04 ` [RFC PATCH v1 0/2] kselftest/resctrl: CAT functional tests Reinette Chatre
2025-07-03  9:27   ` Ilpo Järvinen
2025-07-03 15:42     ` Reinette Chatre
2026-05-27  8:04 ` Chen Yu [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260527080000.1234-1-yu.c.chen@intel.com \
    --to=yu.c.chen@intel.com \
    --cc=fenghua.yu@intel.com \
    --cc=ilpo.jarvinen@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=reinette.chatre@intel.com \
    --cc=shuah@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox