summaryrefslogtreecommitdiffstats
path: root/chromium/third_party/glslang/src/Test/runtests
blob: d54fb580e82d532ebbc92a994035e5b62879103e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
#!/usr/bin/env bash

TARGETDIR=localResults
BASEDIR=baseResults
EXE=../build/install/bin/glslangValidator
HASERROR=0
mkdir -p localResults

#
# configuration file tests
#
echo running configuration file test
$EXE -c > $TARGETDIR/test.conf
diff -b $BASEDIR/test.conf $TARGETDIR/test.conf || HASERROR=1
$EXE -i -l $TARGETDIR/test.conf specExamples.vert > $TARGETDIR/specExamples.vert.out
diff -b $BASEDIR/specExamples.vert.out $TARGETDIR || HASERROR=1
$EXE -l 100Limits.vert 100.conf >  $TARGETDIR/100LimitsConf.vert.out
diff -b $BASEDIR/100LimitsConf.vert.out $TARGETDIR/100LimitsConf.vert.out || HASERROR=1

#
# isolated compilation tests
#
while read t; do
    echo Running $t...
    b=`basename $t`
    $EXE -i -l $t > $TARGETDIR/$b.out
    diff -b $BASEDIR/$b.out $TARGETDIR/$b.out || HASERROR=1
done < testlist

if [ -a localtestlist ]
  then
    while read t; do
        echo Running $t...
        b=`basename $t`
        $EXE -i -l $t > $TARGETDIR/$b.out
        diff -b $BASEDIR/$b.out $TARGETDIR/$b.out || HASERROR=1
    done < localtestlist
fi

#
# SPIR-V code generation tests
#
while read t; do
  case $t in
    \#*)
      # Skip comment lines in the test list file.
      ;;
    *)
      echo Running SPIR-V $t...
      b=`basename $t`
      $EXE -H $t > $TARGETDIR/$b.out
      diff -b $BASEDIR/$b.out $TARGETDIR/$b.out || HASERROR=1
      ;;
  esac
done < test-spirv-list
rm -f comp.spv frag.spv geom.spv tesc.spv tese.spv vert.spv

#
# HLSL -> SPIR-V code generation tests
#
while read t; do
  case $t in
    \#*)
      # Skip comment lines in the test list file.
      ;;
    *)
      echo Running HLSL-to-SPIR-V $t...
      b=`basename $t`
      $EXE -D -e PixelShaderFunction -H -i $t > $TARGETDIR/$b.out
      diff -b $BASEDIR/$b.out $TARGETDIR/$b.out || HASERROR=1
      ;;
  esac
done < test-hlsl-spirv-list
rm -f comp.spv frag.spv geom.spv tesc.spv tese.spv vert.spv

#
# Preprocessor tests
#
while read t; do
    echo Running Preprocessor $t...
    b=`basename $t`
    $EXE -E $t > $TARGETDIR/$b.out 2> $TARGETDIR/$b.err
    diff -b $BASEDIR/$b.out $TARGETDIR/$b.out || HASERROR=1
    diff -b $BASEDIR/$b.err $TARGETDIR/$b.err || HASERROR=1
done < test-preprocessor-list

#
# grouped shaders for bulk (faster) tests
#
function runBulkTest {
    echo Running $*...
    $EXE -i -l -t $* > $TARGETDIR/$1.out
    diff -b $BASEDIR/$1.out $TARGETDIR/$1.out || HASERROR=1
}

runBulkTest mains1.frag mains2.frag noMain1.geom noMain2.geom
runBulkTest noMain.vert mains.frag
runBulkTest link1.frag link2.frag link3.frag
runBulkTest es-link1.frag es-link2.frag
runBulkTest recurse1.vert recurse1.frag recurse2.frag
runBulkTest 300link.frag
runBulkTest 300link2.frag
runBulkTest 300link3.frag
runBulkTest empty.frag empty2.frag empty3.frag
runBulkTest 150.tesc 150.tese 400.tesc 400.tese 410.tesc 420.tesc 420.tese
runBulkTest max_vertices_0.geom

#
# reflection tests
#
echo Running reflection...
$EXE -l -q reflection.vert > $TARGETDIR/reflection.vert.out
diff -b $BASEDIR/reflection.vert.out $TARGETDIR/reflection.vert.out || HASERROR=1

#
# multi-threaded test
#
echo Comparing single thread to multithread for all tests in current directory...
$EXE -i *.vert *.geom *.frag *.tes* *.comp > singleThread.out
$EXE -i *.vert *.geom *.frag *.tes* *.comp -t > multiThread.out
diff singleThread.out multiThread.out || HASERROR=1

if [ $HASERROR -eq 0 ]
then
    echo Tests Succeeded.
else
    echo Tests Failed.
fi

exit $HASERROR