blob: db2a345cbdef0b0cb5c0caef31189330a563251c [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
9#
John Kessenicha5830df2013-10-02 05:10:48 +000010# configuration file tests
John Kessenich05a70632013-09-17 19:26:08 +000011#
12echo running configuration file test
13$EXE -c > $TARGETDIR/test.conf
John Kessenichb38c9692015-05-15 19:01:17 +000014diff -b $BASEDIR/test.conf $TARGETDIR/test.conf || HASERROR=1
John Kessenich5134b9c2013-11-20 21:12:43 +000015$EXE -i -l $TARGETDIR/test.conf specExamples.vert > $TARGETDIR/specExamples.vert.out
John Kessenichb38c9692015-05-15 19:01:17 +000016diff -b $BASEDIR/specExamples.vert.out $TARGETDIR || HASERROR=1
John Kessenicha5830df2013-10-02 05:10:48 +000017$EXE 100Limits.vert 100.conf > $TARGETDIR/100LimitsConf.vert.out
John Kessenichb38c9692015-05-15 19:01:17 +000018diff -b $BASEDIR/100LimitsConf.vert.out $TARGETDIR/100LimitsConf.vert.out || HASERROR=1
John Kessenich05a70632013-09-17 19:26:08 +000019
20#
John Kessenich69f4b512013-09-04 21:19:27 +000021# isolated compilation tests
22#
John Kessenichaab25142013-02-12 18:26:15 +000023while read t; do
24 echo Running $t...
John Kessenich69f4b512013-09-04 21:19:27 +000025 b=`basename $t`
John Kessenich5134b9c2013-11-20 21:12:43 +000026 $EXE -i -l $t > $TARGETDIR/$b.out
John Kessenichb38c9692015-05-15 19:01:17 +000027 diff -b $BASEDIR/$b.out $TARGETDIR/$b.out || HASERROR=1
John Kessenichb3338b32013-02-26 19:47:21 +000028done < testlist
John Kessenich69f4b512013-09-04 21:19:27 +000029
John Kessenichcf0206c2014-04-14 15:46:40 +000030if [ -a localtestlist ]
31 then
32 while read t; do
33 echo Running $t...
34 b=`basename $t`
35 $EXE -i -l $t > $TARGETDIR/$b.out
John Kessenichb38c9692015-05-15 19:01:17 +000036 diff -b $BASEDIR/$b.out $TARGETDIR/$b.out || HASERROR=1
John Kessenichcf0206c2014-04-14 15:46:40 +000037 done < localtestlist
38fi
39
John Kessenich69f4b512013-09-04 21:19:27 +000040#
John Kessenich593a3f72015-05-15 18:44:16 +000041# SPIR-V code generation tests
42#
John Kessenich99a3c592015-06-16 18:40:40 +000043while read t; do
44 case $t in
45 \#*)
46 # Skip comment lines in the test list file.
47 ;;
48 *)
49 echo Running SPIR-V $t...
50 b=`basename $t`
51 $EXE -H $t > $TARGETDIR/$b.out
52 diff -b $BASEDIR/$b.out $TARGETDIR/$b.out || HASERROR=1
53 ;;
54 esac
55done < test-spirv-list
johnkslang02ad18a2015-06-26 00:12:31 -060056rm -f comp.spv frag.spv geom.spv tesc.spv tese.spv vert.spv
John Kessenich593a3f72015-05-15 18:44:16 +000057
58#
John Kessenichc555ddd2015-06-17 02:38:44 +000059# Preprocessor tests
60#
61while read t; do
62 echo Running Preprocessor $t...
63 b=`basename $t`
64 $EXE -E $t > $TARGETDIR/$b.out
65 diff -b $BASEDIR/$b.out $TARGETDIR/$b.out || HASERROR=1
66done < test-preprocessor-list
67
68#
John Kesseniche8fe7b82013-12-18 18:47:12 +000069# grouped shaders for bulk (faster) tests
John Kessenich69f4b512013-09-04 21:19:27 +000070#
John Kesseniche8fe7b82013-12-18 18:47:12 +000071function runBulkTest {
John Kessenich69f4b512013-09-04 21:19:27 +000072 echo Running $*...
John Kesseniche8fe7b82013-12-18 18:47:12 +000073 $EXE -i -l -t $* > $TARGETDIR/$1.out
John Kessenichb38c9692015-05-15 19:01:17 +000074 diff -b $BASEDIR/$1.out $TARGETDIR/$1.out || HASERROR=1
John Kessenich69f4b512013-09-04 21:19:27 +000075}
76
John Kesseniche8fe7b82013-12-18 18:47:12 +000077runBulkTest mains1.frag mains2.frag noMain1.geom noMain2.geom
78runBulkTest noMain.vert mains.frag
79runBulkTest link1.frag link2.frag link3.frag
80runBulkTest recurse1.vert recurse1.frag recurse2.frag
81runBulkTest 300link.frag
82runBulkTest 300link2.frag
83runBulkTest 300link3.frag
84runBulkTest empty.frag empty2.frag empty3.frag
85runBulkTest 150.tesc 150.tese 400.tesc 400.tese 410.tesc 420.tesc 420.tese
John Kessenich38f3b892013-09-06 19:52:57 +000086
87#
John Kessenich11f9fc72013-11-07 01:06:34 +000088# reflection tests
89#
90echo Running reflection...
91$EXE -l -q reflection.vert > $TARGETDIR/reflection.vert.out
John Kessenichb38c9692015-05-15 19:01:17 +000092diff -b $BASEDIR/reflection.vert.out $TARGETDIR/reflection.vert.out || HASERROR=1
John Kessenich11f9fc72013-11-07 01:06:34 +000093
94#
John Kessenich38f3b892013-09-06 19:52:57 +000095# multi-threaded test
96#
John Kessenich38f3b892013-09-06 19:52:57 +000097echo Comparing single thread to multithread for all tests in current directory...
98$EXE -i *.vert *.geom *.frag *.tes* *.comp > singleThread.out
99$EXE -i *.vert *.geom *.frag *.tes* *.comp -t > multiThread.out
John Kessenichb38c9692015-05-15 19:01:17 +0000100diff singleThread.out multiThread.out || HASERROR=1
101
John Kessenich84ea15f2015-05-15 21:54:24 +0000102if [ $HASERROR -eq 0 ]
103then
104 echo Tests Succeeded.
105else
106 echo Tests Failed.
107fi
108
John Kessenichb38c9692015-05-15 19:01:17 +0000109exit $HASERROR