On 2024-02-20 at 15:49:16 +0200, Ilpo Järvinen wrote:
On Tue, 20 Feb 2024, Maciej Wieczor-Retman wrote:
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
tools/testing/selftests/resctrl/cat_test.c | 4 +--- tools/testing/selftests/resctrl/cmt_test.c | 3 +-- tools/testing/selftests/resctrl/mba_test.c | 4 +--- tools/testing/selftests/resctrl/mbm_test.c | 4 +--- tools/testing/selftests/resctrl/resctrl.h | 4 ---- tools/testing/selftests/resctrl/resctrl_tests.c | 2 ++ 6 files changed, 6 insertions(+), 15 deletions(-)
diff --git a/tools/testing/selftests/resctrl/cat_test.c b/tools/testing/selftests/resctrl/cat_test.c index 2d2f69d3e5b7..ad5ebce65c07 100644 --- a/tools/testing/selftests/resctrl/cat_test.c +++ b/tools/testing/selftests/resctrl/cat_test.c @@ -128,7 +128,7 @@ static int check_results(struct resctrl_val_param *param, const char *cache_type return fail; } -void cat_test_cleanup(void) +static void cat_test_cleanup(void) { remove(RESULT_FILE_NAME); } @@ -289,8 +289,6 @@ static int cat_run_test(const struct resctrl_test *test, const struct user_param ret = check_results(¶m, test->resource, cache_total_size, full_cache_mask, start_mask); out:
- cat_test_cleanup();
Any goto out can now become return ret; and the out label be then removed.
Right, thanks, I'll clean these up.
-- i.