aboutsummaryrefslogtreecommitdiff
path: root/tools/testing/selftests/resctrl/resctrl.h
diff options
context:
space:
mode:
authorMaciej Wieczor-Retman <maciej.wieczor-retman@intel.com>2024-02-27 08:21:41 +0100
committerShuah Khan <skhan@linuxfoundation.org>2024-05-06 13:57:19 -0600
commit8780bc88d4c86cdb7e9591bde9dd1110156a203b (patch)
tree9ad6e25afa75c447a9f4233cf007a7ae608992f7 /tools/testing/selftests/resctrl/resctrl.h
parentfa04b7ffc23f2f6b84add32f7d31222434116365 (diff)
selftests/resctrl: Add cleanup function to test framework
Resctrl selftests use very similar functions to cleanup after themselves. This creates a lot of code duplication. Also not being hooked to the test framework means that ctrl-c handler isn't aware of what test is currently running and executes all cleanups even though only one is needed. Add a function pointer to the resctrl_test struct and attach to it cleanup functions from individual tests. 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>
Diffstat (limited to 'tools/testing/selftests/resctrl/resctrl.h')
-rw-r--r--tools/testing/selftests/resctrl/resctrl.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/tools/testing/selftests/resctrl/resctrl.h b/tools/testing/selftests/resctrl/resctrl.h
index 2051bd135e0d..221c94532733 100644
--- a/tools/testing/selftests/resctrl/resctrl.h
+++ b/tools/testing/selftests/resctrl/resctrl.h
@@ -72,6 +72,7 @@ struct user_params {
* @disabled: Test is disabled
* @feature_check: Callback to check required resctrl features
* @run_test: Callback to run the test
+ * @cleanup: Callback to cleanup after the test
*/
struct resctrl_test {
const char *name;
@@ -82,6 +83,7 @@ struct resctrl_test {
bool (*feature_check)(const struct resctrl_test *test);
int (*run_test)(const struct resctrl_test *test,
const struct user_params *uparams);
+ void (*cleanup)(void);
};
/*