[PATCH v2 22/40] test: Move test running into a separate function