summaryrefslogtreecommitdiff
path: root/src/glsl/glcpp/tests/glcpp-test
blob: cfe7e9787863f7150918ec4a7af681aaa857f8a6 (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
#!/bin/sh

total=0
pass=0
clean=0

echo "====== Testing for correctness ======"
for test in *.c; do
    echo -n "Testing $test..."
    ../glcpp < $test > $test.out
    total=$((total+1))
    if cmp $test.expected $test.out; then
	echo "PASS"
	pass=$((pass+1))
    else
	echo "FAIL"
	diff -u $test.expected $test.out
    fi
done

echo ""
echo "$pass/$total tests returned correct results"
echo ""

echo "====== Testing for valgrind cleanliness ======"
for test in *.c; do
    echo -n "Testing $test with valgrind..."
    if valgrind --error-exitcode=1 --log-file=$test.valgrind-errors ../glcpp < $test >/dev/null; then
	echo "CLEAN"
	clean=$((clean+1))
	rm $test.valgrind-errors
    else
	echo "ERRORS"
	cat $test.valgrind-errors
    fi
done

echo ""
echo "$pass/$total tests returned correct results"
echo "$clean/$total tests are valgrind-clean"

if [ "$pass" = "$total" ] && [ "$clean" = "$total" ]; then
    exit 0
else
    exit 1
fi