diff options
| author | Anders Leino <aleino@nvidia.com> | 2025-02-07 10:50:07 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-02-07 00:50:07 -0800 |
| commit | 654b96933c31b077885f91a68310398c6dbbb3d6 (patch) | |
| tree | c856a981500f75747fa162aee2cba56eb7d15dfa /tools | |
| parent | 252e13cb3fcbd019bddf8394e9b82e3d8edbdca9 (diff) | |
Add test for visibility in translation unit with multiple source files (#6306)
This closes #6221.
Diffstat (limited to 'tools')
| -rw-r--r-- | tools/slangc-test/multiple-source-files/A.slang | 3 | ||||
| -rw-r--r-- | tools/slangc-test/multiple-source-files/source1.slang | 6 | ||||
| -rw-r--r-- | tools/slangc-test/multiple-source-files/source2.slang | 2 | ||||
| -rwxr-xr-x | tools/slangc-test/test.sh | 44 |
4 files changed, 55 insertions, 0 deletions
diff --git a/tools/slangc-test/multiple-source-files/A.slang b/tools/slangc-test/multiple-source-files/A.slang new file mode 100644 index 000000000..6dcbd8e29 --- /dev/null +++ b/tools/slangc-test/multiple-source-files/A.slang @@ -0,0 +1,3 @@ +module A; + +public int test() { return 1; }
\ No newline at end of file diff --git a/tools/slangc-test/multiple-source-files/source1.slang b/tools/slangc-test/multiple-source-files/source1.slang new file mode 100644 index 000000000..22a561de2 --- /dev/null +++ b/tools/slangc-test/multiple-source-files/source1.slang @@ -0,0 +1,6 @@ +module source1; + +import A; + +[shader("compute")] +void computeMain1() { int a = test(); }
\ No newline at end of file diff --git a/tools/slangc-test/multiple-source-files/source2.slang b/tools/slangc-test/multiple-source-files/source2.slang new file mode 100644 index 000000000..d1f5199e0 --- /dev/null +++ b/tools/slangc-test/multiple-source-files/source2.slang @@ -0,0 +1,2 @@ +[shader("compute")] +void computeMain2() { }
\ No newline at end of file diff --git a/tools/slangc-test/test.sh b/tools/slangc-test/test.sh new file mode 100755 index 000000000..858f24d23 --- /dev/null +++ b/tools/slangc-test/test.sh @@ -0,0 +1,44 @@ +#!/usr/bin/env bash + +set -e + +script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)" + +summary=() +failure_count=0 +test_count=0 + +test() { + local name + local exit_code + name=$1 + shift + pushd "$name" 1>/dev/null 2>&1 + echo "Running $name..." + "$@" || exit_code=$? + summary=("${summary[@]}" "$name: ") + if [[ $exit_code -eq 0 ]]; then + summary=("${summary[@]}" " success") + else + summary=("${summary[@]}" " failure (exit code: $exit_code)") + fi + popd 1>/dev/null 2>&1 + echo + test_count=$((test_count + 1)) +} + +cd "${script_dir}" + +test multiple-source-files slangc source1.slang source2.slang + +echo "" +echo "Summary: " +echo +for line in "${summary[@]}"; do + printf ' %s\n' "$line" +done +echo "" +echo "$failure_count failed, out of $test_count tests" +if [[ $failure_count -ne 0 ]]; then + exit 1 +fi |
