[PATCH v4 24/42] test: Move test running into a separate function