Add some convenience scripts for running tests.
This commit is contained in:
Родитель
aa2557c7df
Коммит
e6ea63cdfd
|
@ -14,5 +14,6 @@
|
|||
*.shader
|
||||
*.a
|
||||
*.bc
|
||||
/external
|
||||
|
||||
!CMakeLists.txt
|
||||
|
|
34
README.md
34
README.md
|
@ -264,12 +264,36 @@ Contributions to SPIRV-Cross are welcome. See Testing and Licensing sections for
|
|||
SPIRV-Cross maintains a test suite of shaders with reference output of how the output looks after going through a roundtrip through
|
||||
glslangValidator then back through SPIRV-Cross again. The reference files are stored inside the repository in order to be able to track regressions.
|
||||
|
||||
All pull requests should ensure that test output does not change unexpectedly. This can be tested with `./test_shaders.py shaders`.
|
||||
However, when improving SPIRV-Cross there are of course legitimate cases where reference output should change.
|
||||
In these cases, run `./test_shaders.py shaders --update` to update the reference files and include these changes as part of the pull request.
|
||||
Always make sure you are running up to date glslangValidator as well as SPIRV-Tools when updating reference files.
|
||||
All pull requests should ensure that test output does not change unexpectedly. This can be tested with:
|
||||
|
||||
In short, the master branch should always be able to run `./test_shaders.py shaders` without failure.
|
||||
```
|
||||
./test_shaders.py shaders
|
||||
./test_shaders.py shaders --opt
|
||||
./test_shaders.py shaders-hlsl --hlsl
|
||||
./test_shaders.py shaders-hlsl --hlsl --opt
|
||||
./test_shaders.py shaders-msl --msl
|
||||
./test_shaders.py shaders-msl --msl --opt
|
||||
```
|
||||
|
||||
although there are a couple of convenience script for doing this:
|
||||
|
||||
```
|
||||
./checkout_glslang_spirv_tools.sh # Checks out glslang and SPIRV-Tools at a fixed revision which matches the reference output.
|
||||
./test_shaders.sh # Runs over all changes and makes sure that there are no deltas compared to reference files.
|
||||
```
|
||||
|
||||
However, when improving SPIRV-Cross there are of course legitimate cases where reference output should change.
|
||||
In these cases, run:
|
||||
|
||||
```
|
||||
./update_test_shaders.sh
|
||||
```
|
||||
|
||||
to update the reference files and include these changes as part of the pull request.
|
||||
Always make sure you are running the correct version of glslangValidator as well as SPIRV-Tools when updating reference files.
|
||||
See `checkout_glslang_spirv_tools.sh`.
|
||||
|
||||
In short, the master branch should always be able to run `./test_shaders.py shaders` and friends without failure.
|
||||
SPIRV-Cross uses Travis CI to test all pull requests, so it is not strictly needed to perform testing yourself if you have problems running it locally.
|
||||
A pull request which does not pass testing on Travis will not be accepted however.
|
||||
|
||||
|
|
|
@ -0,0 +1,57 @@
|
|||
#!/bin/bash
|
||||
|
||||
GLSLANG_REV=698bf7547a96b6feb7291e8ddc0d5d16475dbae2
|
||||
SPIRV_TOOLS_REV=e28edd458b729da7bbfd51e375feb33103709e6f
|
||||
|
||||
if [ -d external/glslang ]; then
|
||||
echo "Updating glslang to revision $GLSLANG_REV."
|
||||
cd external/glslang
|
||||
git fetch origin
|
||||
git checkout $GLSLANG_REV
|
||||
else
|
||||
echo "Cloning glslang revision $GLSLANG_REV."
|
||||
mkdir -p external
|
||||
cd external
|
||||
git clone git://github.com/KhronosGroup/glslang.git
|
||||
cd glslang
|
||||
git checkout $GLSLANG_REV
|
||||
fi
|
||||
cd ../..
|
||||
|
||||
echo "Building glslang."
|
||||
mkdir -p external/glslang-build
|
||||
cd external/glslang-build
|
||||
cmake ../glslang -DCMAKE_BUILD_TYPE=Release
|
||||
make -j$(nproc)
|
||||
cd ../..
|
||||
|
||||
if [ -d external/spirv-tools ]; then
|
||||
echo "Updating SPIRV-Tools to revision $SPIRV_TOOLS_REV."
|
||||
cd external/spirv-tools
|
||||
git fetch origin
|
||||
git checkout $SPIRV_TOOLS_REV
|
||||
else
|
||||
echo "Cloning SPIRV-Tools revision $SPIRV_TOOLS_REV."
|
||||
mkdir -p external
|
||||
cd external
|
||||
git clone git://github.com/KhronosGroup/SPIRV-Tools.git spirv-tools
|
||||
cd spirv-tools
|
||||
git checkout $SPIRV_TOOLS_REV
|
||||
|
||||
if [ -d external/spirv-headers ]; then
|
||||
cd external/spirv-headers
|
||||
git pull origin master
|
||||
cd ../..
|
||||
else
|
||||
git clone git://github.com/KhronosGroup/SPIRV-Headers.git external/spirv-headers
|
||||
fi
|
||||
fi
|
||||
cd ../..
|
||||
|
||||
echo "Building SPIRV-Tools."
|
||||
mkdir -p external/spirv-tools-build
|
||||
cd external/spirv-tools-build
|
||||
cmake ../spirv-tools -DCMAKE_BUILD_TYPE=Release
|
||||
make -j$(nproc)
|
||||
cd ../..
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
#!/bin/bash
|
||||
|
||||
echo "Building spirv-cross"
|
||||
make -j$(nproc)
|
||||
|
||||
export PATH="./external/glslang-build/StandAlone:./external/spirv-tools-build/tools:$PATH"
|
||||
echo "Using glslangValidation in: $(which glslangValidator)."
|
||||
echo "Using spirv-opt in: $(which spirv-opt)."
|
||||
|
||||
./test_shaders.py shaders
|
||||
./test_shaders.py shaders --opt
|
||||
./test_shaders.py shaders-msl --msl
|
||||
./test_shaders.py shaders-msl --msl --opt
|
||||
./test_shaders.py shaders-hlsl --hlsl
|
||||
./test_shaders.py shaders-hlsl --hlsl --opt
|
|
@ -0,0 +1,15 @@
|
|||
#!/bin/bash
|
||||
|
||||
echo "Building spirv-cross"
|
||||
make -j$(nproc)
|
||||
|
||||
export PATH="./external/glslang-build/StandAlone:./external/spirv-tools-build/tools:$PATH"
|
||||
echo "Using glslangValidation in: $(which glslangValidator)."
|
||||
echo "Using spirv-opt in: $(which spirv-opt)."
|
||||
|
||||
./test_shaders.py shaders --update
|
||||
./test_shaders.py shaders --update --opt
|
||||
./test_shaders.py shaders-msl --msl --update
|
||||
./test_shaders.py shaders-msl --msl --update --opt
|
||||
./test_shaders.py shaders-hlsl --hlsl --update
|
||||
./test_shaders.py shaders-hlsl --hlsl --update --opt
|
Загрузка…
Ссылка в новой задаче