PaddlePaddle/PaddleOCR · error · SystemExit

xcresulttool get test-results failed with exit {r.returncode

Error message

xcresulttool get test-results failed with exit {r.returncode}.

What it means

Raised by extract_xcresult_attachments.py when the probe in _load_tests_json fails: `xcrun xcresulttool get test-results tests --path <xcresult> --format json` exits non-zero. The script surfaces the exit code, the result-bundle path, and a hint that the bundle must come from a completed `xcodebuild test` run.

Source

Thrown at deploy/ios_demo/scripts/extract_xcresult_attachments.py:102

        )


def _load_tests_json(result_path: Path) -> dict:
    r = _run(
        [
            "xcrun",
            "xcresulttool",
            "get",
            "test-results",
            "tests",
            "--path",
            str(result_path),
            "--format",
            "json",
        ]
    )
    if r.returncode != 0:
        raise SystemExit(
            _die(
                f"xcresulttool get test-results failed with exit {r.returncode}.",
                str(result_path),
                "Confirm the .xcresult was produced by a completed `xcodebuild test`.",
            )
        )
    try:
        return json.loads(r.stdout or b"{}")
    except json.JSONDecodeError as e:
        raise SystemExit(
            _die(
                f"Could not parse xcresulttool JSON: {e}.",
                str(result_path),
                "Re-run xcodebuild test to regenerate the .xcresult.",
            )
        )

View on GitHub (pinned to 2661c7c0ef)

Solutions

  1. Re-run the tests to completion (`xcodebuild test ... -resultBundlePath result.xcresult`) and pass that fresh bundle.
  2. Verify the path exists and is a directory ending in .xcresult.
  3. Ensure the Xcode that produced the bundle matches (or is older than) the one selected for extraction.

Example fix

# before
python deploy/ios_demo/scripts/extract_xcresult_attachments.py build/  # wrong path
# -> SystemExit: xcresulttool get test-results failed with exit 70

# after
xcodebuild test -scheme Demo -resultBundlePath result.xcresult
python deploy/ios_demo/scripts/extract_xcresult_attachments.py result.xcresult
Defensive patterns

Strategy: try-catch

Validate before calling

from pathlib import Path

def xcresult_ok(path: str) -> bool:
    p = Path(path)
    return p.is_dir() and p.suffix == ".xcresult" and (p / "Info.plist").exists()

assert xcresult_ok(bundle), f"{bundle} is not a complete .xcresult bundle"

Try / catch

try:
    extract(result_path)
except SystemExit as e:
    msg = str(e)
    if "xcresulttool get test-results failed" in msg:
        rerun_tests_and_retry()  # regenerate the bundle from a completed xcodebuild test
    else:
        raise

Prevention

When it happens

Trigger: Pointing the script at a nonexistent or truncated .xcresult, a bundle from an interrupted/crashed test run, or a bundle created by a different (older) Xcode whose format the current xcresulttool cannot read.

Common situations: Test runner was killed mid-suite leaving a partial bundle; passing the build directory instead of the .xcresult path; archiving tests with one Xcode version and extracting with another.

Related errors


AI-assisted analysis of PaddlePaddle/PaddleOCR@2661c7c0ef (2026-08-14). Data as JSON: /api/errors/37c01863d471431f. Report an issue: GitHub.