From f162d0d657d564605b826cadcd005ceef70bb584 Mon Sep 17 00:00:00 2001 From: Spencer Fricke <115671160+spencer-lunarg@users.noreply.github.com> Date: Thu, 11 Jan 2024 09:06:59 +0900 Subject: [PATCH] Fix and improve CI Testing of database shader (#245) --- .github/workflows/linux-cmake-build.yml | 12 ++++++------ tests/ci_database.py | 22 ++++++++++++++++++++++ 2 files changed, 28 insertions(+), 6 deletions(-) create mode 100644 tests/ci_database.py diff --git a/.github/workflows/linux-cmake-build.yml b/.github/workflows/linux-cmake-build.yml index f2488c62..6f84489f 100644 --- a/.github/workflows/linux-cmake-build.yml +++ b/.github/workflows/linux-cmake-build.yml @@ -40,19 +40,19 @@ jobs: git clone https://github.com/LunarG/SPIRV-Database.git build/SPIRV-Database - name: Test - SaschaWillemsVulkan run: | - for spv in $(find build/SPIRV-Database/vulkan/SaschaWillemsVulkan/ -type f); do bin/spirv-reflect $spv -ci; done + python tests/ci_database.py --dir build/SPIRV-Database/vulkan/SaschaWillemsVulkan/ - name: Test - clspv run: | - for spv in $(find build/SPIRV-Database/vulkan/clspv/ -type f); do bin/spirv-reflect $spv -ci; done + python tests/ci_database.py --dir build/SPIRV-Database/vulkan/clspv/ - name: Test - dawn run: | - for spv in $(find build/SPIRV-Database/vulkan/dawn/ -type f); do bin/spirv-reflect $spv -ci; done + python tests/ci_database.py --dir build/SPIRV-Database/vulkan/dawn/ - name: Test - gl_cts run: | - for spv in $(find build/SPIRV-Database/vulkan/gl_cts/ -type f); do bin/spirv-reflect $spv -ci; done + python tests/ci_database.py --dir build/SPIRV-Database/vulkan/gl_cts/ - name: Test - naga run: | - for spv in $(find build/SPIRV-Database/vulkan/naga/remaps/ -type f); do bin/spirv-reflect $spv -ci; done + python tests/ci_database.py --dir build/SPIRV-Database/vulkan/naga/remaps/ - name: Test - tint run: | - for spv in $(find build/SPIRV-Database/vulkan/tint/ -type f); do bin/spirv-reflect $spv -ci; done + python tests/ci_database.py --dir build/SPIRV-Database/vulkan/tint/ diff --git a/tests/ci_database.py b/tests/ci_database.py new file mode 100644 index 00000000..7fe17ff3 --- /dev/null +++ b/tests/ci_database.py @@ -0,0 +1,22 @@ +import os +import sys +import argparse +import subprocess + +if __name__ == '__main__': + parser = argparse.ArgumentParser(description='run SPIRV-Database in CI') + # Main reason for passing dir in is so GitHub Actions can group things, otherwise logs get VERY long for a single action + parser.add_argument('--dir', action='store', required=True, type=str, help='path to SPIR-V files') + args = parser.parse_args() + + root_dir = os.path.abspath(os.path.join(os.path.dirname(__file__), '..')) + exe_path = os.path.join(root_dir, 'bin/spirv-reflect') + + for currentpath, folders, files in os.walk(args.dir): + for file in files: + spirv_file = os.path.join(currentpath, file) + command = f'{exe_path} {spirv_file} -ci' + exit_code = subprocess.call(command.split()) + if exit_code != 0: + print(f'ERROR for {spirv_file}') + sys.exit(1) \ No newline at end of file