Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .ci/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
junitparser==3.2.0
google-cloud-storage==3.3.0
PyGithub==2.8.1
defusedxml==0.7.1
67 changes: 38 additions & 29 deletions .github/workflows/ur-build-hw.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,22 +72,9 @@ jobs:
# - switch to Ninja generator in CMake
# - downloading DPC++ should be integrated somehow; most likely use nightly release.
#
- name: Clean workspace
run: |
find $GITHUB_WORKSPACE -mindepth 1 -delete 2>/dev/null || true
mkdir -p $GITHUB_WORKSPACE

- name: Checkout LLVM
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2

- name: Verify checkout
run: |
if [ ! -d "unified-runtime" ]; then
echo "ERROR: unified-runtime directory not found after checkout"
ls -la
exit 1
fi

# for some reason it's required to re-configure python for venv to work properly.
- name: Set up Python 3.12
if: ${{ inputs.docker_image == 'ghcr.io/intel/llvm/ubuntu2404_intel_drivers:latest' }}
Expand All @@ -96,12 +83,13 @@ jobs:
python-version: '3.12'

- name: Install UR python dependencies in venv
working-directory: ./unified-runtime
run: |
python3 -m venv .venv
. .venv/bin/activate
echo "$PATH" >> $GITHUB_PATH
pip install -r unified-runtime/third_party/requirements.txt
pip install -r unified-runtime/third_party/requirements_testing.txt
pip install -r third_party/requirements.txt
pip install -r third_party/requirements_testing.txt

- name: Download DPC++
run: |
Expand All @@ -125,10 +113,6 @@ jobs:
run: |
sudo -E bash devops/scripts/install_drivers.sh devops/dependencies.json --igfx

- name: Check NVML version compatibility
if: ${{ inputs.adapter_name == 'CUDA' }}
run: python3 devops/scripts/check_nvml_version.py

- name: Configure Unified Runtime project
# ">" is used to avoid adding "\" at the end of each line; this command is quite long
run: >
Expand Down Expand Up @@ -157,21 +141,46 @@ jobs:
# This is to check that install command does not fail
run: cmake --install build

- name: Test adapter specific
- name: Build artifact name suffix
id: artifact_suffix
shell: bash
env:
ZE_ENABLE_LOADER_DEBUG_TRACE: 1
LIT_OPTS: "--timeout 120 -j 50"
# These tests cause timeouts on CI
LIT_FILTER_OUT: "(adapters/level_zero/memcheck.test|adapters/level_zero/v2/deferred_kernel_memcheck.test)"
run: cmake --build build -j $(($(nproc)/3)) -- check-unified-runtime-adapter
RUNNER_NAME: ${{ inputs.runner_name }}
STATIC_LOADER: ${{ matrix.adapter.static_Loader }}
OTHER_NAME: ${{ matrix.adapter.other_name }}
run: |
RUNNER_SUFFIX=$(echo "${RUNNER_NAME}" | sed 's/^UR_//')
SUFFIX="${RUNNER_SUFFIX}"

if [ "${STATIC_LOADER}" = "ON" ]; then
SUFFIX="${SUFFIX}-static"
fi

if [ -n "${OTHER_NAME}" ]; then
SUFFIX="${SUFFIX}-${OTHER_NAME}"
fi

echo "suffix=${SUFFIX}" >> $GITHUB_OUTPUT

- name: Check NVML version compatibility
if: ${{ inputs.adapter_name == 'CUDA' }}
run: python3 devops/scripts/check_nvml_version.py

- name: Test adapter specific
uses: ./devops/actions/run-tests/ur
with:
test_type: 'adapter-specific'
build_dir: build
artifact_name: 'ur-${{matrix.adapter.name}}-${{steps.artifact_suffix.outputs.suffix}}-adapter-specific'
# Don't run adapter specific tests when building multiple adapters
if: ${{ matrix.adapter.other_name == '' }}

- name: Test adapters
env:
ZE_ENABLE_LOADER_DEBUG_TRACE: 1
LIT_OPTS: "--timeout 120 -j 50"
run: cmake --build build -j $(($(nproc)/3)) -- check-unified-runtime-conformance
uses: ./devops/actions/run-tests/ur
with:
test_type: 'conformance'
build_dir: build
artifact_name: 'ur-${{matrix.adapter.name}}-${{steps.artifact_suffix.outputs.suffix}}-conformance'

- name: Debug CI platform information
if: ${{ always() }}
Expand Down
127 changes: 127 additions & 0 deletions devops/actions/run-tests/ur/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
name: 'Run UR Tests'

inputs:
test_type:
description: 'Type of tests to run (adapter-specific or conformance)'
required: true
build_dir:
required: false
default: 'build'
artifact_name:
description: 'Name for uploaded test artifacts (logs, XML)'
required: false
default: ''

runs:
using: "composite"
steps:
- name: Run ${{ inputs.test_type }} tests
id: run_tests
continue-on-error: true
shell: bash
env:
BUILD_DIR: ${{ inputs.build_dir }}
TEST_TYPE: ${{ inputs.test_type }}
run: |
# Run tests via unified CLI (handles validation, config, cmake execution)
# Use temp file instead of command substitution to preserve outputs even on error
OUTPUTS_FILE=$(mktemp)
set +e # Don't exit on error
devops/scripts/ur-test run "$TEST_TYPE" "$BUILD_DIR" "$GITHUB_WORKSPACE" > "$OUTPUTS_FILE" 2>&1
EXIT_CODE=$?
set -e # Re-enable exit on error

# Parse Python output and set GitHub Actions outputs (not env for security)
while IFS='=' read -r key value; do
if [ -n "$key" ] && [ -n "$value" ]; then
echo "$key=$value" >> $GITHUB_OUTPUT
echo " Set output: $key=$value"
fi
done < <(grep -E "^(log-file|xml-file|skip-artifacts)=" "$OUTPUTS_FILE")

rm -f "$OUTPUTS_FILE"
exit $EXIT_CODE

- name: Filter test log
if: ${{ always() && steps.run_tests.outputs['skip-artifacts'] != '1' }}
shell: bash
env:
LOG_FILE: ${{ steps.run_tests.outputs['log-file'] || 'adapter_tests.log' }}
run: |
if [ ! -f "$LOG_FILE" ]; then
echo "::warning::Test log not found"
exit 0
fi

echo "::group::Test Log"
devops/scripts/ur-test filter-log "$LOG_FILE" || { echo "::error::Filter failed"; head -1000 "$LOG_FILE"; }
echo "::endgroup::"

- name: Report test failures
if: steps.run_tests.outcome != 'success'
shell: bash
env:
LOG_FILE: ${{ steps.run_tests.outputs['log-file'] || 'adapter_tests.log' }}
run: |
devops/scripts/ur-test extract-errors "$LOG_FILE"
exit 1

- name: Test summary
if: ${{ always() && steps.run_tests.outputs['skip-artifacts'] != '1' }}
shell: bash
env:
LOG_FILE: ${{ steps.run_tests.outputs['log-file'] || 'adapter_tests.log' }}
XML_FILE: ${{ steps.run_tests.outputs['xml-file'] || 'adapter_tests_results.xml' }}
ARTIFACT_NAME: ${{ inputs.artifact_name }}
WORKFLOW_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
run: |
if [ ! -f "$LOG_FILE" ]; then
echo "::warning::Test log not found"
exit 0
fi

if [ ! -s "$LOG_FILE" ]; then
echo "::warning::Test log is empty"
exit 0
fi

devops/scripts/ur-test summary "$LOG_FILE" "${XML_FILE:-}"

# Add link to artifacts if they will be uploaded
if [ -n "$ARTIFACT_NAME" ]; then
echo ""
echo "---"
echo ""
echo "Test artifacts (full logs, XML) will be available at:"
echo "$WORKFLOW_URL"
fi

- name: Copy artifacts
if: ${{ always() && inputs.artifact_name != '' && (inputs.test_type != 'adapter-specific' || steps.run_tests.outputs['skip-artifacts'] != '1') }}
shell: bash
env:
LOG_FILE: ${{ steps.run_tests.outputs['log-file'] || 'adapter_tests.log' }}
XML_FILE: ${{ steps.run_tests.outputs['xml-file'] || 'adapter_tests_results.xml' }}
run: |
set -f # Disable glob expansion

# Clean artifacts directory to avoid mixing files from different test runs
rm -rf test_artifacts
mkdir -p test_artifacts

if [ -f "$LOG_FILE" ]; then
cp "$LOG_FILE" test_artifacts/
fi

if [ -n "$XML_FILE" ] && [ -f "$XML_FILE" ]; then
cp "$XML_FILE" test_artifacts/
fi

- name: Upload test artifacts
if: ${{ always() && inputs.artifact_name != '' && (inputs.test_type != 'adapter-specific' || steps.run_tests.outputs['skip-artifacts'] != '1') }}
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: ${{ inputs.artifact_name }}
path: test_artifacts/
retention-days: 7
if-no-files-found: warn
8 changes: 8 additions & 0 deletions devops/scripts/ur-test
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/usr/bin/env python3
"""Unified Runtime test management CLI."""

import sys
from ur_test_tools.cli import main

if __name__ == "__main__":
sys.exit(main())
36 changes: 36 additions & 0 deletions devops/scripts/ur_test_tools/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
"""UR Test Tools - Modular test orchestration and summary generation."""

__version__ = "1.0.0"
__author__ = "Unified Runtime Team"

from .models import (
TestLists,
TestCounts,
TimingSummary,
TestConfig,
SummaryConfigFromLines,
)
from .test_runner import TestRunner
from .summary_generator import SummaryReporter
from .validation import (
PathValidator,
)
from .outputs import (
ConsoleOutput,
GitHubActionsOutput,
)

__all__ = [
"__version__",
"__author__",
"TestLists",
"TestCounts",
"TimingSummary",
"TestConfig",
"SummaryConfigFromLines",
"TestRunner",
"SummaryReporter",
"PathValidator",
"ConsoleOutput",
"GitHubActionsOutput",
]
Loading
Loading