summaryrefslogtreecommitdiff
path: root/tools/testing/selftests/resctrl/resctrl_tests.c
diff options
context:
space:
mode:
authorIlpo Järvinen <ilpo.jarvinen@linux.intel.com>2023-07-17 16:15:03 +0300
committerShuah Khan <skhan@linuxfoundation.org>2023-07-25 17:53:48 +0300
commit7f3c980c7738d0624077f926216bc7ac4cefcf60 (patch)
tree6f625181b361cbae358a15ef1cc3dc506f3c0a1d /tools/testing/selftests/resctrl/resctrl_tests.c
parentf4123975cf341fd12121e1631c4b172a190f48d4 (diff)
downloadlinux-7f3c980c7738d0624077f926216bc7ac4cefcf60.tar.xz
selftests/resctrl: Don't pass test name to fill_buf
Test name is passed to fill_buf functions so that they can loop around buffer only once. This is required for CAT test case. To loop around buffer only once, caller doesn't need to let fill_buf know which test case it is. Instead, pass a boolean argument 'once' which makes fill_buf more generic. As run_benchmark() no longer needs to pass the test name to run_fill_buf(), a few test running functions can be simplified to not write the test name into the default benchmark_cmd. The has_ben argument can also be removed now from those test running functions. Co-developed-by: Fenghua Yu <fenghua.yu@intel.com> Signed-off-by: Fenghua Yu <fenghua.yu@intel.com> Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> Reviewed-by: Reinette Chatre <reinette.chatre@intel.com> Tested-by: Babu Moger <babu.moger@amd.com> Tested-by: Shaopeng Tan (Fujitsu) <tan.shaopeng@fujitsu.com> Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
Diffstat (limited to 'tools/testing/selftests/resctrl/resctrl_tests.c')
-rw-r--r--tools/testing/selftests/resctrl/resctrl_tests.c14
1 files changed, 5 insertions, 9 deletions
diff --git a/tools/testing/selftests/resctrl/resctrl_tests.c b/tools/testing/selftests/resctrl/resctrl_tests.c
index 125ed0ca11e3..d511daeb6851 100644
--- a/tools/testing/selftests/resctrl/resctrl_tests.c
+++ b/tools/testing/selftests/resctrl/resctrl_tests.c
@@ -70,7 +70,7 @@ void tests_cleanup(void)
cat_test_cleanup();
}
-static void run_mbm_test(bool has_ben, char **benchmark_cmd, size_t span,
+static void run_mbm_test(char **benchmark_cmd, size_t span,
int cpu_no, char *bw_report)
{
int res;
@@ -88,8 +88,6 @@ static void run_mbm_test(bool has_ben, char **benchmark_cmd, size_t span,
goto umount;
}
- if (!has_ben)
- sprintf(benchmark_cmd[4], "%s", MBA_STR);
res = mbm_bw_change(span, cpu_no, bw_report, benchmark_cmd);
ksft_test_result(!res, "MBM: bw change\n");
if ((get_vendor() == ARCH_INTEL) && res)
@@ -123,7 +121,7 @@ umount:
umount_resctrlfs();
}
-static void run_cmt_test(bool has_ben, char **benchmark_cmd, int cpu_no)
+static void run_cmt_test(char **benchmark_cmd, int cpu_no)
{
int res;
@@ -140,8 +138,6 @@ static void run_cmt_test(bool has_ben, char **benchmark_cmd, int cpu_no)
goto umount;
}
- if (!has_ben)
- sprintf(benchmark_cmd[4], "%s", CMT_STR);
res = cmt_resctrl_val(cpu_no, 5, benchmark_cmd);
ksft_test_result(!res, "CMT: test\n");
if ((get_vendor() == ARCH_INTEL) && res)
@@ -274,7 +270,7 @@ int main(int argc, char **argv)
sprintf(benchmark_cmd[1], "%zu", span);
strcpy(benchmark_cmd[2], "1");
strcpy(benchmark_cmd[3], "0");
- strcpy(benchmark_cmd[4], "");
+ strcpy(benchmark_cmd[4], "false");
benchmark_cmd[5] = NULL;
}
@@ -292,13 +288,13 @@ int main(int argc, char **argv)
ksft_set_plan(tests ? : 4);
if (mbm_test)
- run_mbm_test(has_ben, benchmark_cmd, span, cpu_no, bw_report);
+ run_mbm_test(benchmark_cmd, span, cpu_no, bw_report);
if (mba_test)
run_mba_test(benchmark_cmd, cpu_no, bw_report);
if (cmt_test)
- run_cmt_test(has_ben, benchmark_cmd, cpu_no);
+ run_cmt_test(benchmark_cmd, cpu_no);
if (cat_test)
run_cat_test(cpu_no, no_of_bits);