Skip to content

Commit 5339792

Browse files
ij-intelshuahkh
authored andcommitted
selftests/resctrl: Add test groups and name L3 CAT test L3_CAT
To select test to run -t parameter can be used. However, -t cat currently maps to L3 CAT test which will be confusing after more CAT related tests will be added. Allow selecting tests as groups and call L3 CAT test "L3_CAT", "CAT" group will enable all CAT related tests. Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> Signed-off-by: Maciej Wieczor-Retman <maciej.wieczor-retman@intel.com> Reviewed-by: Reinette Chatre <reinette.chatre@intel.com> Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
1 parent 6f1a214 commit 5339792

File tree

3 files changed

+16
-6
lines changed

3 files changed

+16
-6
lines changed

tools/testing/selftests/resctrl/cat_test.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,8 @@ static int cat_run_test(const struct resctrl_test *test, const struct user_param
295295
}
296296

297297
struct resctrl_test l3_cat_test = {
298-
.name = "CAT",
298+
.name = "L3_CAT",
299+
.group = "CAT",
299300
.resource = "L3",
300301
.feature_check = test_resource_feature_check,
301302
.run_test = cat_run_test,

tools/testing/selftests/resctrl/resctrl.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,8 @@ struct user_params {
6565
/*
6666
* resctrl_test: resctrl test definition
6767
* @name: Test name
68+
* @group: Test group - a common name for tests that share some characteristic
69+
* (e.g., L3 CAT test belongs to the CAT group). Can be NULL
6870
* @resource: Resource to test (e.g., MB, L3, L2, etc.)
6971
* @vendor_specific: Bitmask for vendor-specific tests (can be 0 for universal tests)
7072
* @disabled: Test is disabled
@@ -73,6 +75,7 @@ struct user_params {
7375
*/
7476
struct resctrl_test {
7577
const char *name;
78+
const char *group;
7679
const char *resource;
7780
unsigned int vendor_specific;
7881
bool disabled;

tools/testing/selftests/resctrl/resctrl_tests.c

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -65,11 +65,15 @@ static void cmd_help(void)
6565
printf("usage: resctrl_tests [-h] [-t test list] [-n no_of_bits] [-b benchmark_cmd [option]...]\n");
6666
printf("\t-b benchmark_cmd [option]...: run specified benchmark for MBM, MBA and CMT\n");
6767
printf("\t default benchmark is builtin fill_buf\n");
68-
printf("\t-t test list: run tests specified in the test list, ");
68+
printf("\t-t test list: run tests/groups specified by the list, ");
6969
printf("e.g. -t mbm,mba,cmt,cat\n");
70-
printf("\t\tSupported tests:\n");
71-
for (i = 0; i < ARRAY_SIZE(resctrl_tests); i++)
72-
printf("\t\t\t%s\n", resctrl_tests[i]->name);
70+
printf("\t\tSupported tests (group):\n");
71+
for (i = 0; i < ARRAY_SIZE(resctrl_tests); i++) {
72+
if (resctrl_tests[i]->group)
73+
printf("\t\t\t%s (%s)\n", resctrl_tests[i]->name, resctrl_tests[i]->group);
74+
else
75+
printf("\t\t\t%s\n", resctrl_tests[i]->name);
76+
}
7377
printf("\t-n no_of_bits: run cache tests using specified no of bits in cache bit mask\n");
7478
printf("\t-p cpu_no: specify CPU number to run the test. 1 is default\n");
7579
printf("\t-h: help\n");
@@ -199,7 +203,9 @@ int main(int argc, char **argv)
199203
bool found = false;
200204

201205
for (i = 0; i < ARRAY_SIZE(resctrl_tests); i++) {
202-
if (!strcasecmp(token, resctrl_tests[i]->name)) {
206+
if (!strcasecmp(token, resctrl_tests[i]->name) ||
207+
(resctrl_tests[i]->group &&
208+
!strcasecmp(token, resctrl_tests[i]->group))) {
203209
if (resctrl_tests[i]->disabled)
204210
tests++;
205211
resctrl_tests[i]->disabled = false;

0 commit comments

Comments
 (0)