[PATCH v3 23/41] test: Move test running into a separate function