-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.sh
executable file
·190 lines (154 loc) · 6.79 KB
/
test.sh
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
#!/bin/sh
if [ "${SCHEME_IMPL}x" = "x" ]; then
# user didn't care to specify. let's pick one.
if [ ! -z `which csi` ]; then
export SCHEME_IMPL=csi
elif [ ! -z `which huski` ]; then
export SCHEME_IMPL=huski
elif [ ! -z `which plt-r5rs` ]; then
export SCHEME_IMPL=plt-r5rs
elif [ ! -z `which miniscm` ]; then
export SCHEME_IMPL=miniscm
else
echo "No Scheme implementation (SCHEME_IMPL) selected, and"
echo "no suitable Scheme implementation was found on your path."
exit 1
fi
fi
if [ `which ${SCHEME_IMPL}`x = "x" ]; then
echo "Your selected Scheme implementation, $SCHEME_IMPL, was not found."
exit 1
fi
if [ "${PIXLEY_IMPL}x" = "x" ]; then
export PIXLEY_IMPL=mignon
fi
if [ "${PIXLEY_PIX}x" = "x" ]; then
export PIXLEY_PIX=src/pixley.pix
fi
if [ `which realpath`x = "x" ]; then
echo "You need 'realpath' installed to run tower.sh."
exit 1
fi
echo "Sanity-testing tower.sh..."
cat >expected.sexp <<EOF
(two three)
EOF
script/tower.sh eg/simple.pix > out.sexp
diff -u expected.sexp out.sexp || exit 1
script/tower.sh $PIXLEY_PIX eg/simple.pix > out.sexp
diff -u expected.sexp out.sexp || exit 1
rm -f expected.sexp out.sexp
cat >expected.sexp <<EOF
(ten (eight nine) seven six five four three two one)
EOF
script/tower.sh eg/reverse.pix eg/some-list.sexp > out.sexp
diff -u expected.sexp out.sexp || exit 1
script/tower.sh $PIXLEY_PIX eg/reverse.pix eg/some-list.sexp > out.sexp
diff -u expected.sexp out.sexp || exit 1
rm -f expected.sexp out.sexp
echo "Testing Pixley programs on [${SCHEME_IMPL}]..."
cat >config.markdown <<EOF
-> Functionality "Interpret Pixley Program" is implemented by shell command
-> "script/tower.sh %(test-body-file)"
EOF
falderal config.markdown src/tests.markdown || exit 1
echo "Testing Pixley programs on [${PIXLEY_IMPL}] (via scheme-adapter.sh)..."
cat >config.markdown <<EOF
-> Functionality "Interpret Pixley Program" is implemented by shell command
-> "SCHEME_IMPL=${PIXLEY_IMPL} script/scheme-adapter.sh /dev/null %(test-body-file)"
EOF
falderal config.markdown src/tests.markdown || exit 1
if [ "x$JUST_THE_BASICS" != "x" ]; then
exit 0
fi
echo "Testing Pixley programs on [${PIXLEY_IMPL}] (via tower.sh)..."
cat >config.markdown <<EOF
-> Functionality "Interpret Pixley Program" is implemented by shell command
-> "SCHEME_IMPL=${SCHEME_IMPL} FINAL_SCHEME_IMPL=${PIXLEY_IMPL} script/tower.sh %(test-body-file)"
EOF
falderal config.markdown src/tests.markdown || exit 1
echo "Testing Pixley programs on Pixley interpreter on [${SCHEME_IMPL}]..."
cat >config.markdown <<EOF
-> Functionality "Interpret Pixley Program" is implemented by shell command
-> "script/tower.sh $PIXLEY_PIX %(test-body-file)"
EOF
falderal config.markdown src/tests.markdown || exit 1
echo "Testing Pixley programs on Pixley interpreter on [${PIXLEY_IMPL}]..."
cat >config.markdown <<EOF
-> Functionality "Interpret Pixley Program" is implemented by shell command
-> "SCHEME_IMPL=${SCHEME_IMPL} FINAL_SCHEME_IMPL=${PIXLEY_IMPL} script/tower.sh $PIXLEY_PIX %(test-body-file)"
EOF
falderal config.markdown src/tests.markdown || exit 1
echo "Testing Pixley programs on Pixley interpreter on Pixley interpreter on [${SCHEME_IMPL}]..."
cat >config.markdown <<EOF
-> Functionality "Interpret Pixley Program" is implemented by shell command
-> "script/tower.sh $PIXLEY_PIX $PIXLEY_PIX %(test-body-file)"
EOF
falderal config.markdown src/tests.markdown || exit 1
echo "Testing Pixley programs on Pixley interpreter on Pixley interpreter on [${PIXLEY_IMPL}]..."
cat >config.markdown <<EOF
-> Functionality "Interpret Pixley Program" is implemented by shell command
-> "SCHEME_IMPL=${SCHEME_IMPL} FINAL_SCHEME_IMPL=${PIXLEY_IMPL} script/tower.sh $PIXLEY_PIX $PIXLEY_PIX %(test-body-file)"
EOF
falderal config.markdown src/tests.markdown || exit 1
# On my computer, the following test takes about 19 seconds on plt-r5rs, but
# about 32 minutes with tinyscheme -- possibly because of frequent GC?
# Meanwhile, it breaks miniscm completely.
#
#echo "Testing Pixley programs on (Pixley reference interpreter)^3..."
#cat >config.markdown <<EOF
# -> Functionality "Interpret Pixley Program" is implemented by shell command
# -> "script/tower.sh $PIXLEY_PIX $PIXLEY_PIX $PIXLEY_PIX %(test-body-file)"
#EOF
#falderal config.markdown src/tests.markdown || exit 1
# And if you have an hour or so to kill, you can try the next level up!
# (That's with plt-r5rs; I imagine tinyscheme would take much longer)
#
#echo "Testing Pixley programs on (Pixley reference interpreter)^4..."
#cat >config.markdown <<EOF
# -> Functionality "Interpret Pixley Program" is implemented by shell command
# -> "script/tower.sh $PIXLEY_PIX $PIXLEY_PIX $PIXLEY_PIX $PIXLEY_PIX %(test-body-file)"
#EOF
#falderal config.markdown src/tests.markdown || exit 1
echo "Running Falderal tests for P-Normalizer..."
falderal dialect/P-Normal.markdown || exit 1
echo "P-Normalizing Pixley interpreter..."
script/tower.sh $PIXLEY_PIX dialect/p-normal.pix $PIXLEY_PIX > src/p-normal-pixley.pix
cat >config.markdown <<EOF
-> Functionality "Interpret Pixley Program" is implemented by shell command
-> "script/tower.sh src/p-normal-pixley.pix %(test-body-file)"
EOF
echo "Testing Pixley programs on P-Normalized interpreter..."
falderal config.markdown src/tests.markdown || exit 1
rm -f src/p-normal-pixley.pix
echo "Testing Pixley programs on Pixley interpreter in Pifxley..."
cat >config.markdown <<EOF
-> Functionality "Interpret Pixley Program" is implemented by shell command
-> "script/tower.sh dialect/pixley.pifx %(test-body-file)"
EOF
falderal config.markdown src/tests.markdown || exit 1
echo "Testing Pifxley programs as Scheme..."
cat >config.markdown <<EOF
-> Functionality "Interpret Pifxley Program" is implemented by shell command
-> "script/tower.sh %(test-body-file)"
EOF
falderal config.markdown dialect/Pifxley.markdown || exit 1
echo "Testing Pifxley programs on Pifxley interpreter in Pifxley..."
cat >config.markdown <<EOF
-> Functionality "Interpret Pifxley Program" is implemented by shell command
-> "script/tower.sh dialect/pifxley.pifx %(test-body-file)"
EOF
falderal config.markdown dialect/Pifxley.markdown || exit 1
echo "Testing Pixley programs on Crabwell interpreter..."
cat >config.markdown <<EOF
-> Functionality "Interpret Pixley Program" is implemented by shell command
-> "script/tower.sh dialect/crabwell.pix %(test-body-file)"
EOF
falderal config.markdown src/tests.markdown || exit 1
echo "Testing Crabwell programs on Crabwell interpreter..."
cat >config.markdown <<EOF
-> Functionality "Interpret Crabwell Program" is implemented by shell command
-> "script/tower.sh dialect/crabwell.pix %(test-body-file)"
EOF
falderal config.markdown dialect/Crabwell.markdown || exit 1
rm -f config.markdown