xref: /third_party/glslang/Test/runtests (revision 617a3bab)
1617a3babSopenharmony_ci#!/usr/bin/env bash
2617a3babSopenharmony_ci
3617a3babSopenharmony_ci# Arguments:
4617a3babSopenharmony_ci#  1- TargetDirectory, where to write test results and intermediary files
5617a3babSopenharmony_ci#  2- Path to glslang
6617a3babSopenharmony_ci#  3- Path to spirv-remap
7617a3babSopenharmony_ci
8617a3babSopenharmony_ciTARGETDIR=${1:-localResults}
9617a3babSopenharmony_ciBASEDIR=baseResults
10617a3babSopenharmony_ciEXE=${2:-../build/install/bin/glslang}
11617a3babSopenharmony_ciREMAPEXE=${3:-../build/install/bin/spirv-remap}
12617a3babSopenharmony_ciHASERROR=0
13617a3babSopenharmony_cimkdir -p $TARGETDIR
14617a3babSopenharmony_ci
15617a3babSopenharmony_ciLIBPATH="$(cd "$(dirname "$(dirname $EXE)")" && pwd)/lib"
16617a3babSopenharmony_ciif [ -d "${LIBPATH}" ]; then
17617a3babSopenharmony_ci    export LD_LIBRARY_PATH="${LIBPATH}:${LD_LIBRARY_PATH}" 
18617a3babSopenharmony_cifi
19617a3babSopenharmony_ci
20617a3babSopenharmony_cifunction run {
21617a3babSopenharmony_ci    $EXE "$@"
22617a3babSopenharmony_ci    result=$?
23617a3babSopenharmony_ci    case "$result" in
24617a3babSopenharmony_ci    [0-6]) # Valid success and error codes
25617a3babSopenharmony_ci        return
26617a3babSopenharmony_ci    ;;
27617a3babSopenharmony_ci    *)
28617a3babSopenharmony_ci        echo "$EXE returned $result"
29617a3babSopenharmony_ci        HASERROR=1
30617a3babSopenharmony_ci    esac
31617a3babSopenharmony_ci}
32617a3babSopenharmony_ci
33617a3babSopenharmony_ciif [ -a localtestlist ]
34617a3babSopenharmony_ci  then
35617a3babSopenharmony_ci    while read t; do
36617a3babSopenharmony_ci        echo Running $t...
37617a3babSopenharmony_ci        b=`basename $t`
38617a3babSopenharmony_ci        run -i -l $t > $TARGETDIR/$b.out
39617a3babSopenharmony_ci        diff -b $BASEDIR/$b.out $TARGETDIR/$b.out || HASERROR=1
40617a3babSopenharmony_ci    done < localtestlist
41617a3babSopenharmony_cifi
42617a3babSopenharmony_ci
43617a3babSopenharmony_cirm -f comp.spv frag.spv geom.spv tesc.spv tese.spv vert.spv
44617a3babSopenharmony_ci
45617a3babSopenharmony_ci#
46617a3babSopenharmony_ci# special tests
47617a3babSopenharmony_ci#
48617a3babSopenharmony_ci
49617a3babSopenharmony_cirun badMacroArgs.frag > $TARGETDIR/badMacroArgs.frag.out
50617a3babSopenharmony_cidiff -b $BASEDIR/badMacroArgs.frag.out $TARGETDIR/badMacroArgs.frag.out || HASERROR=1
51617a3babSopenharmony_ci
52617a3babSopenharmony_ci#
53617a3babSopenharmony_ci# reflection tests
54617a3babSopenharmony_ci#
55617a3babSopenharmony_ciecho Running reflection...
56617a3babSopenharmony_cirun -l -q -C reflection.vert > $TARGETDIR/reflection.vert.out
57617a3babSopenharmony_cidiff -b $BASEDIR/reflection.vert.out $TARGETDIR/reflection.vert.out || HASERROR=1
58617a3babSopenharmony_cirun -l -q -C --reflect-strict-array-suffix --reflect-basic-array-suffix --reflect-intermediate-io --reflect-separate-buffers --reflect-all-block-variables --reflect-unwrap-io-blocks --reflect-all-io-variables --reflect-shared-std140-ubo --reflect-shared-std140-ssbo reflection.options.vert > $TARGETDIR/reflection.options.vert.out
59617a3babSopenharmony_cidiff -b $BASEDIR/reflection.options.vert.out $TARGETDIR/reflection.options.vert.out || HASERROR=1
60617a3babSopenharmony_cirun -l -q -C reflection.frag > $TARGETDIR/reflection.frag.out
61617a3babSopenharmony_cidiff -b $BASEDIR/reflection.frag.out $TARGETDIR/reflection.frag.out || HASERROR=1
62617a3babSopenharmony_cirun -l -q -C --reflect-strict-array-suffix --reflect-basic-array-suffix --reflect-intermediate-io --reflect-separate-buffers --reflect-all-block-variables --reflect-unwrap-io-blocks --reflect-all-io-variables --reflect-shared-std140-ubo --reflect-shared-std140-ssbo reflection.frag > $TARGETDIR/reflection.options.frag.out
63617a3babSopenharmony_cidiff -b $BASEDIR/reflection.options.frag.out $TARGETDIR/reflection.options.frag.out || HASERROR=1
64617a3babSopenharmony_cirun -l -q -C --reflect-strict-array-suffix --reflect-basic-array-suffix --reflect-intermediate-io --reflect-separate-buffers --reflect-all-block-variables --reflect-unwrap-io-blocks --reflect-all-io-variables --reflect-shared-std140-ubo --reflect-shared-std140-ssbo reflection.options.geom > $TARGETDIR/reflection.options.geom.out
65617a3babSopenharmony_cidiff -b $BASEDIR/reflection.options.geom.out $TARGETDIR/reflection.options.geom.out || HASERROR=1
66617a3babSopenharmony_cirun -l -q -C reflection.linked.vert reflection.linked.frag > $TARGETDIR/reflection.linked.out
67617a3babSopenharmony_cidiff -b $BASEDIR/reflection.linked.out $TARGETDIR/reflection.linked.out || HASERROR=1
68617a3babSopenharmony_cirun -l -q -C --reflect-strict-array-suffix --reflect-basic-array-suffix --reflect-intermediate-io --reflect-separate-buffers --reflect-all-block-variables --reflect-unwrap-io-blocks --reflect-all-io-variables --reflect-shared-std140-ubo --reflect-shared-std140-ssbo reflection.linked.vert reflection.linked.frag > $TARGETDIR/reflection.linked.options.out
69617a3babSopenharmony_cidiff -b $BASEDIR/reflection.linked.options.out $TARGETDIR/reflection.linked.options.out || HASERROR=1
70617a3babSopenharmony_cirun -D -Od -e flizv -l -q -C -V -Od hlsl.reflection.vert > $TARGETDIR/hlsl.reflection.vert.out
71617a3babSopenharmony_cidiff -b $BASEDIR/hlsl.reflection.vert.out $TARGETDIR/hlsl.reflection.vert.out || HASERROR=1
72617a3babSopenharmony_cirun -D -Od -e main -l -q -C -V -Od hlsl.reflection.binding.frag > $TARGETDIR/hlsl.reflection.binding.frag.out
73617a3babSopenharmony_cidiff -b $BASEDIR/hlsl.reflection.binding.frag.out $TARGETDIR/hlsl.reflection.binding.frag.out || HASERROR=1
74617a3babSopenharmony_cirun -D -Od -e main -l -q --hlsl-iomap --auto-map-bindings --stb 10 --sbb 20 --ssb 30 --suavb 40 --scb 50 -D -V -e main -Od hlsl.automap.frag > $TARGETDIR/hlsl.automap.frag.out
75617a3babSopenharmony_cidiff -b $BASEDIR/hlsl.automap.frag.out $TARGETDIR/hlsl.automap.frag.out || HASERROR=1
76617a3babSopenharmony_ci
77617a3babSopenharmony_ci#
78617a3babSopenharmony_ci# multi-threaded test
79617a3babSopenharmony_ci#
80617a3babSopenharmony_ciecho Comparing single thread to multithread for all tests in current directory...
81617a3babSopenharmony_cirun -i -C *.vert *.geom *.frag *.tesc *.tese *.comp > $TARGETDIR/singleThread.out
82617a3babSopenharmony_cirun -i -C *.vert *.geom *.frag *.tesc *.tese *.comp -t > $TARGETDIR/multiThread.out
83617a3babSopenharmony_cidiff $TARGETDIR/singleThread.out $TARGETDIR/multiThread.out || HASERROR=1
84617a3babSopenharmony_ciif [ $HASERROR -eq 0 ]
85617a3babSopenharmony_cithen
86617a3babSopenharmony_ci    rm $TARGETDIR/singleThread.out
87617a3babSopenharmony_ci    rm $TARGETDIR/multiThread.out
88617a3babSopenharmony_cifi
89617a3babSopenharmony_ci
90617a3babSopenharmony_ci#
91617a3babSopenharmony_ci# entry point renaming tests
92617a3babSopenharmony_ci#
93617a3babSopenharmony_ciecho Running entry-point renaming tests
94617a3babSopenharmony_cirun -i -H -V -D -Od --entry-point main_in_spv --ku --source-entrypoint main -Od hlsl.entry.rename.frag > $TARGETDIR/hlsl.entry.rename.frag.out
95617a3babSopenharmony_cidiff -b $BASEDIR/hlsl.entry.rename.frag.out $TARGETDIR/hlsl.entry.rename.frag.out || HASERROR=1
96617a3babSopenharmony_ci
97617a3babSopenharmony_ci#
98617a3babSopenharmony_ci# Testing ill-defined uncalled function
99617a3babSopenharmony_ci#
100617a3babSopenharmony_ciecho Running ill-defined uncalled function
101617a3babSopenharmony_cirun -D -Od -e main -H -Od hlsl.deadFunctionMissingBody.vert > $TARGETDIR/hlsl.deadFunctionMissingBody.vert.out
102617a3babSopenharmony_cidiff -b $BASEDIR/hlsl.deadFunctionMissingBody.vert.out $TARGETDIR/hlsl.deadFunctionMissingBody.vert.out || HASERROR=1
103617a3babSopenharmony_ci
104617a3babSopenharmony_ciif [ $HASERROR -eq 0 ]
105617a3babSopenharmony_cithen
106617a3babSopenharmony_ci    echo Tests Succeeded.
107617a3babSopenharmony_cielse
108617a3babSopenharmony_ci    echo Tests Failed.
109617a3babSopenharmony_cifi
110617a3babSopenharmony_ci
111617a3babSopenharmony_ci#
112617a3babSopenharmony_ci# Testing -S and compound suffixes
113617a3babSopenharmony_ci#
114617a3babSopenharmony_ciecho Running explicit stage test and compound suffix tests
115617a3babSopenharmony_cirun -Od -i -S vert nosuffix > $TARGETDIR/nosuffix.out
116617a3babSopenharmony_cidiff -b $BASEDIR/nosuffix.out $TARGETDIR/nosuffix.out || HASERROR=1
117617a3babSopenharmony_cirun -Od -i compoundsuffix.vert.glsl > $TARGETDIR/compoundsuffix.vert.glsl
118617a3babSopenharmony_cidiff -b $BASEDIR/compoundsuffix.vert.glsl $TARGETDIR/compoundsuffix.vert.glsl || HASERROR=1
119617a3babSopenharmony_cirun -Od -e main -H compoundsuffix.frag.hlsl > $TARGETDIR/compoundsuffix.frag.hlsl
120617a3babSopenharmony_cidiff -b $BASEDIR/compoundsuffix.frag.hlsl $TARGETDIR/compoundsuffix.frag.hlsl || HASERROR=1
121617a3babSopenharmony_ci
122617a3babSopenharmony_ci#
123617a3babSopenharmony_ci# Testing --hlsl-offsets
124617a3babSopenharmony_ci#
125617a3babSopenharmony_ciecho Running hlsl offsets
126617a3babSopenharmony_cirun -i --hlsl-offsets -H spv.hlslOffsets.vert > $TARGETDIR/spv.hlslOffsets.vert.out
127617a3babSopenharmony_cidiff -b $BASEDIR/spv.hlslOffsets.vert.out $TARGETDIR/spv.hlslOffsets.vert.out || HASERROR=1
128617a3babSopenharmony_ci
129617a3babSopenharmony_ciecho Running hlsl offsets
130617a3babSopenharmony_cirun -i  --hlsl-offsets -D -Od -e main -H -Od hlsl.hlslOffset.vert > $TARGETDIR/hlsl.hlslOffset.vert.out
131617a3babSopenharmony_cidiff -b $BASEDIR/hlsl.hlslOffset.vert.out $TARGETDIR/hlsl.hlslOffset.vert.out || HASERROR=1
132617a3babSopenharmony_ci
133617a3babSopenharmony_ci#
134617a3babSopenharmony_ci# Testing --resource-set-binding
135617a3babSopenharmony_ci#
136617a3babSopenharmony_ciecho Configuring HLSL descriptor set and binding number manually
137617a3babSopenharmony_cirun -V -D -Od -e main -H -Od 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
138617a3babSopenharmony_cidiff -b $BASEDIR/hlsl.multiDescriptorSet.frag.out $TARGETDIR/hlsl.multiDescriptorSet.frag.out || HASERROR=1
139617a3babSopenharmony_ci
140617a3babSopenharmony_cirun -V -D -Od -e main -H -Od hlsl.explicitDescriptorSet.frag --hlsl-iomap --amb --ssb 10 --stb 20 --rsb 4 > $TARGETDIR/hlsl.explicitDescriptorSet.frag.out
141617a3babSopenharmony_cidiff -b $BASEDIR/hlsl.explicitDescriptorSet.frag.out $TARGETDIR/hlsl.explicitDescriptorSet.frag.out || HASERROR=1
142617a3babSopenharmony_ci
143617a3babSopenharmony_cirun -V -D -Od -e main -H -Od hlsl.explicitDescriptorSet.frag --hlsl-iomap --amb --ssb 10 --stb 20 --rsb frag 3 > $TARGETDIR/hlsl.explicitDescriptorSet-2.frag.out
144617a3babSopenharmony_cidiff -b $BASEDIR/hlsl.explicitDescriptorSet-2.frag.out $TARGETDIR/hlsl.explicitDescriptorSet-2.frag.out || HASERROR=1
145617a3babSopenharmony_ci
146617a3babSopenharmony_ci#
147617a3babSopenharmony_ci# Testing per-descriptor-set IO map shift
148617a3babSopenharmony_ci#
149617a3babSopenharmony_ciecho 'Testing per-descriptor-set IO map shift'
150617a3babSopenharmony_cirun -e main --hlsl-iomap --ssb 10 1 15 2 --stb 20 --stb 25 2 --stb 70 6 --suavb 30 --suavb 40 2 --sub 50 6 -i -q -D -Od -V hlsl.shift.per-set.frag > $TARGETDIR/hlsl.shift.per-set.frag.out || HASERROR=1
151617a3babSopenharmony_cidiff -b $BASEDIR/hlsl.shift.per-set.frag.out $TARGETDIR/hlsl.shift.per-set.frag.out || HASERROR=1
152617a3babSopenharmony_ci
153617a3babSopenharmony_ci#
154617a3babSopenharmony_ci# Testing location error
155617a3babSopenharmony_ci#
156617a3babSopenharmony_ciecho Testing SPV no location
157617a3babSopenharmony_cirun -V -C spv.noLocation.vert > $TARGETDIR/spv.noLocation.vert.out
158617a3babSopenharmony_cidiff -b $BASEDIR/spv.noLocation.vert.out $TARGETDIR/spv.noLocation.vert.out || HASERROR=1
159617a3babSopenharmony_cirun -G -H --aml spv.noBuiltInLoc.vert > $TARGETDIR/spv.noBuiltInLoc.vert.out
160617a3babSopenharmony_cidiff -b $BASEDIR/spv.noBuiltInLoc.vert.out $TARGETDIR/spv.noBuiltInLoc.vert.out || HASERROR=1
161617a3babSopenharmony_cirun -G spv.looseUniformNoLoc.vert > $TARGETDIR/spv.looseUniformNoLoc.vert.out
162617a3babSopenharmony_cidiff -b $BASEDIR/spv.looseUniformNoLoc.vert.out $TARGETDIR/spv.looseUniformNoLoc.vert.out || HASERROR=1
163617a3babSopenharmony_ci
164617a3babSopenharmony_ci#
165617a3babSopenharmony_ci# Testing debug information
166617a3babSopenharmony_ci#
167617a3babSopenharmony_ciecho Testing SPV Debug Information
168617a3babSopenharmony_cirun -g --relaxed-errors --suppress-warnings --aml --amb --hlsl-offsets --nsf --spirv-val \
169617a3babSopenharmony_ci     -G -H spv.debugInfo.frag --rsb frag 3 > $TARGETDIR/spv.debugInfo.frag.out
170617a3babSopenharmony_cidiff -b $BASEDIR/spv.debugInfo.frag.out $TARGETDIR/spv.debugInfo.frag.out || HASERROR=1
171617a3babSopenharmony_cirun -g -Od --target-env vulkan1.1 --relaxed-errors --suppress-warnings --aml --amb --hlsl-offsets --nsf --spirv-val \
172617a3babSopenharmony_ci     -V -H spv.debugInfo.frag --rsb frag 3 > $TARGETDIR/spv.debugInfo.1.1.frag.out
173617a3babSopenharmony_cidiff -b $BASEDIR/spv.debugInfo.1.1.frag.out $TARGETDIR/spv.debugInfo.1.1.frag.out || HASERROR=1
174617a3babSopenharmony_cirun -g -D -Od -e newMain -g --amb --aml --fua --hlsl-iomap --nsf --spirv-val --sib 1 --ssb 2 --sbb 3 --stb 4 --suavb 5 --sub 6 \
175617a3babSopenharmony_ci     --sep origMain -H -Od spv.hlslDebugInfo.vert --rsb vert t0 0 0 > $TARGETDIR/spv.hlslDebugInfo.frag.out
176617a3babSopenharmony_cidiff -b $BASEDIR/spv.hlslDebugInfo.frag.out $TARGETDIR/spv.hlslDebugInfo.frag.out || HASERROR=1
177617a3babSopenharmony_ci
178617a3babSopenharmony_ci#
179617a3babSopenharmony_ci# Testing Includer
180617a3babSopenharmony_ci#
181617a3babSopenharmony_ciecho Testing Includer
182617a3babSopenharmony_cirun -D -Od -e main -H -Od ../Test/hlsl.include.vert > $TARGETDIR/hlsl.include.vert.out
183617a3babSopenharmony_cidiff -b $BASEDIR/hlsl.include.vert.out $TARGETDIR/hlsl.include.vert.out || HASERROR=1
184617a3babSopenharmony_cirun -D -Od -e main -H -Od hlsl.includeNegative.vert > $TARGETDIR/hlsl.includeNegative.vert.out
185617a3babSopenharmony_cidiff -b $BASEDIR/hlsl.includeNegative.vert.out $TARGETDIR/hlsl.includeNegative.vert.out || HASERROR=1
186617a3babSopenharmony_cirun -l -i include.vert > $TARGETDIR/include.vert.out
187617a3babSopenharmony_cidiff -b $BASEDIR/include.vert.out $TARGETDIR/include.vert.out || HASERROR=1
188617a3babSopenharmony_cirun -D -Od -e main -H -Od -Iinc1/path1 -Iinc1/path2 hlsl.dashI.vert > $TARGETDIR/hlsl.dashI.vert.out
189617a3babSopenharmony_cidiff -b $BASEDIR/hlsl.dashI.vert.out $TARGETDIR/hlsl.dashI.vert.out || HASERROR=1
190617a3babSopenharmony_cirun -D -Od -e MainPs -H -Od -g hlsl.pp.line3.frag > $TARGETDIR/hlsl.pp.line3.frag.out
191617a3babSopenharmony_cidiff -b $BASEDIR/hlsl.pp.line3.frag.out $TARGETDIR/hlsl.pp.line3.frag.out || HASERROR=1
192617a3babSopenharmony_ci
193617a3babSopenharmony_ci#
194617a3babSopenharmony_ci# Testing --depfile
195617a3babSopenharmony_ci#
196617a3babSopenharmony_ci
197617a3babSopenharmony_ciecho "Testing --depfile"
198617a3babSopenharmony_cirun -D -Od -e main -H --depfile $TARGETDIR/hlsl.include.vert.d.out -Od ../Test/hlsl.include.vert > $TARGETDIR/hlsl.include.vert.out
199617a3babSopenharmony_cidiff -b $BASEDIR/hlsl.include.vert.d.out $TARGETDIR/hlsl.include.vert.d.out || HASERROR=1
200617a3babSopenharmony_cirun -D -Od -e main -H --depfile $TARGETDIR/hlsl.dashI.vert.d.out -Od -Iinc1/path1 -Iinc1/path2 hlsl.dashI.vert > $TARGETDIR/hlsl.dashI.vert.out
201617a3babSopenharmony_cidiff -b $BASEDIR/hlsl.dashI.vert.d.out $TARGETDIR/hlsl.dashI.vert.d.out || HASERROR=1
202617a3babSopenharmony_ci
203617a3babSopenharmony_ci#
204617a3babSopenharmony_ci# Testing -D, -U and -P
205617a3babSopenharmony_ci#
206617a3babSopenharmony_ciecho "Testing -D, -U and -P"
207617a3babSopenharmony_cirun -DUNDEFED -UIN_SHADER -DFOO=200 -i -l --U UNDEFED --define-macro MUL=FOO*2 glsl.-D-U.frag > $TARGETDIR/glsl.-D-U.frag.out
208617a3babSopenharmony_cidiff -b $BASEDIR/glsl.-D-U.frag.out $TARGETDIR/glsl.-D-U.frag.out || HASERROR=1
209617a3babSopenharmony_cirun -D -Od -e main -V -i -DUNDEFED -UIN_SHADER --D FOO=200 --undef-macro UNDEFED -Od hlsl.-D-U.frag > $TARGETDIR/hlsl.-D-U.frag.out
210617a3babSopenharmony_cidiff -b $BASEDIR/hlsl.-D-U.frag.out $TARGETDIR/hlsl.-D-U.frag.out || HASERROR=1
211617a3babSopenharmony_cirun -P"#define TEST1" -i -l --preamble-text "#define TEST2" --p "#define TEST3" glsl.-P.frag > $TARGETDIR/glsl.-P.frag.out
212617a3babSopenharmony_cidiff -b $BASEDIR/glsl.-P.frag.out $TARGETDIR/glsl.-P.frag.out || HASERROR=1
213617a3babSopenharmony_cirun -i -l --preamble-text "vec4 getColor() { return vec4(1.0); }" glsl.-P.function.frag > $TARGETDIR/glsl.-P.function.frag.out
214617a3babSopenharmony_cidiff -b $BASEDIR/glsl.-P.function.frag.out $TARGETDIR/glsl.-P.function.frag.out || HASERROR=1
215617a3babSopenharmony_cirun -i -l --preamble-text "#extension GL_GOOGLE_include_directive : require" -I. glsl.-P.include.frag > $TARGETDIR/glsl.-P.include.frag.out
216617a3babSopenharmony_cidiff -b $BASEDIR/glsl.-P.include.frag.out $TARGETDIR/glsl.-P.include.frag.out || HASERROR=1
217617a3babSopenharmony_ci
218617a3babSopenharmony_ci#
219617a3babSopenharmony_ci# Test --client and --target-env
220617a3babSopenharmony_ci#
221617a3babSopenharmony_ciecho "Testing --client and --target-env"
222617a3babSopenharmony_cirun --client vulkan100       spv.targetVulkan.vert || HASERROR=1
223617a3babSopenharmony_cirun --client opengl100       spv.targetOpenGL.vert || HASERROR=1
224617a3babSopenharmony_cirun --target-env vulkan1.0   spv.targetVulkan.vert || HASERROR=1
225617a3babSopenharmony_cirun --target-env vulkan1.1   spv.targetVulkan.vert || HASERROR=1
226617a3babSopenharmony_cirun --target-env vulkan1.2   spv.targetVulkan.vert || HASERROR=1
227617a3babSopenharmony_cirun --target-env opengl      spv.targetOpenGL.vert || HASERROR=1
228617a3babSopenharmony_cirun -V100                    spv.targetVulkan.vert || HASERROR=1
229617a3babSopenharmony_cirun -G100                    spv.targetOpenGL.vert || HASERROR=1
230617a3babSopenharmony_cirun --target-env spirv1.2 -V spv.targetVulkan.vert || HASERROR=1
231617a3babSopenharmony_ci
232617a3babSopenharmony_ci#
233617a3babSopenharmony_ci# Testing GLSL entry point rename
234617a3babSopenharmony_ci#
235617a3babSopenharmony_ciecho "Testing GLSL entry point rename"
236617a3babSopenharmony_cirun -H -e foo --source-entrypoint main glsl.entryPointRename.vert > $TARGETDIR/glsl.entryPointRename.vert.out
237617a3babSopenharmony_cidiff -b $BASEDIR/glsl.entryPointRename.vert.out $TARGETDIR/glsl.entryPointRename.vert.out || HASERROR=1
238617a3babSopenharmony_cirun -H -e foo --source-entrypoint bar glsl.entryPointRename.vert > $TARGETDIR/glsl.entryPointRename.vert.bad.out
239617a3babSopenharmony_cidiff -b $BASEDIR/glsl.entryPointRename.vert.bad.out $TARGETDIR/glsl.entryPointRename.vert.bad.out || HASERROR=1
240617a3babSopenharmony_cirun -H -e foo --source-entrypoint main glsl.entryPointRename2.vert > $TARGETDIR/glsl.entryPointRename2.vert.out
241617a3babSopenharmony_cidiff -b $BASEDIR/glsl.entryPointRename2.vert.out $TARGETDIR/glsl.entryPointRename2.vert.out || HASERROR=1
242617a3babSopenharmony_ci
243617a3babSopenharmony_ci#
244617a3babSopenharmony_ci# Testing remapper error handling
245617a3babSopenharmony_ci#
246617a3babSopenharmony_ciecho "Testing remapper error handling"
247617a3babSopenharmony_ci$REMAPEXE --do-everything -i remap.invalid-spirv-1.spv -o $TARGETDIR > $TARGETDIR/remap.invalid-spirv-1.out && HASERROR=1
248617a3babSopenharmony_cidiff -b $BASEDIR/remap.invalid-spirv-1.out $TARGETDIR/remap.invalid-spirv-1.out || HASERROR=1
249617a3babSopenharmony_ci$REMAPEXE --do-everything -i remap.invalid-spirv-2.spv -o $TARGETDIR > $TARGETDIR/remap.invalid-spirv-2.out && HASERROR=1
250617a3babSopenharmony_cidiff -b $BASEDIR/remap.invalid-spirv-2.out $TARGETDIR/remap.invalid-spirv-2.out || HASERROR=1
251617a3babSopenharmony_ci
252617a3babSopenharmony_ci#
253617a3babSopenharmony_ci# Testing position Y inversion
254617a3babSopenharmony_ci#
255617a3babSopenharmony_ciecho "Testing position Y inversion"
256617a3babSopenharmony_cirun -H -e main -V -D -Od -H -i --iy hlsl.y-negate-1.vert > $TARGETDIR/hlsl.y-negate-1.vert.out
257617a3babSopenharmony_cidiff -b $BASEDIR/hlsl.y-negate-1.vert.out $TARGETDIR/hlsl.y-negate-1.vert.out || HASERROR=1
258617a3babSopenharmony_cirun -H -e main -V -D -Od -H -i --invert-y hlsl.y-negate-2.vert > $TARGETDIR/hlsl.y-negate-2.vert.out
259617a3babSopenharmony_cidiff -b $BASEDIR/hlsl.y-negate-2.vert.out $TARGETDIR/hlsl.y-negate-2.vert.out || HASERROR=1
260617a3babSopenharmony_cirun -H -e main -V -D -Od -H -i --invert-y hlsl.y-negate-3.vert > $TARGETDIR/hlsl.y-negate-3.vert.out
261617a3babSopenharmony_cidiff -b $BASEDIR/hlsl.y-negate-3.vert.out $TARGETDIR/hlsl.y-negate-3.vert.out || HASERROR=1
262617a3babSopenharmony_ci
263617a3babSopenharmony_ci#
264617a3babSopenharmony_ci# Testing position W reciprocal
265617a3babSopenharmony_ci#
266617a3babSopenharmony_ciecho "Testing position W reciprocal"
267617a3babSopenharmony_cirun -H -e main -V -D -Od -H -i --hlsl-dx-position-w hlsl.w-recip.frag > $TARGETDIR/hlsl.w-recip.frag.out
268617a3babSopenharmony_cidiff -b $BASEDIR/hlsl.w-recip.frag.out $TARGETDIR/hlsl.w-recip.frag.out || HASERROR=1
269617a3babSopenharmony_cirun -H -e main -V -D -Od -H -i --hlsl-dx-position-w hlsl.w-recip2.frag > $TARGETDIR/hlsl.w-recip2.frag.out
270617a3babSopenharmony_cidiff -b $BASEDIR/hlsl.w-recip2.frag.out $TARGETDIR/hlsl.w-recip2.frag.out || HASERROR=1
271617a3babSopenharmony_ci
272617a3babSopenharmony_ci#
273617a3babSopenharmony_ci# Testing hlsl_functionality1
274617a3babSopenharmony_ci#
275617a3babSopenharmony_ciecho "Testing hlsl_functionality1"
276617a3babSopenharmony_cirun -H -e main -D -Od -fhlsl_functionality1 hlsl.structbuffer.incdec.frag > \
277617a3babSopenharmony_ci    $TARGETDIR/hlsl.structbuffer.incdec.frag.hlslfun1.out
278617a3babSopenharmony_cidiff -b $BASEDIR/hlsl.structbuffer.incdec.frag.hlslfun1.out $TARGETDIR/hlsl.structbuffer.incdec.frag.hlslfun1.out || HASERROR=1
279617a3babSopenharmony_cirun -H -e main -D -Od -fhlsl_functionality1 hlsl.noSemantic.functionality1.comp > \
280617a3babSopenharmony_ci    $TARGETDIR/hlsl.noSemantic.functionality1.comp.out
281617a3babSopenharmony_cidiff -b $BASEDIR/hlsl.noSemantic.functionality1.comp.out $TARGETDIR/hlsl.noSemantic.functionality1.comp.out || HASERROR=1
282617a3babSopenharmony_ci
283617a3babSopenharmony_ci#
284617a3babSopenharmony_ci# Testing HLSL-specific PP feature expansion
285617a3babSopenharmony_ci#
286617a3babSopenharmony_ciecho "Testing HLSL-specific PP feature expansion"
287617a3babSopenharmony_cirun -D -E hlsl.pp.expand.frag > $TARGETDIR/hlsl.pp.expand.frag.out 2> $TARGETDIR/hlsl.pp.expand.frag.err
288617a3babSopenharmony_cidiff -b $BASEDIR/hlsl.pp.expand.frag.out $TARGETDIR/hlsl.pp.expand.frag.out || HASERROR=1
289617a3babSopenharmony_cidiff -b $BASEDIR/hlsl.pp.expand.frag.err $TARGETDIR/hlsl.pp.expand.frag.err || HASERROR=1
290617a3babSopenharmony_ci
291617a3babSopenharmony_ci#
292617a3babSopenharmony_ci# Test --nan-clamp
293617a3babSopenharmony_ci#
294617a3babSopenharmony_ciecho "Testing nan-clamp"
295617a3babSopenharmony_cirun --nan-clamp -H --aml --amb spv.400.frag > $TARGETDIR/spv.400.frag.nanclamp.out
296617a3babSopenharmony_cidiff -b $BASEDIR/spv.400.frag.nanclamp.out $TARGETDIR/spv.400.frag.nanclamp.out || HASERROR=1
297617a3babSopenharmony_ci
298617a3babSopenharmony_ci#
299617a3babSopenharmony_ci# Test --auto-sampled-textures
300617a3babSopenharmony_ci#
301617a3babSopenharmony_ciecho "Testing auto-sampled-textures"
302617a3babSopenharmony_cirun --auto-sampled-textures -H -Od -e MainPs -D -S frag hlsl.autosampledtextures.frag > $TARGETDIR/hlsl.autosampledtextures.frag.out
303617a3babSopenharmony_cidiff -b $BASEDIR/hlsl.autosampledtextures.frag.out $TARGETDIR/hlsl.autosampledtextures.frag.out || HASERROR=1
304617a3babSopenharmony_cirun --auto-sampled-textures -H -Od -S frag glsl.autosampledtextures.frag > $TARGETDIR/glsl.autosampledtextures.frag.out
305617a3babSopenharmony_cidiff -b $BASEDIR/glsl.autosampledtextures.frag.out $TARGETDIR/glsl.autosampledtextures.frag.out || HASERROR=1
306617a3babSopenharmony_ci
307617a3babSopenharmony_ci# Test --glsl-version
308617a3babSopenharmony_ci#
309617a3babSopenharmony_ciecho "Testing --glsl-version"
310617a3babSopenharmony_cirun --glsl-version 410 -V -S vert glsl.versionOverride.vert > $TARGETDIR/glsl.versionOverride.vert.out
311617a3babSopenharmony_cidiff -b $BASEDIR/glsl.versionOverride.vert.out $TARGETDIR/glsl.versionOverride.vert.out || HASERROR=1
312617a3babSopenharmony_cirun --glsl-version 420 -V -S frag glsl.versionOverride.frag > $TARGETDIR/glsl.versionOverride.frag.out
313617a3babSopenharmony_cidiff -b $BASEDIR/glsl.versionOverride.frag.out $TARGETDIR/glsl.versionOverride.frag.out || HASERROR=1
314617a3babSopenharmony_cirun --glsl-version 430 -V -S geom glsl.versionOverride.geom > $TARGETDIR/glsl.versionOverride.geom.out
315617a3babSopenharmony_cidiff -b $BASEDIR/glsl.versionOverride.geom.out $TARGETDIR/glsl.versionOverride.geom.out || HASERROR=1
316617a3babSopenharmony_cirun --glsl-version 440 -V -S tesc glsl.versionOverride.tesc > $TARGETDIR/glsl.versionOverride.tesc.out
317617a3babSopenharmony_cidiff -b $BASEDIR/glsl.versionOverride.tesc.out $TARGETDIR/glsl.versionOverride.tesc.out || HASERROR=1
318617a3babSopenharmony_cirun --glsl-version 450 -V -S tese glsl.versionOverride.tese > $TARGETDIR/glsl.versionOverride.tese.out
319617a3babSopenharmony_cidiff -b $BASEDIR/glsl.versionOverride.tese.out $TARGETDIR/glsl.versionOverride.tese.out || HASERROR=1
320617a3babSopenharmony_cirun --glsl-version 460 -V -S comp glsl.versionOverride.comp > $TARGETDIR/glsl.versionOverride.comp.out
321617a3babSopenharmony_cidiff -b $BASEDIR/glsl.versionOverride.comp.out $TARGETDIR/glsl.versionOverride.comp.out || HASERROR=1
322617a3babSopenharmony_ci
323617a3babSopenharmony_ci#
324617a3babSopenharmony_ci# Test --enhanced-msgs
325617a3babSopenharmony_ci#
326617a3babSopenharmony_ci
327617a3babSopenharmony_ciecho "Testing enhanced-msgs"
328617a3babSopenharmony_cirun --enhanced-msgs -V --target-env vulkan1.2 --amb --aml enhanced.0.frag > $TARGETDIR/enhanced.0.frag.out
329617a3babSopenharmony_cidiff -b $BASEDIR/enhanced.0.frag.out $TARGETDIR/enhanced.0.frag.out || HASERROR=1
330617a3babSopenharmony_cirun --enhanced-msgs -V --target-env vulkan1.2 --amb --aml enhanced.1.frag > $TARGETDIR/enhanced.1.frag.out
331617a3babSopenharmony_cidiff -b $BASEDIR/enhanced.1.frag.out $TARGETDIR/enhanced.1.frag.out || HASERROR=1
332617a3babSopenharmony_cirun --enhanced-msgs -V --target-env vulkan1.2 --amb --aml enhanced.2.frag > $TARGETDIR/enhanced.2.frag.out
333617a3babSopenharmony_cidiff -b $BASEDIR/enhanced.2.frag.out $TARGETDIR/enhanced.2.frag.out || HASERROR=1
334617a3babSopenharmony_cirun --enhanced-msgs -V --target-env vulkan1.2 --amb --aml enhanced.3.vert enhanced.3.frag > $TARGETDIR/enhanced.3.link.out
335617a3babSopenharmony_cidiff -b $BASEDIR/enhanced.3.link.out $TARGETDIR/enhanced.3.link.out || HASERROR=1
336617a3babSopenharmony_cirun --enhanced-msgs -V --target-env vulkan1.2 --amb --aml enhanced.4.vert enhanced.4.frag > $TARGETDIR/enhanced.4.link.out
337617a3babSopenharmony_cidiff -b $BASEDIR/enhanced.4.link.out $TARGETDIR/enhanced.4.link.out || HASERROR=1
338617a3babSopenharmony_cirun --enhanced-msgs -V --target-env vulkan1.2 --amb --aml enhanced.5.vert enhanced.5.frag > $TARGETDIR/enhanced.5.link.out
339617a3babSopenharmony_cidiff -b $BASEDIR/enhanced.5.link.out $TARGETDIR/enhanced.5.link.out || HASERROR=1
340617a3babSopenharmony_cirun --enhanced-msgs -V --target-env vulkan1.2 --amb --aml enhanced.6.vert enhanced.6.frag > $TARGETDIR/enhanced.6.link.out
341617a3babSopenharmony_cidiff -b $BASEDIR/enhanced.6.link.out $TARGETDIR/enhanced.6.link.out || HASERROR=1
342617a3babSopenharmony_cirun --enhanced-msgs -V --target-env vulkan1.2 --amb --aml enhanced.7.vert enhanced.7.frag > $TARGETDIR/enhanced.7.link.out
343617a3babSopenharmony_cidiff -b $BASEDIR/enhanced.7.link.out $TARGETDIR/enhanced.7.link.out || HASERROR=1
344617a3babSopenharmony_cirun --enhanced-msgs -V --target-env vulkan1.2 --amb --aml spv.textureError.frag > $TARGETDIR/spv.textureError.frag.out
345617a3babSopenharmony_cidiff -b $BASEDIR/spv.textureError.frag.out $TARGETDIR/spv.textureError.frag.out || HASERROR=1
346617a3babSopenharmony_ci
347617a3babSopenharmony_ci#
348617a3babSopenharmony_ci# Final checking
349617a3babSopenharmony_ci#
350617a3babSopenharmony_ciif [ $HASERROR -eq 0 ]
351617a3babSopenharmony_cithen
352617a3babSopenharmony_ci    echo Tests Succeeded.
353617a3babSopenharmony_cielse
354617a3babSopenharmony_ci    echo Tests Failed.
355617a3babSopenharmony_cifi
356617a3babSopenharmony_ci
357617a3babSopenharmony_cirm -f comp.spv frag.spv geom.spv tesc.spv tese.spv vert.spv
358617a3babSopenharmony_ci
359617a3babSopenharmony_ciexit $HASERROR
360