-
Notifications
You must be signed in to change notification settings - Fork 0
/
run-tests.bash
executable file
·222 lines (202 loc) · 4.83 KB
/
run-tests.bash
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
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
#!/bin/bash
# This program and the accompanying materials are made available under the
# terms of the MIT license (X11 license) which accompanies this distribution.
# author: C. Bürger
################################################################################################################ Parse arguments:
supported_systems=( racket guile larceny petite )
selected_systems=()
while getopts s: opt
do
case $opt in
s)
if [[ " ${supported_systems[@]} " =~ " ${OPTARG} " ]]
then
if which "${OPTARG}" > /dev/null
then
selected_systems+=( "$OPTARG" )
else
echo " !!! ERROR: [$OPTARG] not installed !!!" >&2
exit 2
fi
else
echo " !!! ERROR: Unknown [$OPTARG] Scheme system !!!" >&2
exit 2
fi;;
?)
echo "Usage: -s Scheme system (${supported_systems[@]})"
exit 2
esac
done
shift $(( OPTIND - 1 ))
if [ -z "$selected_systems" ]
then
for s in ${supported_systems[@]}
do
if which "$s" > /dev/null
then
selected_systems+=( "$s" )
fi
done
if [ -z "$selected_systems" ]
then
echo " !!! ERROR: No Scheme system found !!!" >&2
exit 2
fi
fi
old_pwd=`pwd`
##################################################################################################### Define execution functions:
begin_run(){
echo `pwd`/$1
}
racket_run(){
if [[ " ${selected_systems[@]} " =~ "racket" ]]
then
printf " Racket"
if [ "$1" == "" ]
then
libs="++path $old_pwd/racr/racket-bin"
else
libs="++path $old_pwd/racr/racket-bin ++path $1"
fi
plt-r6rs $libs $2
fi
}
guile_run(){
if [[ " ${selected_systems[@]} " =~ "guile" ]]
then
printf " Guile"
if [ "$1" == "" ]
then
llibs="-L $old_pwd/racr/guile-bin"
clibs="-C $old_pwd/racr/guile-bin"
else
llibs="-L $old_pwd/racr/guile-bin -L $1"
clibs="-C $old_pwd/racr/guile-bin -C $1"
fi
guile --no-auto-compile $llibs $clibs -s $2
fi
}
larceny_run(){
if [[ " ${selected_systems[@]} " =~ "larceny" ]]
then
printf " Larceny"
if [ "$1" == "" ]
then
libs="--path $old_pwd/racr/larceny-bin"
else
libs="--path $old_pwd/racr/larceny-bin:$1"
fi
larceny --r6rs $libs --program $2
fi
}
petite_run(){
if [[ " ${selected_systems[@]} " =~ "petite" ]]
then
printf " Petite"
if [ "$1" == "" ]
then
libs="--libdirs $old_pwd"
else
libs="--libdirs $old_pwd:$1"
fi
petite $libs --program $2
fi
}
end_run(){
echo ""
}
################################################################################################################## Execute tests:
echo "=========================================>>> Run Tests:"
# Test basic API:
cd $old_pwd/tests
for f in *.scm
do
begin_run $f
racket_run "" $f
guile_run "" $f
larceny_run "" $f
petite_run "" $f
end_run
done
# Test binary numbers example:
cd $old_pwd/examples/binary-numbers
begin_run binary-numbers.scm
racket_run "" binary-numbers.scm
guile_run "" binary-numbers.scm
larceny_run "" binary-numbers.scm
petite_run "" binary-numbers.scm
end_run
# Test state machines example:
cd $old_pwd/examples/state-machines
begin_run state-machines.scm
racket_run "" state-machines.scm
guile_run "" state-machines.scm
larceny_run "" state-machines.scm
petite_run "" state-machines.scm
end_run
# Test atomic Petri nets example:
cd $old_pwd/examples/atomic-petrinets/examples
for f in *.scm
do
begin_run $f
racket_run "./../racket-bin" $f
guile_run "./../guile-bin" $f
larceny_run "./../larceny-bin" $f
petite_run "./../.." $f
end_run
done
# Test Petri nets example:
cd $old_pwd/examples/petrinets/examples
for f in *.scm
do
begin_run $f
racket_run "./../racket-bin" $f
#guile_run "./../guile-bin" $f # Disabled because of issue 37.
larceny_run "./../larceny-bin" $f
petite_run "./../.." $f
end_run
done
# Test SiPLE example:
cd $old_pwd/examples/siple/examples/correct
for f in *.siple
do
begin_run $f
racket_run "./../../racket-bin" "./../run-correct.scm $f"
guile_run "./../../guile-bin" "./../run-correct.scm $f"
larceny_run "./../../larceny-bin" "./../run-correct.scm -- $f"
petite_run "./../../.." "./../run-correct.scm $f"
end_run
done
cd $old_pwd/examples/siple/examples/incorrect
for f in *.siple
do
begin_run $f
racket_run "./../../racket-bin" "./../run-incorrect.scm $f"
guile_run "./../../guile-bin" "./../run-incorrect.scm $f"
larceny_run "./../../larceny-bin" "./../run-incorrect.scm -- $f"
petite_run "./../../.." "./../run-incorrect.scm $f"
end_run
done
# Test Tiny C++ example:
cd $old_pwd/profiling/tinycpp/examples
if [[ " ${selected_systems[@]} " =~ "racket" ]]
then
echo "Tiny C++ Racket:"
./run-examples.bash Racket
fi
if [[ " ${selected_systems[@]} " =~ "guile" ]]
then
echo "Tiny C++ Guile:"
./run-examples.bash Guile
fi
if [[ " ${selected_systems[@]} " =~ "larceny" ]]
then
echo "Tiny C++ Larceny:"
./run-examples.bash Larceny
fi
if [[ " ${selected_systems[@]} " =~ "petite" ]]
then
echo "Tiny C++ Petite Chez Scheme:"
./run-examples.bash Petite
fi
cd $old_pwd