tests: Add ability to automatically rerun failed tests.