blob: f84e5139a2bfaa68e89a278afa46b7fd537dce30 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
|
name: CI Test Workflow
on:
workflow_call:
inputs:
os:
required: true
type: string
compiler:
required: true
type: string
platform:
required: true
type: string
config:
required: true
type: string
runs-on:
required: true
type: string
test-category:
required: false
type: string
default: smoke
full-gpu-tests:
required: false
type: boolean
default: false
server-count:
required: false
type: number
default: 8
enable-debug-layers:
required: false
type: boolean
default: true
jobs:
test-slang:
runs-on: ${{ fromJSON(inputs.runs-on) }}
timeout-minutes: 30
defaults:
run:
shell: bash
steps:
- uses: actions/checkout@v4
- name: Common Test Setup
uses: ./.github/actions/common-test-setup
with:
os: ${{ inputs.os }}
compiler: ${{ inputs.compiler }}
platform: ${{ inputs.platform }}
config: ${{ inputs.config }}
- name: Test Slang
run: |
export SLANG_RUN_SPIRV_VALIDATION=1
export SLANG_USE_SPV_SOURCE_LANGUAGE_UNKNOWN=1
if [ "${{ inputs.enable-debug-layers }}" == "true" ]; then
export VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation
fi
# Build common slang-test arguments
slang_test_args=(
"-category" "${{ inputs.test-category }}"
"-expected-failure-list" "tests/expected-failure-github.txt"
"-skip-reference-image-generation"
"-show-adapter-info"
"-ignore-abort-msg"
"-enable-debug-layers" "${{ inputs.enable-debug-layers }}"
)
# Add test server arguments only if server count > 1
if [ "${{ inputs.server-count }}" -gt 1 ]; then
slang_test_args+=("-use-test-server")
slang_test_args+=("-server-count" "${{ inputs.server-count }}")
fi
# Add no-GPU failure list for non-GPU tests
if [[ "${{ inputs.full-gpu-tests }}" != "true" ]]; then
slang_test_args+=("-expected-failure-list" "tests/expected-failure-no-gpu.txt")
fi
# Execute slang-test with all arguments
"$bin_dir/slang-test" "${slang_test_args[@]}"
- name: Run Slang examples
# Run GLSL backend tests on release for pull requests, and not on merge_group, to reduce CI load.
if: inputs.full-gpu-tests && inputs.config == 'release' && github.event_name == 'pull_request'
run: |
.github/workflows/ci-examples.sh \
--bin-dir "$bin_dir" \
--os "${{ inputs.os }}" \
--platform "${{ inputs.platform }}" \
--config "${{ inputs.config }}" \
--skip-file tests/expected-example-failure-github.txt
- name: Run slangc tests
run: |
PATH=$bin_dir:$PATH tools/slangc-test/test.sh
- name: Test Slang via glsl
# Run GLSL backend tests on release for pull requests, and not on merge_group, to reduce CI load.
if: inputs.os != 'macos' && inputs.full-gpu-tests && inputs.config == 'release' && github.event_name == 'pull_request'
run: |
export SLANG_RUN_SPIRV_VALIDATION=1
export SLANG_USE_SPV_SOURCE_LANGUAGE_UNKNOWN=1
"$bin_dir/slang-test" \
-use-test-server \
-server-count ${{ inputs.server-count }} \
-category ${{ inputs.test-category }} \
-emit-spirv-via-glsl \
-ignore-abort-msg \
-api vk \
-expected-failure-list tests/expected-failure-via-glsl.txt \
-skip-reference-image-generation
# Run slang-rhi tests when:
# 1. full-gpu-tests is enabled AND
# 2. Either it's a pull request OR config is release
# This is to reduce the CI load but do some check on pull requests.
# expensive slang-rhi tests are excluded with -tce option, because they are not relevant for Slang.
test-slang-rhi:
runs-on: ${{ fromJSON(inputs.runs-on) }}
timeout-minutes: 30
if: inputs.full-gpu-tests && (github.event_name == 'pull_request' || inputs.config == 'release')
defaults:
run:
shell: bash
steps:
- uses: actions/checkout@v4
with:
submodules: "recursive"
fetch-depth: "1"
- name: Common Test Setup
uses: ./.github/actions/common-test-setup
with:
os: ${{ inputs.os }}
compiler: ${{ inputs.compiler }}
platform: ${{ inputs.platform }}
config: ${{ inputs.config }}
- name: Run slang-rhi tests
run: |
export SLANG_RHI_EXCLUDE_TESTS="md-clear*,cmd-copy*,cmd-upload*,fence*,staging-heap*,texture-create*"
"$bin_dir/slang-rhi-tests" -check-devices -tce="$SLANG_RHI_EXCLUDE_TESTS"
# Run slangpy tests when:
# 1. full-gpu-tests is enabled AND
# 2. Either it's a pull request OR config is release
# This is to reduce the CI load but do some check on pull requests.
test-slangpy:
runs-on: ${{ fromJSON(inputs.runs-on) }}
timeout-minutes: 30
if: inputs.full-gpu-tests && (github.event_name == 'pull_request' || inputs.config == 'release')
defaults:
run:
shell: bash
steps:
- uses: actions/checkout@v4
- name: Common Test Setup
uses: ./.github/actions/common-test-setup
with:
os: ${{ inputs.os }}
compiler: ${{ inputs.compiler }}
platform: ${{ inputs.platform }}
config: ${{ inputs.config }}
- name: Setup Python
if: ${{ runner.environment != 'self-hosted' }}
uses: actions/setup-python@v5
with:
python-version: "3.10"
- name: Run slangpy tests
run: |
python --version
echo "Cleaning up existing installations and installing slangpy..."
# Try to uninstall existing slangpy
python -m pip uninstall -y slangpy || echo "slangpy not found or already removed"
# Install slangpy
python -m pip install --verbose slangpy --user
# Get site packages directory
SITE_PACKAGES=$(python -c "import slangpy; import os; print(os.path.dirname(os.path.dirname(slangpy.__file__)))" | tail -n 1)
echo "Site packages directory: $SITE_PACKAGES"
echo "bin_dir location: $bin_dir"
echo "lib_dir location: $lib_dir"
# Copy library files
if [[ "${{ inputs.os }}" == "windows" ]]; then
cp "$bin_dir"/slang*.dll "$SITE_PACKAGES/slangpy/" || { echo "Failed to copy library files"; exit 1; }
else
cp "$lib_dir"/libslang*.* "$SITE_PACKAGES/slangpy/" || { echo "Failed to copy library files"; exit 1; }
fi
echo "Listing files in slangpy directory..."
ls -la "$SITE_PACKAGES/slangpy/"
# Skip package installation on self-hosted runners to avoid permission issues
if [[ ! "${{ inputs.runs-on }}" =~ self-hosted ]]; then
echo "Installing python packages..."
curl -fsSL https://raw.githubusercontent.com/shader-slang/slangpy/main/requirements-dev.txt -o requirements-dev.txt
python -m pip install -r requirements-dev.txt --user
python -m pip install pytest-github-actions-annotate-failures --user
python -m pip install pytest-xdist --user
fi
echo "Running pytest on slangpy tests..."
export PYTHONPATH="$SITE_PACKAGES"
python -m pytest "$SITE_PACKAGES/slangpy/tests" -ra -n auto --maxprocesses=3 \
--deselect "device/test_blit.py::test_generate_mips[compute-DeviceType.cuda]"
|