blob: 7410db64f147c1e1ea746903e9deb239f2cd03bd (
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
|
#!/bin/sh
if [ ! -z "$srcdir" ]; then
compare_ir=`pwd`/tests/compare_ir.py
else
compare_ir=./compare_ir.py
fi
if [ -z "$PYTHON2" ]; then
PYTHON2=python2
fi
which $PYTHON2 >/dev/null
if [ $? -ne 0 ]; then
echo "Could not find python2. Make sure that PYTHON2 variable is correctly set."
exit 1
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
|