blob: c160ef9f89de2ea5942ca13e6394e0d0c78296ee (
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
|
#!/usr/bin/env bash
set -e
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
cd $DIR
SAILDIR="$DIR/../.."
RED='\033[0;91m'
GREEN='\033[0;92m'
YELLOW='\033[0;93m'
NC='\033[0m'
rm -f $DIR/tests.xml
pass=0
fail=0
XML=""
function green {
(( pass += 1 ))
printf "$1: ${GREEN}$2${NC}\n"
XML+=" <testcase name=\"$1\"/>\n"
}
function yellow {
(( fail += 1 ))
printf "$1: ${YELLOW}$2${NC}\n"
XML+=" <testcase name=\"$1\">\n <error message=\"$2\">$2</error>\n </testcase>\n"
}
function red {
(( fail += 1 ))
printf "$1: ${RED}$2${NC}\n"
XML+=" <testcase name=\"$1\">\n <error message=\"$2\">$2</error>\n </testcase>\n"
}
function finish_suite {
printf "$1: Passed ${pass} out of $(( pass + fail ))\n\n"
XML=" <testsuite name=\"$1\" tests=\"$(( pass + fail ))\" failures=\"${fail}\" timestamp=\"$(date)\">\n$XML </testsuite>\n"
printf "$XML" >> $DIR/tests.xml
XML=""
pass=0
fail=0
}
printf "<testsuites>\n" >> $DIR/tests.xml
for i in `ls -d */`;
do
cd $DIR/$i;
if $SAILDIR/sail -no_warn -o out -ocaml ../prelude.sail `ls *.sail` 1> /dev/null;
then
./out > result;
if diff expect result;
then
green "built $i" "ok"
else
yellow "bad output $i" "fail"
fi;
rm out;
rm result;
rm -r _sbuild
else
red "building $i" "fail"
fi
done
finish_suite "Ocaml testing"
cd $DIR
for i in `ls -d */`;
do
cd $DIR/$i;
if $SAILDIR/sail -no_warn -o out -ocaml -trace ../prelude.sail `ls *.sail` 1> /dev/null;
then
./out > result 2> /dev/null;
if diff expect result;
then
green "built $i" "ok"
else
red "bad output $i" "fail"
fi;
rm out;
rm result;
rm -r _sbuild
else
red "building $i" "fail"
fi
done
finish_suite "Ocaml trace testing"
cd $DIR
for i in `ls -d */`;
do
cd $DIR/$i;
if $SAILDIR/sail -no_warn -is test.isail ../prelude.sail `ls *.sail` 1> /dev/null;
then
if diff expect result;
then
green "interpreted $i" "ok"
else
red "bad output $i" "fail"
fi;
rm result
else
red "interpreter crashed on $i" "fail"
fi
done
finish_suite "Interpreter testing"
printf "</testsuites>\n" >> $DIR/tests.xml
|