Re: [PATCH v7 5/6] selftests/resctrl: Commonize the signal handler register/unregister for all tests

From: Reinette Chatre
Date: Mon Feb 13 2023 - 14:21:33 EST


Hi Shaopeng,

On 2/12/2023 10:24 PM, Shaopeng Tan wrote:
> After creating a child process with fork() in CAT test, if a signal such
> as SIGINT is received, the parent process will be terminated immediately,
> and therefor the child process will not be killed and also resctrlfs is
> not unmounted.
>
> There is a signal handler registered in CMT/MBM/MBA tests, which kills
> child process, unmount resctrlfs, cleanups result files, etc., if a
> signal such as SIGINT is received.
>
> Commonize the signal handler registered for CMT/MBM/MBA tests and
> reuse it in CAT.
>
> To reuse the signal handler to kill child process use global bm_pid
> instead of local bm_pid.
>
> Also, since the MBA/MBA/CMT/CAT are run in order, unregister the signal
> handler at the end of each test so that the signal handler cannot be
> inherited by other tests.
>
> Signed-off-by: Shaopeng Tan <tan.shaopeng@xxxxxxxxxxxxxx>

Reviewed-by: Reinette Chatre <reinette.chatre@xxxxxxxxx>

Thank you very much

Reinette