selftests/resctrl: Simplify cleanup in ctrl-c handler
authorMaciej Wieczor-Retman <maciej.wieczor-retman@intel.com>
Tue, 27 Feb 2024 07:21:42 +0000 (08:21 +0100)
committerShuah Khan <skhan@linuxfoundation.org>
Mon, 6 May 2024 19:57:19 +0000 (13:57 -0600)
commite6487230e952cfd4070c61141f011608841f36eb
tree48810da77f1abda29a2a34e560476266797fb3e3
parent8780bc88d4c86cdb7e9591bde9dd1110156a203b
selftests/resctrl: Simplify cleanup in ctrl-c handler

Ctrl-c handler isn't aware of what test is currently running. Because of
that it executes all cleanups even if they aren't necessary. Since the
ctrl-c handler uses the sa_sigaction system no parameters can be passed
to it as function arguments.

Add a global variable to make ctrl-c handler aware of the currently run
test and only execute the correct cleanup callback.

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/resctrl.h
tools/testing/selftests/resctrl/resctrl_tests.c
tools/testing/selftests/resctrl/resctrl_val.c