From: Matt Turner Date: Mon, 8 Dec 2014 07:43:00 +0000 (-0800) Subject: glcpp: Make tests write .out files to builddir. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=a29ae0b3ddce0f4cda633d3be3f7380178522bbf;p=mesa.git glcpp: Make tests write .out files to builddir. --- diff --git a/src/glsl/glcpp/tests/glcpp-test b/src/glsl/glcpp/tests/glcpp-test index ea69edfd8b0..825c22e71fb 100755 --- a/src/glsl/glcpp/tests/glcpp-test +++ b/src/glsl/glcpp/tests/glcpp-test @@ -2,9 +2,11 @@ if [ ! -z "$srcdir" ]; then testdir=$srcdir/glcpp/tests + outdir=`pwd`/glcpp/tests glcpp=`pwd`/glcpp/glcpp else testdir=. + outdir=. glcpp=../glcpp fi @@ -43,6 +45,7 @@ for option; do ;; "--testdir="*) testdir="${option#--testdir=}" + outdir="${outdir}/${option#--testdir=}" ;; *) echo "Unrecognized option: $option" >&2 @@ -57,17 +60,21 @@ total=0 pass=0 clean=0 +mkdir -p $outdir + echo "====== Testing for correctness ======" for test in $testdir/*.c; do - printf "Testing $test..." - $glcpp $(test_specific_args $test) < $test > $test.out 2>&1 + 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 $test.out >/dev/null 2>&1; then + if cmp $test.expected $out >/dev/null 2>&1; then echo "PASS" pass=$((pass+1)) else echo "FAIL" - diff -u $test.expected $test.out + diff -u $test.expected $out fi done diff --git a/src/glsl/glcpp/tests/glcpp-test-cr-lf b/src/glsl/glcpp/tests/glcpp-test-cr-lf index 7988c058787..c4ed0b86d74 100755 --- a/src/glsl/glcpp/tests/glcpp-test-cr-lf +++ b/src/glsl/glcpp/tests/glcpp-test-cr-lf @@ -99,7 +99,7 @@ mkdir subtest-cr for file in "$testdir"/*.c; do base=$(basename "$file") tr "\n" "\r" < "$file" > subtest-cr/"$base" - cp subtest-lf/"$base".out subtest-cr/"$base".expected + cp `pwd`/glcpp/tests/subtest-lf/"$base".out subtest-cr/"$base".expected done run_test "${glcpp_test} --testdir=subtest-cr" @@ -112,7 +112,7 @@ mkdir subtest-cr-lf for file in "$testdir"/*.c; do base=$(basename "$file") sed -e 's/$/ /' < "$file" > subtest-cr-lf/"$base" - cp subtest-lf/"$base".out subtest-cr-lf/"$base".expected + cp `pwd`/glcpp/tests/subtest-lf/"$base".out subtest-cr-lf/"$base".expected done run_test "${glcpp_test} --testdir=subtest-cr-lf" @@ -125,7 +125,7 @@ mkdir subtest-lf-cr for file in "$testdir"/*.c; do base=$(basename "$file") sed -e 's/$/ /' < "$file" | tr "\n\r" "\r\n" > subtest-lf-cr/"$base" - cp subtest-lf/"$base".out subtest-lf-cr/"$base".expected + cp `pwd`/glcpp/tests/subtest-lf/"$base".out subtest-lf-cr/"$base".expected done run_test "${glcpp_test} --testdir=subtest-lf-cr"