blob: 5e873f503e8a02d430fa84ad2201900e3b59be25 [file] [log] [blame]
John Kessenichaab25142013-02-12 18:26:15 +00001#!/usr/bin/env bash
2
John Kessenich4586dbd2013-08-05 15:52:03 +00003TARGETDIR=localResults
4BASEDIR=baseResults
John Kessenichd18e2d82014-03-11 02:10:26 +00005EXE=../build/install/bin/glslangValidator
LoopDawg8004d362017-09-17 10:38:52 -06006REMAPEXE=../build/install/bin/spirv-remap
John Kessenichb38c9692015-05-15 19:01:17 +00007HASERROR=0
John Kessenich08d18242013-12-20 18:36:27 +00008mkdir -p localResults
John Kessenich69f4b512013-09-04 21:19:27 +00009
John Kessenichcf0206c2014-04-14 15:46:40 +000010if [ -a localtestlist ]
11 then
12 while read t; do
13 echo Running $t...
14 b=`basename $t`
15 $EXE -i -l $t > $TARGETDIR/$b.out
John Kessenichb38c9692015-05-15 19:01:17 +000016 diff -b $BASEDIR/$b.out $TARGETDIR/$b.out || HASERROR=1
John Kessenichcf0206c2014-04-14 15:46:40 +000017 done < localtestlist
18fi
19
johnkslang02ad18a2015-06-26 00:12:31 -060020rm -f comp.spv frag.spv geom.spv tesc.spv tese.spv vert.spv
John Kessenich593a3f72015-05-15 18:44:16 +000021
22#
John Kessenich31a51be2016-07-19 14:32:52 -060023# special tests
24#
25
26$EXE badMacroArgs.frag > $TARGETDIR/badMacroArgs.frag.out
27diff -b $BASEDIR/badMacroArgs.frag.out $TARGETDIR/badMacroArgs.frag.out || HASERROR=1
28
29#
John Kessenich11f9fc72013-11-07 01:06:34 +000030# reflection tests
31#
32echo Running reflection...
John Kessenicha86836e2016-07-09 14:50:57 -060033$EXE -l -q -C reflection.vert > $TARGETDIR/reflection.vert.out
John Kessenichb38c9692015-05-15 19:01:17 +000034diff -b $BASEDIR/reflection.vert.out $TARGETDIR/reflection.vert.out || HASERROR=1
John Kessenich2572b192016-09-19 23:12:48 -060035$EXE -D -e flizv -l -q -C -V hlsl.reflection.vert > $TARGETDIR/hlsl.reflection.vert.out
36diff -b $BASEDIR/hlsl.reflection.vert.out $TARGETDIR/hlsl.reflection.vert.out || HASERROR=1
steve-lunarg8ffc36a2016-09-21 14:19:40 -060037$EXE -D -e main -l -q -C -V hlsl.reflection.binding.frag > $TARGETDIR/hlsl.reflection.binding.frag.out
38diff -b $BASEDIR/hlsl.reflection.binding.frag.out $TARGETDIR/hlsl.reflection.binding.frag.out || HASERROR=1
steve-lunargbe283552017-04-18 12:18:01 -060039$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
40diff -b $BASEDIR/hlsl.automap.frag.out $TARGETDIR/hlsl.automap.frag.out || HASERROR=1
John Kessenich11f9fc72013-11-07 01:06:34 +000041
42#
John Kessenich38f3b892013-09-06 19:52:57 +000043# multi-threaded test
44#
John Kessenich38f3b892013-09-06 19:52:57 +000045echo Comparing single thread to multithread for all tests in current directory...
John Kessenicha86836e2016-07-09 14:50:57 -060046$EXE -i -C *.vert *.geom *.frag *.tes* *.comp > singleThread.out
47$EXE -i -C *.vert *.geom *.frag *.tes* *.comp -t > multiThread.out
John Kessenichb38c9692015-05-15 19:01:17 +000048diff singleThread.out multiThread.out || HASERROR=1
John Kessenich4b1a8902017-07-06 11:58:12 -060049if [ $HASERROR -eq 0 ]
50then
51 rm singleThread.out
52 rm multiThread.out
53fi
John Kessenichb38c9692015-05-15 19:01:17 +000054
steve-lunargf1e0c872016-10-31 15:13:43 -060055#
56# entry point renaming tests
57#
John Kessenich906cc212016-12-09 19:22:20 -070058echo Running entry-point renaming tests
59$EXE -i -H -V -D -e main_in_spv --ku --source-entrypoint main hlsl.entry.rename.frag > $TARGETDIR/hlsl.entry.rename.frag.out
steve-lunargf1e0c872016-10-31 15:13:43 -060060diff -b $BASEDIR/hlsl.entry.rename.frag.out $TARGETDIR/hlsl.entry.rename.frag.out || HASERROR=1
61
John Kessenich906cc212016-12-09 19:22:20 -070062#
63# Testing ill-defined uncalled function
64#
65echo Running ill-defined uncalled function
66$EXE -D -e main -H hlsl.deadFunctionMissingBody.vert > $TARGETDIR/hlsl.deadFunctionMissingBody.vert.out
67diff -b $BASEDIR/hlsl.deadFunctionMissingBody.vert.out $TARGETDIR/hlsl.deadFunctionMissingBody.vert.out || HASERROR=1
68
John Kessenich84ea15f2015-05-15 21:54:24 +000069if [ $HASERROR -eq 0 ]
70then
71 echo Tests Succeeded.
72else
73 echo Tests Failed.
74fi
75
John Kesseniche751bca2017-03-16 11:20:38 -060076#
77# Testing -S
78#
79echo Running explicit stage test
80$EXE -i -S vert nosuffix > $TARGETDIR/nosuffix.out
81diff -b $BASEDIR/nosuffix.out $TARGETDIR/nosuffix.out || HASERROR=1
82
John Kessenich4f1403e2017-04-05 17:38:20 -060083#
84# Testing --hlsl-offsets
85#
86echo Running hlsl offsets
87$EXE -i --hlsl-offsets -H spv.hlslOffsets.vert > $TARGETDIR/spv.hlslOffsets.vert.out
88diff -b $BASEDIR/spv.hlslOffsets.vert.out $TARGETDIR/spv.hlslOffsets.vert.out || HASERROR=1
89
90echo Running hlsl offsets
91$EXE -i --hlsl-offsets -D -e main -H hlsl.hlslOffset.vert > $TARGETDIR/hlsl.hlslOffset.vert.out
92diff -b $BASEDIR/hlsl.hlslOffset.vert.out $TARGETDIR/hlsl.hlslOffset.vert.out || HASERROR=1
93
94#
John Kessenich71facdf2017-05-17 18:28:19 -060095# Testing --resource-set-binding
Hyangran Park36dc8292017-05-02 16:27:29 +090096#
97echo Configuring HLSL descriptor set and binding number manually
98$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 Kessenich121853f2017-05-31 17:11:16 -060099diff -b $BASEDIR/hlsl.multiDescriptorSet.frag.out $TARGETDIR/hlsl.multiDescriptorSet.frag.out || HASERROR=1
Hyangran Park36dc8292017-05-02 16:27:29 +0900100
LoopDawg52017192017-07-14 15:15:47 -0600101$EXE -V -D -e main -H hlsl.explicitDescriptorSet.frag --hlsl-iomap --amb --ssb 10 --stb 20 --rsb 4 > $TARGETDIR/hlsl.explicitDescriptorSet.frag.out
102diff -b $BASEDIR/hlsl.explicitDescriptorSet.frag.out $TARGETDIR/hlsl.explicitDescriptorSet.frag.out || HASERROR=1
103
104$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
105diff -b $BASEDIR/hlsl.explicitDescriptorSet-2.frag.out $TARGETDIR/hlsl.explicitDescriptorSet-2.frag.out || HASERROR=1
106
Hyangran Park36dc8292017-05-02 16:27:29 +0900107#
John Kessenich71facdf2017-05-17 18:28:19 -0600108# Testing location error
109#
110echo Testing SPV no location
111$EXE -V -C spv.noLocation.vert > $TARGETDIR/spv.noLocation.vert.out
John Kessenich121853f2017-05-31 17:11:16 -0600112diff -b $BASEDIR/spv.noLocation.vert.out $TARGETDIR/spv.noLocation.vert.out || HASERROR=1
John Kessenich82e95a32017-08-26 15:47:25 -0600113$EXE -G -H --aml spv.noBuiltInLoc.vert > $TARGETDIR/spv.noBuiltInLoc.vert.out
John Kessenich91e69c02017-07-14 05:52:31 -0600114diff -b $BASEDIR/spv.noBuiltInLoc.vert.out $TARGETDIR/spv.noBuiltInLoc.vert.out || HASERROR=1
John Kessenich82e95a32017-08-26 15:47:25 -0600115$EXE -G spv.looseUniformNoLoc.vert > $TARGETDIR/spv.looseUniformNoLoc.vert.out
116diff -b $BASEDIR/spv.looseUniformNoLoc.vert.out $TARGETDIR/spv.looseUniformNoLoc.vert.out || HASERROR=1
John Kessenich121853f2017-05-31 17:11:16 -0600117
118#
119# Testing debug information
120#
121echo Testing SPV Debug Information
John Kessenich2a271162017-07-20 20:00:36 -0600122$EXE -g --relaxed-errors --suppress-warnings --aml --hlsl-offsets --nsf \
123 -G -H spv.debugInfo.frag --rsb frag 3 > $TARGETDIR/spv.debugInfo.frag.out
John Kessenich121853f2017-05-31 17:11:16 -0600124diff -b $BASEDIR/spv.debugInfo.frag.out $TARGETDIR/spv.debugInfo.frag.out || HASERROR=1
John Kessenich2a271162017-07-20 20:00:36 -0600125$EXE -g -D -e newMain -g --amb --aml --fua --hlsl-iomap --nsf --sib 1 --ssb 2 --sbb 3 --stb 4 --suavb 5 --sub 6 \
126 --sep origMain -H spv.hlslDebugInfo.vert --rsb vert t0 0 0 > $TARGETDIR/spv.hlslDebugInfo.frag.out
127diff -b $BASEDIR/spv.hlslDebugInfo.frag.out $TARGETDIR/spv.hlslDebugInfo.frag.out || HASERROR=1
John Kessenich71facdf2017-05-17 18:28:19 -0600128
129#
John Kessenich3494b4d2017-05-22 15:00:42 -0600130# Testing Includer
131#
132echo Testing Includer
133$EXE -D -e main -H ../Test/hlsl.include.vert > $TARGETDIR/hlsl.include.vert.out
134diff -b $BASEDIR/hlsl.include.vert.out $TARGETDIR/hlsl.include.vert.out || HASERROR=1
135$EXE -D -e main -H hlsl.includeNegative.vert > $TARGETDIR/hlsl.includeNegative.vert.out
136diff -b $BASEDIR/hlsl.includeNegative.vert.out $TARGETDIR/hlsl.includeNegative.vert.out || HASERROR=1
137$EXE -l -i include.vert > $TARGETDIR/include.vert.out
138diff -b $BASEDIR/include.vert.out $TARGETDIR/include.vert.out || HASERROR=1
John Kessenich971a0a82017-06-07 15:06:58 -0600139$EXE -D -e main -H -Iinc1/path1 -Iinc1/path2 hlsl.dashI.vert > $TARGETDIR/hlsl.dashI.vert.out
140diff -b $BASEDIR/hlsl.dashI.vert.out $TARGETDIR/hlsl.dashI.vert.out || HASERROR=1
John Kessenich3494b4d2017-05-22 15:00:42 -0600141
142#
John Kessenicha9313662017-06-15 10:40:49 -0600143# Testing -D and -U
144#
LoopDawg8004d362017-09-17 10:38:52 -0600145echo "Testing -D and -U"
John Kessenicha9313662017-06-15 10:40:49 -0600146$EXE -DUNDEFED -UIN_SHADER -DFOO=200 -i -l -UUNDEFED -DMUL=FOO*2 glsl.-D-U.frag > $TARGETDIR/glsl.-D-U.frag.out
147diff -b $BASEDIR/glsl.-D-U.frag.out $TARGETDIR/glsl.-D-U.frag.out || HASERROR=1
148$EXE -D -e main -V -i -DUNDEFED -UIN_SHADER -DFOO=200 -UUNDEFED hlsl.-D-U.frag > $TARGETDIR/hlsl.-D-U.frag.out
149diff -b $BASEDIR/hlsl.-D-U.frag.out $TARGETDIR/hlsl.-D-U.frag.out || HASERROR=1
150
151#
John Kessenich6353d552017-06-23 11:11:09 -0600152# Test --client and --target-env
153#
LoopDawg8004d362017-09-17 10:38:52 -0600154echo "Testing --client and --target-env"
John Kessenich6353d552017-06-23 11:11:09 -0600155$EXE --client vulkan100 spv.targetVulkan.vert || HASERROR=1
156$EXE --client opengl100 spv.targetOpenGL.vert || HASERROR=1
157$EXE --target-env vulkan1.0 spv.targetVulkan.vert || HASERROR=1
158$EXE --target-env opengl spv.targetOpenGL.vert || HASERROR=1
159$EXE -V100 spv.targetVulkan.vert || HASERROR=1
160$EXE -G100 spv.targetOpenGL.vert || HASERROR=1
161
162#
John Kessenich9855bda2017-09-11 21:48:19 -0600163# Testing GLSL entry point rename
164#
LoopDawg8004d362017-09-17 10:38:52 -0600165echo "Testing GLSL entry point rename"
John Kessenich9855bda2017-09-11 21:48:19 -0600166$EXE -H -e foo --source-entrypoint main glsl.entryPointRename.vert > $TARGETDIR/glsl.entryPointRename.vert.out
167diff -b $BASEDIR/glsl.entryPointRename.vert.out $TARGETDIR/glsl.entryPointRename.vert.out || HASERROR=1
168$EXE -H -e foo --source-entrypoint bar glsl.entryPointRename.vert > $TARGETDIR/glsl.entryPointRename.vert.bad.out
169diff -b $BASEDIR/glsl.entryPointRename.vert.bad.out $TARGETDIR/glsl.entryPointRename.vert.bad.out || HASERROR=1
170$EXE -H -e foo --source-entrypoint main glsl.entryPointRename2.vert > $TARGETDIR/glsl.entryPointRename2.vert.out
171diff -b $BASEDIR/glsl.entryPointRename2.vert.out $TARGETDIR/glsl.entryPointRename2.vert.out || HASERROR=1
172
173#
LoopDawg8004d362017-09-17 10:38:52 -0600174# Testing remapper error handling
175#
176echo "Testing remapper error handling"
177$REMAPEXE --do-everything -i remap.invalid-spirv-1.spv -o $TARGETDIR > $TARGETDIR/remap.invalid-spirv-1.out && HASERROR=1
178diff -b $BASEDIR/remap.invalid-spirv-1.out $TARGETDIR/remap.invalid-spirv-1.out || HASERROR=1
179$REMAPEXE --do-everything -i remap.invalid-spirv-2.spv -o $TARGETDIR > $TARGETDIR/remap.invalid-spirv-2.out && HASERROR=1
180diff -b $BASEDIR/remap.invalid-spirv-2.out $TARGETDIR/remap.invalid-spirv-2.out || HASERROR=1
181
182#
John Kessenich4f1403e2017-04-05 17:38:20 -0600183# Final checking
184#
John Kesseniche751bca2017-03-16 11:20:38 -0600185if [ $HASERROR -eq 0 ]
186then
187 echo Tests Succeeded.
188else
189 echo Tests Failed.
190fi
191
John Kessenich4b1a8902017-07-06 11:58:12 -0600192rm -f comp.spv frag.spv geom.spv tesc.spv tese.spv vert.spv
193
John Kessenichb38c9692015-05-15 19:01:17 +0000194exit $HASERROR