[PATCH 3/6] selftests: Extract logic for multiple test runs