Skip to content

Commit 654b969

Browse files
authoredFeb 7, 2025
Add test for visibility in translation unit with multiple source files (#6306)
This closes #6221.
1 parent 252e13c commit 654b969

File tree

5 files changed

+59
-0
lines changed

5 files changed

+59
-0
lines changed
 

‎.github/workflows/ci.yml

+4
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,10 @@ jobs:
184184
--platform "${{matrix.platform}}" \
185185
--config "${{matrix.config}}" \
186186
--skip-file tests/expected-example-failure-github.txt
187+
- name: Run slangc tests
188+
if: steps.filter.outputs.should-run == 'true' && matrix.platform != 'wasm'
189+
run: |
190+
PATH=$bin_dir:$PATH tools/slangc-test/test.sh
187191
- name: Test Slang via glsl
188192
if: steps.filter.outputs.should-run == 'true' && matrix.full-gpu-tests && matrix.platform != 'wasm'
189193
run: |
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
module A;
2+
3+
public int test() { return 1; }
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
module source1;
2+
3+
import A;
4+
5+
[shader("compute")]
6+
void computeMain1() { int a = test(); }
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[shader("compute")]
2+
void computeMain2() { }

‎tools/slangc-test/test.sh

+44
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
#!/usr/bin/env bash
2+
3+
set -e
4+
5+
script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)"
6+
7+
summary=()
8+
failure_count=0
9+
test_count=0
10+
11+
test() {
12+
local name
13+
local exit_code
14+
name=$1
15+
shift
16+
pushd "$name" 1>/dev/null 2>&1
17+
echo "Running $name..."
18+
"$@" || exit_code=$?
19+
summary=("${summary[@]}" "$name: ")
20+
if [[ $exit_code -eq 0 ]]; then
21+
summary=("${summary[@]}" " success")
22+
else
23+
summary=("${summary[@]}" " failure (exit code: $exit_code)")
24+
fi
25+
popd 1>/dev/null 2>&1
26+
echo
27+
test_count=$((test_count + 1))
28+
}
29+
30+
cd "${script_dir}"
31+
32+
test multiple-source-files slangc source1.slang source2.slang
33+
34+
echo ""
35+
echo "Summary: "
36+
echo
37+
for line in "${summary[@]}"; do
38+
printf ' %s\n' "$line"
39+
done
40+
echo ""
41+
echo "$failure_count failed, out of $test_count tests"
42+
if [[ $failure_count -ne 0 ]]; then
43+
exit 1
44+
fi

0 commit comments

Comments
 (0)