glsl/tests: suffix .sh/.py files as applicable
authorEmil Velikov <emil.velikov@collabora.com>
Wed, 22 Feb 2017 15:53:21 +0000 (15:53 +0000)
committerEmil Velikov <emil.l.velikov@gmail.com>
Fri, 10 Mar 2017 14:12:45 +0000 (14:12 +0000)
This makes it easier/clearer as to:
 - if the file should have the execute bit set (.py should not)
 - do we need the shebang in the first place and if so what it should be

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
src/compiler/Makefile.glsl.am
src/compiler/glsl/glcpp/tests/glcpp-test [deleted file]
src/compiler/glsl/glcpp/tests/glcpp-test-cr-lf [deleted file]
src/compiler/glsl/glcpp/tests/glcpp-test-cr-lf.sh [new file with mode: 0755]
src/compiler/glsl/glcpp/tests/glcpp-test.sh [new file with mode: 0755]
src/compiler/glsl/tests/compare_ir [deleted file]
src/compiler/glsl/tests/compare_ir.py [new file with mode: 0755]
src/compiler/glsl/tests/optimization-test [deleted file]
src/compiler/glsl/tests/optimization-test.sh [new file with mode: 0755]
src/compiler/glsl/tests/warnings-test [deleted file]
src/compiler/glsl/tests/warnings-test.sh [new file with mode: 0755]

index 41edb3cf4d97511dfea524c68d9f4da555157167..f7be5ebce9de29b13edec0399c05ab7f3f64d79f 100644 (file)
@@ -30,15 +30,15 @@ EXTRA_DIST += glsl/tests glsl/glcpp/tests glsl/README       \
        glsl/glcpp/glcpp-parse.y                        \
        SConscript.glsl
 
-TESTS += glsl/glcpp/tests/glcpp-test                   \
-       glsl/glcpp/tests/glcpp-test-cr-lf               \
+TESTS += glsl/glcpp/tests/glcpp-test.sh                        \
+       glsl/glcpp/tests/glcpp-test-cr-lf.sh            \
        glsl/tests/blob-test                            \
        glsl/tests/cache-test                           \
        glsl/tests/general-ir-test                      \
-       glsl/tests/optimization-test                    \
+       glsl/tests/optimization-test.sh                 \
        glsl/tests/sampler-types-test                   \
        glsl/tests/uniform-initializer-test             \
-       glsl/tests/warnings-test
+       glsl/tests/warnings-test.sh
 
 TESTS_ENVIRONMENT= \
        export PYTHON2=$(PYTHON2); \
diff --git a/src/compiler/glsl/glcpp/tests/glcpp-test b/src/compiler/glsl/glcpp/tests/glcpp-test
deleted file mode 100755 (executable)
index 3945ee4..0000000
+++ /dev/null
@@ -1,110 +0,0 @@
-#!/bin/sh
-
-if [ ! -z "$srcdir" ]; then
-   testdir=$srcdir/glsl/glcpp/tests
-   outdir=`pwd`/glsl/glcpp/tests
-   glcpp=`pwd`/glsl/glcpp/glcpp
-else
-   testdir=.
-   outdir=.
-   glcpp=../glcpp
-fi
-
-trap 'rm $test.valgrind-errors; exit 1' INT QUIT
-
-usage ()
-{
-    cat <<EOF
-Usage: glcpp [options...]
-
-Run the test suite for mesa's GLSL pre-processor.
-
-Valid options include:
-
-       --testdir=<DIR> Use tests in the given <DIR> (default is ".")
-       --valgrind      Run the test suite a second time under valgrind
-EOF
-}
-
-test_specific_args ()
-{
-    test="$1"
-
-    tr "\r" "\n" < "$test" | grep 'glcpp-args:' | sed -e 's,^.*glcpp-args: *,,'
-}
-
-# Parse command-line options
-for option; do
-    case "${option}" in
-        "--help")
-            usage
-            exit 0
-            ;;
-        "--valgrind")
-           do_valgrind=yes
-            ;;
-        "--testdir="*)
-            testdir="${option#--testdir=}"
-            outdir="${outdir}/${option#--testdir=}"
-            ;;
-        *)
-           echo "Unrecognized option: $option" >&2
-           echo >&2
-           usage
-           exit 1
-            ;;
-        esac
-done
-
-total=0
-pass=0
-clean=0
-
-mkdir -p $outdir
-
-echo "====== Testing for correctness ======"
-for test in $testdir/*.c; do
-    out=$outdir/${test##*/}.out
-
-    printf "Testing $test... > $out ($test.expected) "
-    $glcpp $(test_specific_args $test) < $test > $out 2>&1
-    total=$((total+1))
-    if cmp $test.expected $out >/dev/null 2>&1; then
-       echo "PASS"
-       pass=$((pass+1))
-    else
-       echo "FAIL"
-       diff -u $test.expected $out
-    fi
-done
-
-echo ""
-echo "$pass/$total tests returned correct results"
-echo ""
-
-if [ "$do_valgrind" = "yes" ]; then
-    echo "====== Testing for valgrind cleanliness ======"
-    for test in $testdir/*.c; do
-       printf "Testing $test with valgrind..."
-       valgrind --error-exitcode=31 --log-file=$test.valgrind-errors $glcpp $(test_specific_args $test) < $test >/dev/null 2>&1
-       if [ "$?" = "31" ]; then
-           echo "ERRORS"
-           cat $test.valgrind-errors
-       else
-           echo "CLEAN"
-           clean=$((clean+1))
-           rm $test.valgrind-errors
-       fi
-    done
-
-    echo ""
-    echo "$pass/$total tests returned correct results"
-    echo "$clean/$total tests are valgrind-clean"
-fi
-
-if [ "$pass" = "$total" ] && [ "$do_valgrind" != "yes" ] || [ "$pass" = "$total" ]; then
-    exit 0
-else
-    exit 1
-fi
-
diff --git a/src/compiler/glsl/glcpp/tests/glcpp-test-cr-lf b/src/compiler/glsl/glcpp/tests/glcpp-test-cr-lf
deleted file mode 100755 (executable)
index c75370f..0000000
+++ /dev/null
@@ -1,141 +0,0 @@
-#!/bin/sh
-
-# The build system runs this test from a different working directory, and may
-# be in a build directory entirely separate from the source. So if the
-# "srcdir" variable is set, we must use it to locate the test files and the
-# glcpp-test script.
-
-if [ ! -z "$srcdir" ]; then
-   testdir="$srcdir/glsl/glcpp/tests"
-   glcpp_test="$srcdir/glsl/glcpp/tests/glcpp-test"
-else
-   testdir=.
-   glcpp_test=./glcpp-test
-fi
-
-total=0
-pass=0
-
-# This supports a pipe that doesn't destroy the exit status of first command
-#
-# http://unix.stackexchange.com/questions/14270/get-exit-status-of-process-thats-piped-to-another
-stdintoexitstatus() {
-    read exitstatus
-    return $exitstatus
-}
-
-run_test ()
-{
-    cmd="$1"
-
-    total=$((total+1))
-
-    if [ "$VERBOSE" = "yes" ]; then
-       if $cmd; then
-           echo "PASS"
-           pass=$((pass+1))
-       else
-           echo "FAIL"
-       fi
-    else
-       # This is "$cmd | tail -2" but with the exit status of "$cmd" not "tail -2"
-       if (((($cmd; echo $? >&3) | tail -2 | head -1 >&4) 3>&1) | stdintoexitstatus) 4>&1; then
-           echo "PASS"
-           pass=$((pass+1))
-       else
-           echo "FAIL"
-       fi
-    fi
-}
-
-usage ()
-{
-       cat <<EOF
-Usage: glcpp-cr-lf [options...]
-
-Run the entire glcpp-test suite several times, each time with each source
-file transformed to use a non-standard line-termination character. Each
-entire run with a different line-termination character is considered a
-single test.
-
-Valid options include:
-
-       -v|--verbose    Print all output from the various sub-tests
-EOF
-}
-
-# Parse command-line options
-for option; do
-    case "${option}" in
-       -v|--verbose)
-           VERBOSE=yes;
-           ;;
-       *)
-           echo "Unrecognized option: $option" >&2
-           echo >&2
-           usage
-           exit 1
-           ;;
-       esac
-done
-
-# All tests depend on the .out files being present. So first do a
-# normal run of the test suite, (silently) just to create the .out
-# files as a side effect.
-rm -rf ./subtest-lf
-mkdir subtest-lf
-for file in "$testdir"/*.c; do
-    base=$(basename "$file")
-    cp "$file" subtest-lf
-done
-
-${glcpp_test} --testdir=subtest-lf >/dev/null 2>&1
-
-echo "===== Testing with \\\\r line terminators (old Mac format) ====="
-
-# Prepare test files with '\r' instead of '\n'
-rm -rf ./subtest-cr
-mkdir subtest-cr
-for file in "$testdir"/*.c; do
-    base=$(basename "$file")
-    tr "\n" "\r" < "$file" > subtest-cr/"$base"
-    cp `pwd`/glsl/glcpp/tests/subtest-lf/"$base".out subtest-cr/"$base".expected
-done
-
-run_test "${glcpp_test} --testdir=subtest-cr"
-
-echo "===== Testing with \\\\r\\\\n line terminators (DOS format) ====="
-
-# Prepare test files with '\r\n' instead of '\n'
-rm -rf ./subtest-cr-lf
-mkdir subtest-cr-lf
-for file in "$testdir"/*.c; do
-    base=$(basename "$file")
-    sed -e 's/$/\r/' < "$file" > subtest-cr-lf/"$base"
-    cp `pwd`/glsl/glcpp/tests/subtest-lf/"$base".out subtest-cr-lf/"$base".expected
-done
-
-run_test "${glcpp_test} --testdir=subtest-cr-lf"
-
-echo "===== Testing with \\\\n\\\\r (bizarre, but allowed by GLSL spec.) ====="
-
-# Prepare test files with '\n\r' instead of '\n'
-rm -rf ./subtest-lf-cr
-mkdir subtest-lf-cr
-for file in "$testdir"/*.c; do
-    base=$(basename "$file")
-    sed -e 's/$/\r/' < "$file" | tr "\n\r" "\r\n" > subtest-lf-cr/"$base"
-    cp `pwd`/glsl/glcpp/tests/subtest-lf/"$base".out subtest-lf-cr/"$base".expected
-done
-
-run_test "${glcpp_test} --testdir=subtest-lf-cr"
-
-echo ""
-echo "$pass/$total tests returned correct results"
-echo ""
-
-if [ "$pass" = "$total" ]; then
-    exit 0
-else
-    exit 1
-fi
diff --git a/src/compiler/glsl/glcpp/tests/glcpp-test-cr-lf.sh b/src/compiler/glsl/glcpp/tests/glcpp-test-cr-lf.sh
new file mode 100755 (executable)
index 0000000..c0ed9e0
--- /dev/null
@@ -0,0 +1,141 @@
+#!/bin/sh
+
+# The build system runs this test from a different working directory, and may
+# be in a build directory entirely separate from the source. So if the
+# "srcdir" variable is set, we must use it to locate the test files and the
+# glcpp-test script.
+
+if [ ! -z "$srcdir" ]; then
+   testdir="$srcdir/glsl/glcpp/tests"
+   glcpp_test="$srcdir/glsl/glcpp/tests/glcpp-test.sh"
+else
+   testdir=.
+   glcpp_test=./glcpp-test.sh
+fi
+
+total=0
+pass=0
+
+# This supports a pipe that doesn't destroy the exit status of first command
+#
+# http://unix.stackexchange.com/questions/14270/get-exit-status-of-process-thats-piped-to-another
+stdintoexitstatus() {
+    read exitstatus
+    return $exitstatus
+}
+
+run_test ()
+{
+    cmd="$1"
+
+    total=$((total+1))
+
+    if [ "$VERBOSE" = "yes" ]; then
+       if $cmd; then
+           echo "PASS"
+           pass=$((pass+1))
+       else
+           echo "FAIL"
+       fi
+    else
+       # This is "$cmd | tail -2" but with the exit status of "$cmd" not "tail -2"
+       if (((($cmd; echo $? >&3) | tail -2 | head -1 >&4) 3>&1) | stdintoexitstatus) 4>&1; then
+           echo "PASS"
+           pass=$((pass+1))
+       else
+           echo "FAIL"
+       fi
+    fi
+}
+
+usage ()
+{
+       cat <<EOF
+Usage: glcpp-cr-lf [options...]
+
+Run the entire glcpp-test suite several times, each time with each source
+file transformed to use a non-standard line-termination character. Each
+entire run with a different line-termination character is considered a
+single test.
+
+Valid options include:
+
+       -v|--verbose    Print all output from the various sub-tests
+EOF
+}
+
+# Parse command-line options
+for option; do
+    case "${option}" in
+       -v|--verbose)
+           VERBOSE=yes;
+           ;;
+       *)
+           echo "Unrecognized option: $option" >&2
+           echo >&2
+           usage
+           exit 1
+           ;;
+       esac
+done
+
+# All tests depend on the .out files being present. So first do a
+# normal run of the test suite, (silently) just to create the .out
+# files as a side effect.
+rm -rf ./subtest-lf
+mkdir subtest-lf
+for file in "$testdir"/*.c; do
+    base=$(basename "$file")
+    cp "$file" subtest-lf
+done
+
+${glcpp_test} --testdir=subtest-lf >/dev/null 2>&1
+
+echo "===== Testing with \\\\r line terminators (old Mac format) ====="
+
+# Prepare test files with '\r' instead of '\n'
+rm -rf ./subtest-cr
+mkdir subtest-cr
+for file in "$testdir"/*.c; do
+    base=$(basename "$file")
+    tr "\n" "\r" < "$file" > subtest-cr/"$base"
+    cp `pwd`/glsl/glcpp/tests/subtest-lf/"$base".out subtest-cr/"$base".expected
+done
+
+run_test "${glcpp_test} --testdir=subtest-cr"
+
+echo "===== Testing with \\\\r\\\\n line terminators (DOS format) ====="
+
+# Prepare test files with '\r\n' instead of '\n'
+rm -rf ./subtest-cr-lf
+mkdir subtest-cr-lf
+for file in "$testdir"/*.c; do
+    base=$(basename "$file")
+    sed -e 's/$/\r/' < "$file" > subtest-cr-lf/"$base"
+    cp `pwd`/glsl/glcpp/tests/subtest-lf/"$base".out subtest-cr-lf/"$base".expected
+done
+
+run_test "${glcpp_test} --testdir=subtest-cr-lf"
+
+echo "===== Testing with \\\\n\\\\r (bizarre, but allowed by GLSL spec.) ====="
+
+# Prepare test files with '\n\r' instead of '\n'
+rm -rf ./subtest-lf-cr
+mkdir subtest-lf-cr
+for file in "$testdir"/*.c; do
+    base=$(basename "$file")
+    sed -e 's/$/\r/' < "$file" | tr "\n\r" "\r\n" > subtest-lf-cr/"$base"
+    cp `pwd`/glsl/glcpp/tests/subtest-lf/"$base".out subtest-lf-cr/"$base".expected
+done
+
+run_test "${glcpp_test} --testdir=subtest-lf-cr"
+
+echo ""
+echo "$pass/$total tests returned correct results"
+echo ""
+
+if [ "$pass" = "$total" ]; then
+    exit 0
+else
+    exit 1
+fi
diff --git a/src/compiler/glsl/glcpp/tests/glcpp-test.sh b/src/compiler/glsl/glcpp/tests/glcpp-test.sh
new file mode 100755 (executable)
index 0000000..3945ee4
--- /dev/null
@@ -0,0 +1,110 @@
+#!/bin/sh
+
+if [ ! -z "$srcdir" ]; then
+   testdir=$srcdir/glsl/glcpp/tests
+   outdir=`pwd`/glsl/glcpp/tests
+   glcpp=`pwd`/glsl/glcpp/glcpp
+else
+   testdir=.
+   outdir=.
+   glcpp=../glcpp
+fi
+
+trap 'rm $test.valgrind-errors; exit 1' INT QUIT
+
+usage ()
+{
+    cat <<EOF
+Usage: glcpp [options...]
+
+Run the test suite for mesa's GLSL pre-processor.
+
+Valid options include:
+
+       --testdir=<DIR> Use tests in the given <DIR> (default is ".")
+       --valgrind      Run the test suite a second time under valgrind
+EOF
+}
+
+test_specific_args ()
+{
+    test="$1"
+
+    tr "\r" "\n" < "$test" | grep 'glcpp-args:' | sed -e 's,^.*glcpp-args: *,,'
+}
+
+# Parse command-line options
+for option; do
+    case "${option}" in
+        "--help")
+            usage
+            exit 0
+            ;;
+        "--valgrind")
+           do_valgrind=yes
+            ;;
+        "--testdir="*)
+            testdir="${option#--testdir=}"
+            outdir="${outdir}/${option#--testdir=}"
+            ;;
+        *)
+           echo "Unrecognized option: $option" >&2
+           echo >&2
+           usage
+           exit 1
+            ;;
+        esac
+done
+
+total=0
+pass=0
+clean=0
+
+mkdir -p $outdir
+
+echo "====== Testing for correctness ======"
+for test in $testdir/*.c; do
+    out=$outdir/${test##*/}.out
+
+    printf "Testing $test... > $out ($test.expected) "
+    $glcpp $(test_specific_args $test) < $test > $out 2>&1
+    total=$((total+1))
+    if cmp $test.expected $out >/dev/null 2>&1; then
+       echo "PASS"
+       pass=$((pass+1))
+    else
+       echo "FAIL"
+       diff -u $test.expected $out
+    fi
+done
+
+echo ""
+echo "$pass/$total tests returned correct results"
+echo ""
+
+if [ "$do_valgrind" = "yes" ]; then
+    echo "====== Testing for valgrind cleanliness ======"
+    for test in $testdir/*.c; do
+       printf "Testing $test with valgrind..."
+       valgrind --error-exitcode=31 --log-file=$test.valgrind-errors $glcpp $(test_specific_args $test) < $test >/dev/null 2>&1
+       if [ "$?" = "31" ]; then
+           echo "ERRORS"
+           cat $test.valgrind-errors
+       else
+           echo "CLEAN"
+           clean=$((clean+1))
+           rm $test.valgrind-errors
+       fi
+    done
+
+    echo ""
+    echo "$pass/$total tests returned correct results"
+    echo "$clean/$total tests are valgrind-clean"
+fi
+
+if [ "$pass" = "$total" ] && [ "$do_valgrind" != "yes" ] || [ "$pass" = "$total" ]; then
+    exit 0
+else
+    exit 1
+fi
+
diff --git a/src/compiler/glsl/tests/compare_ir b/src/compiler/glsl/tests/compare_ir
deleted file mode 100755 (executable)
index a40fc81..0000000
+++ /dev/null
@@ -1,59 +0,0 @@
-#!/usr/bin/env python
-# coding=utf-8
-#
-# Copyright © 2011 Intel Corporation
-#
-# Permission is hereby granted, free of charge, to any person obtaining a
-# copy of this software and associated documentation files (the "Software"),
-# to deal in the Software without restriction, including without limitation
-# the rights to use, copy, modify, merge, publish, distribute, sublicense,
-# and/or sell copies of the Software, and to permit persons to whom the
-# Software is furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice (including the next
-# paragraph) shall be included in all copies or substantial portions of the
-# Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
-# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-# DEALINGS IN THE SOFTWARE.
-
-# Compare two files containing IR code.  Ignore formatting differences
-# and declaration order.
-
-import os
-import os.path
-import subprocess
-import sys
-import tempfile
-
-from sexps import *
-
-if len(sys.argv) != 3:
-    print 'Usage: compare_ir <file1> <file2>'
-    exit(1)
-
-with open(sys.argv[1]) as f:
-    ir1 = sort_decls(parse_sexp(f.read()))
-with open(sys.argv[2]) as f:
-    ir2 = sort_decls(parse_sexp(f.read()))
-
-if ir1 == ir2:
-    exit(0)
-else:
-    file1, path1 = tempfile.mkstemp(os.path.basename(sys.argv[1]))
-    file2, path2 = tempfile.mkstemp(os.path.basename(sys.argv[2]))
-    try:
-        os.write(file1, '{0}\n'.format(sexp_to_string(ir1)))
-        os.close(file1)
-        os.write(file2, '{0}\n'.format(sexp_to_string(ir2)))
-        os.close(file2)
-        subprocess.call(['diff', '-u', path1, path2])
-    finally:
-        os.remove(path1)
-        os.remove(path2)
-    exit(1)
diff --git a/src/compiler/glsl/tests/compare_ir.py b/src/compiler/glsl/tests/compare_ir.py
new file mode 100755 (executable)
index 0000000..53207dd
--- /dev/null
@@ -0,0 +1,59 @@
+#!/usr/bin/env python
+# coding=utf-8
+#
+# Copyright © 2011 Intel Corporation
+#
+# Permission is hereby granted, free of charge, to any person obtaining a
+# copy of this software and associated documentation files (the "Software"),
+# to deal in the Software without restriction, including without limitation
+# the rights to use, copy, modify, merge, publish, distribute, sublicense,
+# and/or sell copies of the Software, and to permit persons to whom the
+# Software is furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice (including the next
+# paragraph) shall be included in all copies or substantial portions of the
+# Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+# DEALINGS IN THE SOFTWARE.
+
+# Compare two files containing IR code.  Ignore formatting differences
+# and declaration order.
+
+import os
+import os.path
+import subprocess
+import sys
+import tempfile
+
+from sexps import *
+
+if len(sys.argv) != 3:
+    print 'Usage: python2 ./compare_ir.py <file1> <file2>'
+    exit(1)
+
+with open(sys.argv[1]) as f:
+    ir1 = sort_decls(parse_sexp(f.read()))
+with open(sys.argv[2]) as f:
+    ir2 = sort_decls(parse_sexp(f.read()))
+
+if ir1 == ir2:
+    exit(0)
+else:
+    file1, path1 = tempfile.mkstemp(os.path.basename(sys.argv[1]))
+    file2, path2 = tempfile.mkstemp(os.path.basename(sys.argv[2]))
+    try:
+        os.write(file1, '{0}\n'.format(sexp_to_string(ir1)))
+        os.close(file1)
+        os.write(file2, '{0}\n'.format(sexp_to_string(ir2)))
+        os.close(file2)
+        subprocess.call(['diff', '-u', path1, path2])
+    finally:
+        os.remove(path1)
+        os.remove(path2)
+    exit(1)
diff --git a/src/compiler/glsl/tests/optimization-test b/src/compiler/glsl/tests/optimization-test
deleted file mode 100755 (executable)
index 26a51be..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-#!/usr/bin/env bash
-
-if [ ! -z "$srcdir" ]; then
-   compare_ir=`pwd`/tests/compare_ir
-else
-   compare_ir=./compare_ir
-fi
-
-total=0
-pass=0
-
-echo "======       Generating tests      ======"
-for dir in tests/*/; do
-    if [ -e "${dir}create_test_cases.py" ]; then
-        cd $dir; $PYTHON2 create_test_cases.py; cd ..
-    fi
-    echo "$dir"
-done
-
-echo "====== Testing optimization passes ======"
-for test in `find . -iname '*.opt_test'`; do
-    echo -n "Testing $test..."
-    (cd `dirname "$test"`; ./`basename "$test"`) > "$test.out" 2>&1
-    total=$((total+1))
-    if $PYTHON2 $PYTHON_FLAGS $compare_ir "$test.expected" "$test.out" >/dev/null 2>&1; then
-        echo "PASS"
-        pass=$((pass+1))
-    else
-        echo "FAIL"
-        $PYTHON2 $PYTHON_FLAGS $compare_ir "$test.expected" "$test.out"
-    fi
-done
-
-echo ""
-echo "$pass/$total tests returned correct results"
-echo ""
-
-if [[ $pass == $total ]]; then
-    exit 0
-else
-    exit 1
-fi
diff --git a/src/compiler/glsl/tests/optimization-test.sh b/src/compiler/glsl/tests/optimization-test.sh
new file mode 100755 (executable)
index 0000000..9cc3cae
--- /dev/null
@@ -0,0 +1,42 @@
+#!/usr/bin/env bash
+
+if [ ! -z "$srcdir" ]; then
+   compare_ir=`pwd`/tests/compare_ir.py
+else
+   compare_ir=./compare_ir.py
+fi
+
+total=0
+pass=0
+
+echo "======       Generating tests      ======"
+for dir in tests/*/; do
+    if [ -e "${dir}create_test_cases.py" ]; then
+        cd $dir; $PYTHON2 create_test_cases.py; cd ..
+    fi
+    echo "$dir"
+done
+
+echo "====== Testing optimization passes ======"
+for test in `find . -iname '*.opt_test'`; do
+    echo -n "Testing $test..."
+    (cd `dirname "$test"`; ./`basename "$test"`) > "$test.out" 2>&1
+    total=$((total+1))
+    if $PYTHON2 $PYTHON_FLAGS $compare_ir "$test.expected" "$test.out" >/dev/null 2>&1; then
+        echo "PASS"
+        pass=$((pass+1))
+    else
+        echo "FAIL"
+        $PYTHON2 $PYTHON_FLAGS $compare_ir "$test.expected" "$test.out"
+    fi
+done
+
+echo ""
+echo "$pass/$total tests returned correct results"
+echo ""
+
+if [[ $pass == $total ]]; then
+    exit 0
+else
+    exit 1
+fi
diff --git a/src/compiler/glsl/tests/warnings-test b/src/compiler/glsl/tests/warnings-test
deleted file mode 100755 (executable)
index 1bea466..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-#!/usr/bin/env bash
-
-# Execute several shaders, and check that the InfoLog outcome is the expected.
-
-compiler=./glsl_compiler
-total=0
-pass=0
-
-echo "====== Testing compilation output ======"
-for test in `find . -iname '*.vert'`; do
-    echo -n "Testing $test..."
-    $compiler --just-log --version 150 "$test" > "$test.out" 2>&1
-    total=$((total+1))
-    if diff "$test.expected" "$test.out" >/dev/null 2>&1; then
-        echo "PASS"
-        pass=$((pass+1))
-    else
-        echo "FAIL"
-        diff "$test.expected" "$test.out"
-    fi
-done
-
-echo ""
-echo "$pass/$total tests returned correct results"
-echo ""
-
-if [[ $pass == $total ]]; then
-    exit 0
-else
-    exit 1
-fi
diff --git a/src/compiler/glsl/tests/warnings-test.sh b/src/compiler/glsl/tests/warnings-test.sh
new file mode 100755 (executable)
index 0000000..1bea466
--- /dev/null
@@ -0,0 +1,31 @@
+#!/usr/bin/env bash
+
+# Execute several shaders, and check that the InfoLog outcome is the expected.
+
+compiler=./glsl_compiler
+total=0
+pass=0
+
+echo "====== Testing compilation output ======"
+for test in `find . -iname '*.vert'`; do
+    echo -n "Testing $test..."
+    $compiler --just-log --version 150 "$test" > "$test.out" 2>&1
+    total=$((total+1))
+    if diff "$test.expected" "$test.out" >/dev/null 2>&1; then
+        echo "PASS"
+        pass=$((pass+1))
+    else
+        echo "FAIL"
+        diff "$test.expected" "$test.out"
+    fi
+done
+
+echo ""
+echo "$pass/$total tests returned correct results"
+echo ""
+
+if [[ $pass == $total ]]; then
+    exit 0
+else
+    exit 1
+fi