Files
TheRock/docs/development/test_environment_reproduction.md
T
derek.holloway 7502bf64a4
CodeQL / Analyze (actions) (push) Canceled after 0s
CodeQL / Analyze (python) (push) Canceled after 0s
pre-commit / pre-commit (push) Canceled after 0s
Multi-Arch CI / setup (push) Canceled after 0s
Publish build_manylinux_x86_64 images / publish_build_manylinux_x86_64 (push) Canceled after 0s
Setup (Multi-Arch) / setup (push) Canceled after 0s
Multi-Arch CI / Linux::${{ fromJSON(needs.setup.outputs.linux_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubi10 image / publish_no_rocm_image_ubi10 (push) Canceled after 0s
Multi-Arch CI / Windows::${{ fromJSON(needs.setup.outputs.windows_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Multi-Arch CI / Manifest Diff (push) Canceled after 0s
TheRock Manifest Diff Report / Generate Manifest Diff Report (push) Canceled after 0s
Multi-Arch CI / CI Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_ocl_rt images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_rocgdb images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Unit Tests / Unit Tests :: ubuntu-24.04 (push) Canceled after 0s
Unit Tests / Unit Tests :: windows-2022 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_media (push) Canceled after 0s
Unit Tests / Unit Tests Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_openmpi (push) Canceled after 0s
Flatten subprojects into a single base monorepo
2026-09-02 16:34:47 -07:00

137 lines
4.7 KiB
Markdown

# Test Environment Reproduction
This guide explains how to reproduce test failures from CI locally.
## Quick Start (Automated)
The easiest way to reproduce a test failure is using the `reproduce_test_failure.py`
script, which automates the entire setup process.
```bash
git clone https://github.com/ROCm/TheRock.git
cd TheRock
python build_tools/github_actions/reproduce_test_failure.py --run-id {CI_RUN_ID} --repository {GITHUB_REPO} --amdgpu-family {GPU_FAMILY} --test-script "{TEST_SCRIPT}"
```
Options:
- `--setup-only`: Set up the environment and drop into a shell without running
the test
When a test fails in CI, the reproduction command is printed in the job output.
## Linux
Linux reproduction uses Docker to ensure a clean environment with ROCm sourced
from TheRock.
### Docker Image
The base image is available at:
```
ghcr.io/rocm/no_rocm_image_ubuntu24_04:latest
```
### Manual Steps
If you prefer to set up manually:
```bash
docker run -it \
--ipc host \
--group-add video \
--device /dev/kfd \
--device /dev/dri \
ghcr.io/rocm/no_rocm_image_ubuntu24_04:latest /bin/bash
# Inside the container:
curl -LsSf https://astral.sh/uv/install.sh | bash && source $HOME/.local/bin/env
git clone https://github.com/ROCm/TheRock.git && cd TheRock
uv venv .venv && source .venv/bin/activate
uv pip install -r requirements-test.txt
GITHUB_REPOSITORY={GITHUB_REPO} python build_tools/install_rocm_from_artifacts.py \
--run-id {CI_RUN_ID} \
--amdgpu-family {GPU_FAMILY} \
{ADDITIONAL_FLAGS}
export THEROCK_BIN_DIR=./therock-build/bin
export OUTPUT_ARTIFACTS_DIR=./therock-build
# Run your test
python build_tools/github_actions/test_executable_scripts/test_rocblas.py
```
## Windows
Windows reproduction runs on bare metal and installs dependencies via Chocolatey.
### Prerequisites
- Windows machine with AMD GPU
- Administrator PowerShell access
### Installed Packages
The script will install:
- Chocolatey (package manager)
- git, python, cmake, ninja, ccache
- uv (Python package manager)
### Manual Steps
If you prefer to set up manually:
```powershell
# Install Chocolatey
Set-ExecutionPolicy Bypass -Scope Process -Force
[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072
iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1'))
Import-Module $env:ChocolateyInstall\\helpers\\chocolateyProfile.psm1; refreshenv
# Install dependencies
choco install -y git python cmake ninja ccache
# Install uv
irm https://astral.sh/uv/install.ps1 | iex
# Refresh PATH
$env:Path = [System.Environment]::GetEnvironmentVariable('Path','Machine') + ';' + [System.Environment]::GetEnvironmentVariable('Path','User')
# Clone and setup
git clone https://github.com/ROCm/TheRock.git
Set-Location TheRock
uv venv .venv
.venv\Scripts\Activate.ps1
uv pip install -r requirements-test.txt
# Download artifacts
$env:GITHUB_REPOSITORY='{GITHUB_REPO}'
python build_tools/install_rocm_from_artifacts.py `
--run-id {CI_RUN_ID} `
--amdgpu-family {GPU_FAMILY} `
{ADDITIONAL_FLAGS}
# Set environment
$env:THEROCK_BIN_DIR='./therock-build/bin'
$env:OUTPUT_ARTIFACTS_DIR='./therock-build'
# Run your test
python build_tools/github_actions/test_executable_scripts/test_rocblas.py
```
## Parameters
| Parameter | Description |
| ------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `CI_RUN_ID` | GitHub Actions run ID (e.g., from `https://github.com/ROCm/TheRock/actions/runs/16948046392` → `16948046392`) |
| `GPU_FAMILY` | LLVM target name (e.g., `gfx94X-dcgpu`, `gfx1151`, `gfx110X-all`) |
| `GITHUB_REPO` | Repository where the CI run was executed (e.g., `ROCm/TheRock`, `ROCm/rocm-libraries`) |
| `ADDITIONAL_FLAGS` | Optional flags for `install_rocm_from_artifacts.py`. See [installing_artifacts.md](installing_artifacts.md#component-selection) for available options. |
| `TEST_SCRIPT` | The test command to run (e.g., `python build_tools/github_actions/test_executable_scripts/test_rocblas.py`) |
## Test Scripts
Available test wrappers are in
[`build_tools/github_actions/test_executable_scripts/`](https://github.com/ROCm/TheRock/tree/main/build_tools/github_actions/test_executable_scripts).