diff options
author | Maciej Wieczor-Retman <maciej.wieczor-retman@intel.com> | 2024-02-27 08:21:43 +0100 |
---|---|---|
committer | Shuah Khan <skhan@linuxfoundation.org> | 2024-05-06 21:57:19 +0200 |
commit | 6cd368982cf3f972e5298025af0a9d2b69045cfe (patch) | |
tree | f26af66119fcec652f1fa9a86f2afc2c8ef92a9f /tools/testing/selftests/resctrl/resctrl_tests.c | |
parent | selftests/resctrl: Simplify cleanup in ctrl-c handler (diff) | |
download | linux-6cd368982cf3f972e5298025af0a9d2b69045cfe.tar.xz linux-6cd368982cf3f972e5298025af0a9d2b69045cfe.zip |
selftests/resctrl: Move cleanups out of individual tests
Every test calls its cleanup function at the end of it's test function.
After the cleanup function pointer is added to the test framework this
can be simplified to executing the callback function at the end of the
generic test running function.
Make test cleanup functions static and call them from the end of
run_single_test() from the resctrl_test's cleanup function pointer.
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 '')
-rw-r--r-- | tools/testing/selftests/resctrl/resctrl_tests.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/tools/testing/selftests/resctrl/resctrl_tests.c b/tools/testing/selftests/resctrl/resctrl_tests.c index 0590daec2f44..348d17cb2a84 100644 --- a/tools/testing/selftests/resctrl/resctrl_tests.c +++ b/tools/testing/selftests/resctrl/resctrl_tests.c @@ -100,8 +100,10 @@ static int test_prepare(const struct resctrl_test *test) return 0; } -static void test_cleanup(void) +static void test_cleanup(const struct resctrl_test *test) { + if (test->cleanup) + test->cleanup(); umount_resctrlfs(); signal_handler_unregister(); } @@ -143,7 +145,7 @@ static void run_single_test(const struct resctrl_test *test, const struct user_p ksft_test_result(!ret, "%s: test\n", test->name); cleanup: - test_cleanup(); + test_cleanup(test); } static void init_user_params(struct user_params *uparams) |