John Kessenich | aab2514 | 2013-02-12 18:26:15 +0000 | [diff] [blame] | 1 | #!/usr/bin/env bash |
| 2 | |
John Kessenich | 4586dbd | 2013-08-05 15:52:03 +0000 | [diff] [blame] | 3 | TARGETDIR=localResults |
| 4 | BASEDIR=baseResults |
John Kessenich | d18e2d8 | 2014-03-11 02:10:26 +0000 | [diff] [blame] | 5 | EXE=../build/install/bin/glslangValidator |
John Kessenich | b38c969 | 2015-05-15 19:01:17 +0000 | [diff] [blame] | 6 | HASERROR=0 |
John Kessenich | 08d1824 | 2013-12-20 18:36:27 +0000 | [diff] [blame] | 7 | mkdir -p localResults |
John Kessenich | 69f4b51 | 2013-09-04 21:19:27 +0000 | [diff] [blame] | 8 | |
John Kessenich | cf0206c | 2014-04-14 15:46:40 +0000 | [diff] [blame] | 9 | if [ -a localtestlist ] |
| 10 | then |
| 11 | while read t; do |
| 12 | echo Running $t... |
| 13 | b=`basename $t` |
| 14 | $EXE -i -l $t > $TARGETDIR/$b.out |
John Kessenich | b38c969 | 2015-05-15 19:01:17 +0000 | [diff] [blame] | 15 | diff -b $BASEDIR/$b.out $TARGETDIR/$b.out || HASERROR=1 |
John Kessenich | cf0206c | 2014-04-14 15:46:40 +0000 | [diff] [blame] | 16 | done < localtestlist |
| 17 | fi |
| 18 | |
johnkslang | 02ad18a | 2015-06-26 00:12:31 -0600 | [diff] [blame] | 19 | rm -f comp.spv frag.spv geom.spv tesc.spv tese.spv vert.spv |
John Kessenich | 593a3f7 | 2015-05-15 18:44:16 +0000 | [diff] [blame] | 20 | |
| 21 | # |
John Kessenich | 31a51be | 2016-07-19 14:32:52 -0600 | [diff] [blame] | 22 | # special tests |
| 23 | # |
| 24 | |
| 25 | $EXE badMacroArgs.frag > $TARGETDIR/badMacroArgs.frag.out |
| 26 | diff -b $BASEDIR/badMacroArgs.frag.out $TARGETDIR/badMacroArgs.frag.out || HASERROR=1 |
| 27 | |
| 28 | # |
John Kessenich | 11f9fc7 | 2013-11-07 01:06:34 +0000 | [diff] [blame] | 29 | # reflection tests |
| 30 | # |
| 31 | echo Running reflection... |
John Kessenich | a86836e | 2016-07-09 14:50:57 -0600 | [diff] [blame] | 32 | $EXE -l -q -C reflection.vert > $TARGETDIR/reflection.vert.out |
John Kessenich | b38c969 | 2015-05-15 19:01:17 +0000 | [diff] [blame] | 33 | diff -b $BASEDIR/reflection.vert.out $TARGETDIR/reflection.vert.out || HASERROR=1 |
John Kessenich | 2572b19 | 2016-09-19 23:12:48 -0600 | [diff] [blame] | 34 | $EXE -D -e flizv -l -q -C -V hlsl.reflection.vert > $TARGETDIR/hlsl.reflection.vert.out |
| 35 | diff -b $BASEDIR/hlsl.reflection.vert.out $TARGETDIR/hlsl.reflection.vert.out || HASERROR=1 |
steve-lunarg | 8ffc36a | 2016-09-21 14:19:40 -0600 | [diff] [blame] | 36 | $EXE -D -e main -l -q -C -V hlsl.reflection.binding.frag > $TARGETDIR/hlsl.reflection.binding.frag.out |
| 37 | diff -b $BASEDIR/hlsl.reflection.binding.frag.out $TARGETDIR/hlsl.reflection.binding.frag.out || HASERROR=1 |
steve-lunarg | be28355 | 2017-04-18 12:18:01 -0600 | [diff] [blame] | 38 | $EXE -D -e main -l -q --hlsl-iomap --auto-map-bindings --stb 10 --sbb 20 --ssb 30 --suavb 40 --scb 50 -D -V -e main hlsl.automap.frag > $TARGETDIR/hlsl.automap.frag.out |
| 39 | diff -b $BASEDIR/hlsl.automap.frag.out $TARGETDIR/hlsl.automap.frag.out || HASERROR=1 |
John Kessenich | 11f9fc7 | 2013-11-07 01:06:34 +0000 | [diff] [blame] | 40 | |
| 41 | # |
John Kessenich | 38f3b89 | 2013-09-06 19:52:57 +0000 | [diff] [blame] | 42 | # multi-threaded test |
| 43 | # |
John Kessenich | 38f3b89 | 2013-09-06 19:52:57 +0000 | [diff] [blame] | 44 | echo Comparing single thread to multithread for all tests in current directory... |
John Kessenich | a86836e | 2016-07-09 14:50:57 -0600 | [diff] [blame] | 45 | $EXE -i -C *.vert *.geom *.frag *.tes* *.comp > singleThread.out |
| 46 | $EXE -i -C *.vert *.geom *.frag *.tes* *.comp -t > multiThread.out |
John Kessenich | b38c969 | 2015-05-15 19:01:17 +0000 | [diff] [blame] | 47 | diff singleThread.out multiThread.out || HASERROR=1 |
John Kessenich | 4b1a890 | 2017-07-06 11:58:12 -0600 | [diff] [blame] | 48 | if [ $HASERROR -eq 0 ] |
| 49 | then |
| 50 | rm singleThread.out |
| 51 | rm multiThread.out |
| 52 | fi |
John Kessenich | b38c969 | 2015-05-15 19:01:17 +0000 | [diff] [blame] | 53 | |
steve-lunarg | f1e0c87 | 2016-10-31 15:13:43 -0600 | [diff] [blame] | 54 | # |
| 55 | # entry point renaming tests |
| 56 | # |
John Kessenich | 906cc21 | 2016-12-09 19:22:20 -0700 | [diff] [blame] | 57 | echo Running entry-point renaming tests |
| 58 | $EXE -i -H -V -D -e main_in_spv --ku --source-entrypoint main hlsl.entry.rename.frag > $TARGETDIR/hlsl.entry.rename.frag.out |
steve-lunarg | f1e0c87 | 2016-10-31 15:13:43 -0600 | [diff] [blame] | 59 | diff -b $BASEDIR/hlsl.entry.rename.frag.out $TARGETDIR/hlsl.entry.rename.frag.out || HASERROR=1 |
| 60 | |
John Kessenich | 906cc21 | 2016-12-09 19:22:20 -0700 | [diff] [blame] | 61 | # |
| 62 | # Testing ill-defined uncalled function |
| 63 | # |
| 64 | echo Running ill-defined uncalled function |
| 65 | $EXE -D -e main -H hlsl.deadFunctionMissingBody.vert > $TARGETDIR/hlsl.deadFunctionMissingBody.vert.out |
| 66 | diff -b $BASEDIR/hlsl.deadFunctionMissingBody.vert.out $TARGETDIR/hlsl.deadFunctionMissingBody.vert.out || HASERROR=1 |
| 67 | |
John Kessenich | 84ea15f | 2015-05-15 21:54:24 +0000 | [diff] [blame] | 68 | if [ $HASERROR -eq 0 ] |
| 69 | then |
| 70 | echo Tests Succeeded. |
| 71 | else |
| 72 | echo Tests Failed. |
| 73 | fi |
| 74 | |
John Kessenich | e751bca | 2017-03-16 11:20:38 -0600 | [diff] [blame] | 75 | # |
| 76 | # Testing -S |
| 77 | # |
| 78 | echo Running explicit stage test |
| 79 | $EXE -i -S vert nosuffix > $TARGETDIR/nosuffix.out |
| 80 | diff -b $BASEDIR/nosuffix.out $TARGETDIR/nosuffix.out || HASERROR=1 |
| 81 | |
John Kessenich | 4f1403e | 2017-04-05 17:38:20 -0600 | [diff] [blame] | 82 | # |
| 83 | # Testing --hlsl-offsets |
| 84 | # |
| 85 | echo Running hlsl offsets |
| 86 | $EXE -i --hlsl-offsets -H spv.hlslOffsets.vert > $TARGETDIR/spv.hlslOffsets.vert.out |
| 87 | diff -b $BASEDIR/spv.hlslOffsets.vert.out $TARGETDIR/spv.hlslOffsets.vert.out || HASERROR=1 |
| 88 | |
| 89 | echo Running hlsl offsets |
| 90 | $EXE -i --hlsl-offsets -D -e main -H hlsl.hlslOffset.vert > $TARGETDIR/hlsl.hlslOffset.vert.out |
| 91 | diff -b $BASEDIR/hlsl.hlslOffset.vert.out $TARGETDIR/hlsl.hlslOffset.vert.out || HASERROR=1 |
| 92 | |
| 93 | # |
John Kessenich | 71facdf | 2017-05-17 18:28:19 -0600 | [diff] [blame] | 94 | # Testing --resource-set-binding |
Hyangran Park | 36dc829 | 2017-05-02 16:27:29 +0900 | [diff] [blame] | 95 | # |
| 96 | echo Configuring HLSL descriptor set and binding number manually |
| 97 | $EXE -V -D -e main -H hlsl.multiDescriptorSet.frag --rsb frag t0 0 0 t1 1 0 s0 0 1 s1 1 1 b0 2 0 b1 2 1 b2 2 2 > $TARGETDIR/hlsl.multiDescriptorSet.frag.out |
John Kessenich | 121853f | 2017-05-31 17:11:16 -0600 | [diff] [blame] | 98 | diff -b $BASEDIR/hlsl.multiDescriptorSet.frag.out $TARGETDIR/hlsl.multiDescriptorSet.frag.out || HASERROR=1 |
Hyangran Park | 36dc829 | 2017-05-02 16:27:29 +0900 | [diff] [blame] | 99 | |
LoopDawg | 5201719 | 2017-07-14 15:15:47 -0600 | [diff] [blame] | 100 | $EXE -V -D -e main -H hlsl.explicitDescriptorSet.frag --hlsl-iomap --amb --ssb 10 --stb 20 --rsb 4 > $TARGETDIR/hlsl.explicitDescriptorSet.frag.out |
| 101 | diff -b $BASEDIR/hlsl.explicitDescriptorSet.frag.out $TARGETDIR/hlsl.explicitDescriptorSet.frag.out || HASERROR=1 |
| 102 | |
| 103 | $EXE -V -D -e main -H hlsl.explicitDescriptorSet.frag --hlsl-iomap --amb --ssb 10 --stb 20 --rsb frag 3 > $TARGETDIR/hlsl.explicitDescriptorSet-2.frag.out |
| 104 | diff -b $BASEDIR/hlsl.explicitDescriptorSet-2.frag.out $TARGETDIR/hlsl.explicitDescriptorSet-2.frag.out || HASERROR=1 |
| 105 | |
Hyangran Park | 36dc829 | 2017-05-02 16:27:29 +0900 | [diff] [blame] | 106 | # |
John Kessenich | 71facdf | 2017-05-17 18:28:19 -0600 | [diff] [blame] | 107 | # Testing location error |
| 108 | # |
| 109 | echo Testing SPV no location |
| 110 | $EXE -V -C spv.noLocation.vert > $TARGETDIR/spv.noLocation.vert.out |
John Kessenich | 121853f | 2017-05-31 17:11:16 -0600 | [diff] [blame] | 111 | diff -b $BASEDIR/spv.noLocation.vert.out $TARGETDIR/spv.noLocation.vert.out || HASERROR=1 |
John Kessenich | 82e95a3 | 2017-08-26 15:47:25 -0600 | [diff] [blame^] | 112 | $EXE -G -H --aml spv.noBuiltInLoc.vert > $TARGETDIR/spv.noBuiltInLoc.vert.out |
John Kessenich | 91e69c0 | 2017-07-14 05:52:31 -0600 | [diff] [blame] | 113 | diff -b $BASEDIR/spv.noBuiltInLoc.vert.out $TARGETDIR/spv.noBuiltInLoc.vert.out || HASERROR=1 |
John Kessenich | 82e95a3 | 2017-08-26 15:47:25 -0600 | [diff] [blame^] | 114 | $EXE -G spv.looseUniformNoLoc.vert > $TARGETDIR/spv.looseUniformNoLoc.vert.out |
| 115 | diff -b $BASEDIR/spv.looseUniformNoLoc.vert.out $TARGETDIR/spv.looseUniformNoLoc.vert.out || HASERROR=1 |
John Kessenich | 121853f | 2017-05-31 17:11:16 -0600 | [diff] [blame] | 116 | |
| 117 | # |
| 118 | # Testing debug information |
| 119 | # |
| 120 | echo Testing SPV Debug Information |
John Kessenich | 2a27116 | 2017-07-20 20:00:36 -0600 | [diff] [blame] | 121 | $EXE -g --relaxed-errors --suppress-warnings --aml --hlsl-offsets --nsf \ |
| 122 | -G -H spv.debugInfo.frag --rsb frag 3 > $TARGETDIR/spv.debugInfo.frag.out |
John Kessenich | 121853f | 2017-05-31 17:11:16 -0600 | [diff] [blame] | 123 | diff -b $BASEDIR/spv.debugInfo.frag.out $TARGETDIR/spv.debugInfo.frag.out || HASERROR=1 |
John Kessenich | 2a27116 | 2017-07-20 20:00:36 -0600 | [diff] [blame] | 124 | $EXE -g -D -e newMain -g --amb --aml --fua --hlsl-iomap --nsf --sib 1 --ssb 2 --sbb 3 --stb 4 --suavb 5 --sub 6 \ |
| 125 | --sep origMain -H spv.hlslDebugInfo.vert --rsb vert t0 0 0 > $TARGETDIR/spv.hlslDebugInfo.frag.out |
| 126 | diff -b $BASEDIR/spv.hlslDebugInfo.frag.out $TARGETDIR/spv.hlslDebugInfo.frag.out || HASERROR=1 |
John Kessenich | 71facdf | 2017-05-17 18:28:19 -0600 | [diff] [blame] | 127 | |
| 128 | # |
John Kessenich | 3494b4d | 2017-05-22 15:00:42 -0600 | [diff] [blame] | 129 | # Testing Includer |
| 130 | # |
| 131 | echo Testing Includer |
| 132 | $EXE -D -e main -H ../Test/hlsl.include.vert > $TARGETDIR/hlsl.include.vert.out |
| 133 | diff -b $BASEDIR/hlsl.include.vert.out $TARGETDIR/hlsl.include.vert.out || HASERROR=1 |
| 134 | $EXE -D -e main -H hlsl.includeNegative.vert > $TARGETDIR/hlsl.includeNegative.vert.out |
| 135 | diff -b $BASEDIR/hlsl.includeNegative.vert.out $TARGETDIR/hlsl.includeNegative.vert.out || HASERROR=1 |
| 136 | $EXE -l -i include.vert > $TARGETDIR/include.vert.out |
| 137 | diff -b $BASEDIR/include.vert.out $TARGETDIR/include.vert.out || HASERROR=1 |
John Kessenich | 971a0a8 | 2017-06-07 15:06:58 -0600 | [diff] [blame] | 138 | $EXE -D -e main -H -Iinc1/path1 -Iinc1/path2 hlsl.dashI.vert > $TARGETDIR/hlsl.dashI.vert.out |
| 139 | diff -b $BASEDIR/hlsl.dashI.vert.out $TARGETDIR/hlsl.dashI.vert.out || HASERROR=1 |
John Kessenich | 3494b4d | 2017-05-22 15:00:42 -0600 | [diff] [blame] | 140 | |
| 141 | # |
John Kessenich | a931366 | 2017-06-15 10:40:49 -0600 | [diff] [blame] | 142 | # Testing -D and -U |
| 143 | # |
| 144 | $EXE -DUNDEFED -UIN_SHADER -DFOO=200 -i -l -UUNDEFED -DMUL=FOO*2 glsl.-D-U.frag > $TARGETDIR/glsl.-D-U.frag.out |
| 145 | diff -b $BASEDIR/glsl.-D-U.frag.out $TARGETDIR/glsl.-D-U.frag.out || HASERROR=1 |
| 146 | $EXE -D -e main -V -i -DUNDEFED -UIN_SHADER -DFOO=200 -UUNDEFED hlsl.-D-U.frag > $TARGETDIR/hlsl.-D-U.frag.out |
| 147 | diff -b $BASEDIR/hlsl.-D-U.frag.out $TARGETDIR/hlsl.-D-U.frag.out || HASERROR=1 |
| 148 | |
| 149 | # |
John Kessenich | 6353d55 | 2017-06-23 11:11:09 -0600 | [diff] [blame] | 150 | # Test --client and --target-env |
| 151 | # |
| 152 | $EXE --client vulkan100 spv.targetVulkan.vert || HASERROR=1 |
| 153 | $EXE --client opengl100 spv.targetOpenGL.vert || HASERROR=1 |
| 154 | $EXE --target-env vulkan1.0 spv.targetVulkan.vert || HASERROR=1 |
| 155 | $EXE --target-env opengl spv.targetOpenGL.vert || HASERROR=1 |
| 156 | $EXE -V100 spv.targetVulkan.vert || HASERROR=1 |
| 157 | $EXE -G100 spv.targetOpenGL.vert || HASERROR=1 |
| 158 | |
| 159 | # |
John Kessenich | 4f1403e | 2017-04-05 17:38:20 -0600 | [diff] [blame] | 160 | # Final checking |
| 161 | # |
John Kessenich | e751bca | 2017-03-16 11:20:38 -0600 | [diff] [blame] | 162 | if [ $HASERROR -eq 0 ] |
| 163 | then |
| 164 | echo Tests Succeeded. |
| 165 | else |
| 166 | echo Tests Failed. |
| 167 | fi |
| 168 | |
John Kessenich | 4b1a890 | 2017-07-06 11:58:12 -0600 | [diff] [blame] | 169 | rm -f comp.spv frag.spv geom.spv tesc.spv tese.spv vert.spv |
| 170 | |
John Kessenich | b38c969 | 2015-05-15 19:01:17 +0000 | [diff] [blame] | 171 | exit $HASERROR |