summaryrefslogtreecommitdiff
path: root/tools/testing/selftests/resctrl/resctrl_val.c
diff options
context:
space:
mode:
authorIlpo Järvinen <ilpo.jarvinen@linux.intel.com>2023-12-15 17:05:12 +0200
committerShuah Khan <skhan@linuxfoundation.org>2024-02-13 13:56:45 -0700
commitca1608875ae21bb40a7731b81bc0e2c95622d502 (patch)
tree9958d734cda96722d4750fd53656c877948e295a /tools/testing/selftests/resctrl/resctrl_val.c
parentc603ff5bb830b8c22dae56ca3ca5ceb5c103525b (diff)
selftests/resctrl: Pass write_schemata() resource instead of test name
write_schemata() takes the test name as an argument and determines the relevant resource based on the test name. Such mapping from name to resource does not really belong to resctrlfs.c that should provide only generic, test-independent functions. Pass the resource stored in the test information structure to write_schemata() instead of the test name. The new API is also more flexible as it enables to use write_schemata() for more than one resource within a test. While touching the sprintf(), move the unnecessary %c that is always '=' directly into the format string. Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> Reviewed-by: Reinette Chatre <reinette.chatre@intel.com> Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
Diffstat (limited to 'tools/testing/selftests/resctrl/resctrl_val.c')
-rw-r--r--tools/testing/selftests/resctrl/resctrl_val.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/tools/testing/selftests/resctrl/resctrl_val.c b/tools/testing/selftests/resctrl/resctrl_val.c
index 6d0a35e8bd02..16ad91ccbcd3 100644
--- a/tools/testing/selftests/resctrl/resctrl_val.c
+++ b/tools/testing/selftests/resctrl/resctrl_val.c
@@ -684,13 +684,16 @@ static void run_benchmark(int signum, siginfo_t *info, void *ucontext)
/*
* resctrl_val: execute benchmark and measure memory bandwidth on
* the benchmark
+ * @test: test information structure
* @uparams: user supplied parameters
* @benchmark_cmd: benchmark command and its arguments
* @param: parameters passed to resctrl_val()
*
* Return: 0 when the test was run, < 0 on error.
*/
-int resctrl_val(const struct user_params *uparams, const char * const *benchmark_cmd,
+int resctrl_val(const struct resctrl_test *test,
+ const struct user_params *uparams,
+ const char * const *benchmark_cmd,
struct resctrl_val_param *param)
{
char *resctrl_val = param->resctrl_val;
@@ -826,7 +829,7 @@ int resctrl_val(const struct user_params *uparams, const char * const *benchmark
/* Test runs until the callback setup() tells the test to stop. */
while (1) {
- ret = param->setup(uparams, param);
+ ret = param->setup(test, uparams, param);
if (ret == END_OF_TESTS) {
ret = 0;
break;