[PATCH v5 24/41] test: Move test running into a separate function