[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <f08dafda-c8a5-324a-464c-5b84d779c4ad@linux.intel.com>
Date: Tue, 20 Feb 2024 15:49:16 +0200 (EET)
From: Ilpo Järvinen <ilpo.jarvinen@...ux.intel.com>
To: Maciej Wieczor-Retman <maciej.wieczor-retman@...el.com>
cc: Fenghua Yu <fenghua.yu@...el.com>,
Reinette Chatre <reinette.chatre@...el.com>, Shuah Khan <shuah@...nel.org>,
LKML <linux-kernel@...r.kernel.org>, linux-kselftest@...r.kernel.org
Subject: Re: [PATCH 3/3] selftests/resctrl: Move cleanups out of individual
tests
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@...el.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.
--
i.
Powered by blists - more mailing lists