blob: c5a93378f13e96f1afdb2ee47fed7efecfdaf3b4 [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
John Kessenichb38c9692015-05-15 19:01:17 +00006HASERROR=0
John Kessenich08d18242013-12-20 18:36:27 +00007mkdir -p localResults
John Kessenich69f4b512013-09-04 21:19:27 +00008
John Kessenichcf0206c2014-04-14 15:46:40 +00009if [ -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 Kessenichb38c9692015-05-15 19:01:17 +000015 diff -b $BASEDIR/$b.out $TARGETDIR/$b.out || HASERROR=1
John Kessenichcf0206c2014-04-14 15:46:40 +000016 done < localtestlist
17fi
18
johnkslang02ad18a2015-06-26 00:12:31 -060019rm -f comp.spv frag.spv geom.spv tesc.spv tese.spv vert.spv
John Kessenich593a3f72015-05-15 18:44:16 +000020
21#
John Kessenich31a51be2016-07-19 14:32:52 -060022# special tests
23#
24
25$EXE badMacroArgs.frag > $TARGETDIR/badMacroArgs.frag.out
26diff -b $BASEDIR/badMacroArgs.frag.out $TARGETDIR/badMacroArgs.frag.out || HASERROR=1
27
28#
John Kessenich11f9fc72013-11-07 01:06:34 +000029# reflection tests
30#
31echo Running reflection...
John Kessenicha86836e2016-07-09 14:50:57 -060032$EXE -l -q -C reflection.vert > $TARGETDIR/reflection.vert.out
John Kessenichb38c9692015-05-15 19:01:17 +000033diff -b $BASEDIR/reflection.vert.out $TARGETDIR/reflection.vert.out || HASERROR=1
John Kessenich2572b192016-09-19 23:12:48 -060034$EXE -D -e flizv -l -q -C -V hlsl.reflection.vert > $TARGETDIR/hlsl.reflection.vert.out
35diff -b $BASEDIR/hlsl.reflection.vert.out $TARGETDIR/hlsl.reflection.vert.out || HASERROR=1
steve-lunarg8ffc36a2016-09-21 14:19:40 -060036$EXE -D -e main -l -q -C -V hlsl.reflection.binding.frag > $TARGETDIR/hlsl.reflection.binding.frag.out
37diff -b $BASEDIR/hlsl.reflection.binding.frag.out $TARGETDIR/hlsl.reflection.binding.frag.out || HASERROR=1
steve-lunargbe283552017-04-18 12:18:01 -060038$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
39diff -b $BASEDIR/hlsl.automap.frag.out $TARGETDIR/hlsl.automap.frag.out || HASERROR=1
John Kessenich11f9fc72013-11-07 01:06:34 +000040
41#
John Kessenich38f3b892013-09-06 19:52:57 +000042# multi-threaded test
43#
John Kessenich38f3b892013-09-06 19:52:57 +000044echo Comparing single thread to multithread for all tests in current directory...
John Kessenicha86836e2016-07-09 14:50:57 -060045$EXE -i -C *.vert *.geom *.frag *.tes* *.comp > singleThread.out
46$EXE -i -C *.vert *.geom *.frag *.tes* *.comp -t > multiThread.out
John Kessenichb38c9692015-05-15 19:01:17 +000047diff singleThread.out multiThread.out || HASERROR=1
John Kessenich4b1a8902017-07-06 11:58:12 -060048if [ $HASERROR -eq 0 ]
49then
50 rm singleThread.out
51 rm multiThread.out
52fi
John Kessenichb38c9692015-05-15 19:01:17 +000053
steve-lunargf1e0c872016-10-31 15:13:43 -060054#
55# entry point renaming tests
56#
John Kessenich906cc212016-12-09 19:22:20 -070057echo 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-lunargf1e0c872016-10-31 15:13:43 -060059diff -b $BASEDIR/hlsl.entry.rename.frag.out $TARGETDIR/hlsl.entry.rename.frag.out || HASERROR=1
60
John Kessenich906cc212016-12-09 19:22:20 -070061#
62# Testing ill-defined uncalled function
63#
64echo Running ill-defined uncalled function
65$EXE -D -e main -H hlsl.deadFunctionMissingBody.vert > $TARGETDIR/hlsl.deadFunctionMissingBody.vert.out
66diff -b $BASEDIR/hlsl.deadFunctionMissingBody.vert.out $TARGETDIR/hlsl.deadFunctionMissingBody.vert.out || HASERROR=1
67
John Kessenich84ea15f2015-05-15 21:54:24 +000068if [ $HASERROR -eq 0 ]
69then
70 echo Tests Succeeded.
71else
72 echo Tests Failed.
73fi
74
John Kesseniche751bca2017-03-16 11:20:38 -060075#
76# Testing -S
77#
78echo Running explicit stage test
79$EXE -i -S vert nosuffix > $TARGETDIR/nosuffix.out
80diff -b $BASEDIR/nosuffix.out $TARGETDIR/nosuffix.out || HASERROR=1
81
John Kessenich4f1403e2017-04-05 17:38:20 -060082#
83# Testing --hlsl-offsets
84#
85echo Running hlsl offsets
86$EXE -i --hlsl-offsets -H spv.hlslOffsets.vert > $TARGETDIR/spv.hlslOffsets.vert.out
87diff -b $BASEDIR/spv.hlslOffsets.vert.out $TARGETDIR/spv.hlslOffsets.vert.out || HASERROR=1
88
89echo Running hlsl offsets
90$EXE -i --hlsl-offsets -D -e main -H hlsl.hlslOffset.vert > $TARGETDIR/hlsl.hlslOffset.vert.out
91diff -b $BASEDIR/hlsl.hlslOffset.vert.out $TARGETDIR/hlsl.hlslOffset.vert.out || HASERROR=1
92
93#
John Kessenich71facdf2017-05-17 18:28:19 -060094# Testing --resource-set-binding
Hyangran Park36dc8292017-05-02 16:27:29 +090095#
96echo 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 Kessenich121853f2017-05-31 17:11:16 -060098diff -b $BASEDIR/hlsl.multiDescriptorSet.frag.out $TARGETDIR/hlsl.multiDescriptorSet.frag.out || HASERROR=1
Hyangran Park36dc8292017-05-02 16:27:29 +090099
LoopDawg52017192017-07-14 15:15:47 -0600100$EXE -V -D -e main -H hlsl.explicitDescriptorSet.frag --hlsl-iomap --amb --ssb 10 --stb 20 --rsb 4 > $TARGETDIR/hlsl.explicitDescriptorSet.frag.out
101diff -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
104diff -b $BASEDIR/hlsl.explicitDescriptorSet-2.frag.out $TARGETDIR/hlsl.explicitDescriptorSet-2.frag.out || HASERROR=1
105
Hyangran Park36dc8292017-05-02 16:27:29 +0900106#
John Kessenich71facdf2017-05-17 18:28:19 -0600107# Testing location error
108#
109echo Testing SPV no location
110$EXE -V -C spv.noLocation.vert > $TARGETDIR/spv.noLocation.vert.out
John Kessenich121853f2017-05-31 17:11:16 -0600111diff -b $BASEDIR/spv.noLocation.vert.out $TARGETDIR/spv.noLocation.vert.out || HASERROR=1
John Kessenich91e69c02017-07-14 05:52:31 -0600112$EXE -H --aml spv.noBuiltInLoc.vert > $TARGETDIR/spv.noBuiltInLoc.vert.out
113diff -b $BASEDIR/spv.noBuiltInLoc.vert.out $TARGETDIR/spv.noBuiltInLoc.vert.out || HASERROR=1
John Kessenich121853f2017-05-31 17:11:16 -0600114
115#
116# Testing debug information
117#
118echo Testing SPV Debug Information
119$EXE -g -H spv.debugInfo.frag > $TARGETDIR/spv.debugInfo.frag.out
120diff -b $BASEDIR/spv.debugInfo.frag.out $TARGETDIR/spv.debugInfo.frag.out || HASERROR=1
John Kessenich71facdf2017-05-17 18:28:19 -0600121
122#
John Kessenich3494b4d2017-05-22 15:00:42 -0600123# Testing Includer
124#
125echo Testing Includer
126$EXE -D -e main -H ../Test/hlsl.include.vert > $TARGETDIR/hlsl.include.vert.out
127diff -b $BASEDIR/hlsl.include.vert.out $TARGETDIR/hlsl.include.vert.out || HASERROR=1
128$EXE -D -e main -H hlsl.includeNegative.vert > $TARGETDIR/hlsl.includeNegative.vert.out
129diff -b $BASEDIR/hlsl.includeNegative.vert.out $TARGETDIR/hlsl.includeNegative.vert.out || HASERROR=1
130$EXE -l -i include.vert > $TARGETDIR/include.vert.out
131diff -b $BASEDIR/include.vert.out $TARGETDIR/include.vert.out || HASERROR=1
John Kessenich971a0a82017-06-07 15:06:58 -0600132$EXE -D -e main -H -Iinc1/path1 -Iinc1/path2 hlsl.dashI.vert > $TARGETDIR/hlsl.dashI.vert.out
133diff -b $BASEDIR/hlsl.dashI.vert.out $TARGETDIR/hlsl.dashI.vert.out || HASERROR=1
John Kessenich3494b4d2017-05-22 15:00:42 -0600134
135#
John Kessenicha9313662017-06-15 10:40:49 -0600136# Testing -D and -U
137#
138$EXE -DUNDEFED -UIN_SHADER -DFOO=200 -i -l -UUNDEFED -DMUL=FOO*2 glsl.-D-U.frag > $TARGETDIR/glsl.-D-U.frag.out
139diff -b $BASEDIR/glsl.-D-U.frag.out $TARGETDIR/glsl.-D-U.frag.out || HASERROR=1
140$EXE -D -e main -V -i -DUNDEFED -UIN_SHADER -DFOO=200 -UUNDEFED hlsl.-D-U.frag > $TARGETDIR/hlsl.-D-U.frag.out
141diff -b $BASEDIR/hlsl.-D-U.frag.out $TARGETDIR/hlsl.-D-U.frag.out || HASERROR=1
142
143#
John Kessenich6353d552017-06-23 11:11:09 -0600144# Test --client and --target-env
145#
146$EXE --client vulkan100 spv.targetVulkan.vert || HASERROR=1
147$EXE --client opengl100 spv.targetOpenGL.vert || HASERROR=1
148$EXE --target-env vulkan1.0 spv.targetVulkan.vert || HASERROR=1
149$EXE --target-env opengl spv.targetOpenGL.vert || HASERROR=1
150$EXE -V100 spv.targetVulkan.vert || HASERROR=1
151$EXE -G100 spv.targetOpenGL.vert || HASERROR=1
152
153#
John Kessenich4f1403e2017-04-05 17:38:20 -0600154# Final checking
155#
John Kesseniche751bca2017-03-16 11:20:38 -0600156if [ $HASERROR -eq 0 ]
157then
158 echo Tests Succeeded.
159else
160 echo Tests Failed.
161fi
162
John Kessenich4b1a8902017-07-06 11:58:12 -0600163rm -f comp.spv frag.spv geom.spv tesc.spv tese.spv vert.spv
164
John Kessenichb38c9692015-05-15 19:01:17 +0000165exit $HASERROR