selftests/resctrl: Add cleanup function to test framework
authorMaciej Wieczor-Retman <maciej.wieczor-retman@intel.com>
Tue, 27 Feb 2024 07:21:41 +0000 (08:21 +0100)
committerShuah Khan <skhan@linuxfoundation.org>
Mon, 6 May 2024 19:57:19 +0000 (13:57 -0600)
commit8780bc88d4c86cdb7e9591bde9dd1110156a203b
tree9ad6e25afa75c447a9f4233cf007a7ae608992f7
parentfa04b7ffc23f2f6b84add32f7d31222434116365
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>
tools/testing/selftests/resctrl/cat_test.c
tools/testing/selftests/resctrl/cmt_test.c
tools/testing/selftests/resctrl/mba_test.c
tools/testing/selftests/resctrl/mbm_test.c
tools/testing/selftests/resctrl/resctrl.h