check: Add the ability to call a cleanup function after a test ends
In order to ensure tests properly clean themselves up, even if
they are subject to interruption, add the ability to call a test
specified function at cleanup time.
Any test can call _register_test_cleanup with the first argument
as a function to call after the test ends or is interrupted
(similar to using 'trap <func> EXIT').
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de> Signed-off-by: Logan Gunthorpe <logang@deltatee.com>