summaryrefslogtreecommitdiffstats
path: root/tools/testing/selftests/resctrl/resctrl_val.c
diff options
context:
space:
mode:
authorIlpo Järvinen <ilpo.jarvinen@linux.intel.com>2023-02-15 14:05:59 +0100
committerShuah Khan <skhan@linuxfoundation.org>2023-04-10 20:20:41 +0200
commitfa10366cc6f4cc862871f8938426d85c2481f084 (patch)
treee6697dd324a5e41259b0ae8b7ca6a8e0034c31d6 /tools/testing/selftests/resctrl/resctrl_val.c
parentselftests/resctrl: Move ->setup() call outside of test specific branches (diff)
downloadlinux-fa10366cc6f4cc862871f8938426d85c2481f084.tar.xz
linux-fa10366cc6f4cc862871f8938426d85c2481f084.zip
selftests/resctrl: Allow ->setup() to return errors
resctrl_val() assumes ->setup() always returns either 0 to continue tests or < 0 in case of the normal termination of tests after x runs. The latter overlaps with normal error returns. Define END_OF_TESTS (=1) to differentiate the normal termination of tests and return errors as negative values. Alter callers of ->setup() to handle errors properly. Fixes: 790bf585b0ee ("selftests/resctrl: Add Cache Allocation Technology (CAT) selftest") Fixes: ecdbb911f22d ("selftests/resctrl: Add MBM test") 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 '')
-rw-r--r--tools/testing/selftests/resctrl/resctrl_val.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/tools/testing/selftests/resctrl/resctrl_val.c b/tools/testing/selftests/resctrl/resctrl_val.c
index 787546a52849..00864242d76c 100644
--- a/tools/testing/selftests/resctrl/resctrl_val.c
+++ b/tools/testing/selftests/resctrl/resctrl_val.c
@@ -735,10 +735,12 @@ int resctrl_val(char **benchmark_cmd, struct resctrl_val_param *param)
/* Test runs until the callback setup() tells the test to stop. */
while (1) {
ret = param->setup(1, param);
- if (ret) {
+ if (ret == END_OF_TESTS) {
ret = 0;
break;
}
+ if (ret < 0)
+ break;
if (!strncmp(resctrl_val, MBM_STR, sizeof(MBM_STR)) ||
!strncmp(resctrl_val, MBA_STR, sizeof(MBA_STR))) {