aboutsummaryrefslogtreecommitdiff
path: root/tools/testing/selftests/resctrl/resctrlfs.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 08:53:48 -0600
commit7f3c980c7738d0624077f926216bc7ac4cefcf60 (patch)
tree6f625181b361cbae358a15ef1cc3dc506f3c0a1d /tools/testing/selftests/resctrl/resctrlfs.c
parentf4123975cf341fd12121e1631c4b172a190f48d4 (diff)
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/resctrlfs.c')
-rw-r--r--tools/testing/selftests/resctrl/resctrlfs.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/tools/testing/selftests/resctrl/resctrlfs.c b/tools/testing/selftests/resctrl/resctrlfs.c
index 8a66445079f8..bd36ee206602 100644
--- a/tools/testing/selftests/resctrl/resctrlfs.c
+++ b/tools/testing/selftests/resctrl/resctrlfs.c
@@ -304,8 +304,8 @@ void run_benchmark(int signum, siginfo_t *info, void *ucontext)
{
int operation, ret, memflush;
char **benchmark_cmd;
- char resctrl_val[64];
size_t span;
+ bool once;
FILE *fp;
benchmark_cmd = info->si_ptr;
@@ -323,9 +323,14 @@ void run_benchmark(int signum, siginfo_t *info, void *ucontext)
span = strtoul(benchmark_cmd[1], NULL, 10);
memflush = atoi(benchmark_cmd[2]);
operation = atoi(benchmark_cmd[3]);
- sprintf(resctrl_val, "%s", benchmark_cmd[4]);
+ if (!strcmp(benchmark_cmd[4], "true"))
+ once = true;
+ else if (!strcmp(benchmark_cmd[4], "false"))
+ once = false;
+ else
+ PARENT_EXIT("Invalid once parameter");
- if (run_fill_buf(span, memflush, operation, resctrl_val))
+ if (run_fill_buf(span, memflush, operation, once))
fprintf(stderr, "Error in running fill buffer\n");
} else {
/* Execute specified benchmark */