1 | #!/bin/sh |
---|
2 | # runtests.sh |
---|
3 | |
---|
4 | set -e |
---|
5 | TEST_DIR=`pwd` |
---|
6 | export DYLD_LIBRARY_PATH=${TEST_DIR}/.. |
---|
7 | export LD_LIBRARY_PATH=${TEST_DIR}/.. |
---|
8 | |
---|
9 | mkdir -p test-repository |
---|
10 | |
---|
11 | # copy files into test-repository (by hand to avoid calling `chicken-install'): |
---|
12 | |
---|
13 | for x in setup-api.so setup-api.import.so setup-download.so \ |
---|
14 | setup-download.import.so chicken.import.so lolevel.import.so \ |
---|
15 | srfi-1.import.so srfi-4.import.so data-structures.import.so \ |
---|
16 | ports.import.so files.import.so posix.import.so \ |
---|
17 | srfi-13.import.so srfi-69.import.so extras.import.so \ |
---|
18 | regex.import.so srfi-14.import.so tcp.import.so \ |
---|
19 | foreign.import.so scheme.import.so srfi-18.import.so \ |
---|
20 | utils.import.so csi.import.so irregex.import.so types.db; do |
---|
21 | cp ../$x test-repository |
---|
22 | done |
---|
23 | |
---|
24 | $TEST_DIR/../chicken-install -init test-repository export |
---|
25 | CHICKEN_REPOSITORY=$TEST_DIR/test-repository |
---|
26 | CHICKEN=../chicken |
---|
27 | |
---|
28 | if test -n "$MSYSTEM"; then |
---|
29 | CHICKEN="..\\chicken.exe" |
---|
30 | fi |
---|
31 | |
---|
32 | compile="../csc -compiler $CHICKEN -v -I.. -L.. -include-path .. -o a.out" |
---|
33 | compile_s="../csc -s -compiler $CHICKEN -v -I.. -L.. -include-path .." |
---|
34 | interpret="../csi -n -include-path .." |
---|
35 | |
---|
36 | echo "======================================== compiler tests ..." |
---|
37 | $compile compiler-tests.scm |
---|
38 | ./a.out |
---|
39 | |
---|
40 | echo "======================================== compiler tests (2) ..." |
---|
41 | $compile compiler-tests.scm -lambda-lift |
---|
42 | ./a.out |
---|
43 | |
---|
44 | echo "======================================== scrutiny tests ..." |
---|
45 | $compile scrutiny-tests.scm -scrutinize -analyze-only -ignore-repository -types ../types.db 2>scrutiny.out |
---|
46 | |
---|
47 | if test -n "$MSYSTEM"; then |
---|
48 | dos2unix scrutiny.out |
---|
49 | fi |
---|
50 | |
---|
51 | # this is sensitive to gensym-names, so make it optional |
---|
52 | if test \! -f scrutiny.expected; then |
---|
53 | cp scrutiny.out scrutiny.expected |
---|
54 | fi |
---|
55 | |
---|
56 | diff -u scrutiny.out scrutiny.expected || true |
---|
57 | |
---|
58 | echo "======================================== runtime tests ..." |
---|
59 | $interpret -s apply-test.scm |
---|
60 | $compile test-gc-hooks.scm |
---|
61 | ./a.out |
---|
62 | |
---|
63 | echo "======================================== library tests ..." |
---|
64 | $interpret -s library-tests.scm |
---|
65 | |
---|
66 | echo "======================================== syntax tests ..." |
---|
67 | $interpret -s syntax-tests.scm |
---|
68 | |
---|
69 | echo "======================================== syntax tests (compiled) ..." |
---|
70 | $compile syntax-tests.scm |
---|
71 | ./a.out |
---|
72 | |
---|
73 | echo "======================================== syntax tests (2, compiled) ..." |
---|
74 | $compile syntax-tests-2.scm |
---|
75 | ./a.out |
---|
76 | |
---|
77 | #echo "======================================== meta-syntax tests ..." |
---|
78 | #$interpret -bnq meta-syntax-test.scm -e '(import foo)' -e '(bar 1 2)' |
---|
79 | #$compile_s -s meta-syntax-test.scm -j foo |
---|
80 | #$compile_s -s foo.import.scm |
---|
81 | #$interpret -bnq -e '(require-library meta-syntax-test)' -e '(import foo)' -e '(bar 1 2)' |
---|
82 | |
---|
83 | echo "======================================== compiler syntax tests ..." |
---|
84 | $compile compiler-syntax-tests.scm |
---|
85 | ./a.out |
---|
86 | |
---|
87 | echo "======================================== import library tests ..." |
---|
88 | rm -f foo.import.* |
---|
89 | $compile import-library-test1.scm -emit-import-library foo |
---|
90 | $interpret -s import-library-test2.scm |
---|
91 | $compile_s -s foo.import.scm -o foo.import.so |
---|
92 | $interpret -s import-library-test2.scm |
---|
93 | $compile import-library-test2.scm |
---|
94 | ./a.out |
---|
95 | |
---|
96 | echo "======================================== syntax tests (matchable) ..." |
---|
97 | $interpret matchable.scm -s match-test.scm |
---|
98 | |
---|
99 | echo "======================================== syntax tests (loopy-loop) ..." |
---|
100 | $interpret -s loopy-test.scm |
---|
101 | |
---|
102 | echo "======================================== syntax tests (r5rs_pitfalls) ..." |
---|
103 | $interpret -i -s r5rs_pitfalls.scm |
---|
104 | |
---|
105 | echo "======================================== module tests ..." |
---|
106 | $interpret -include-path .. -s module-tests.scm |
---|
107 | |
---|
108 | echo "======================================== module tests (compiled) ..." |
---|
109 | $compile module-tests-compiled.scm |
---|
110 | ./a.out |
---|
111 | |
---|
112 | echo "======================================== module tests (chained) ..." |
---|
113 | rm -f m*.import.* test-chained-modules.so |
---|
114 | $interpret -bnq test-chained-modules.scm |
---|
115 | $compile_s test-chained-modules.scm -j m3 |
---|
116 | $compile_s m3.import.scm |
---|
117 | $interpret -bn test-chained-modules.so |
---|
118 | $interpret -bn test-chained-modules.so -e '(import m3) (s3)' |
---|
119 | |
---|
120 | echo "======================================== module tests (ec) ..." |
---|
121 | rm -f ec.so ec.import.* |
---|
122 | $interpret -bqn ec.scm ec-tests.scm |
---|
123 | $compile_s ec.scm -emit-import-library ec -o ec.so |
---|
124 | $compile_s ec.import.scm -o ec.import.so |
---|
125 | $interpret -bnq ec.so ec-tests.scm |
---|
126 | # $compile ec-tests.scm |
---|
127 | # ./a.out # takes ages to compile |
---|
128 | |
---|
129 | echo "======================================== hash-table tests ..." |
---|
130 | $interpret -s hash-table-tests.scm |
---|
131 | |
---|
132 | echo "======================================== lolevel tests ..." |
---|
133 | $interpret -s lolevel-tests.scm |
---|
134 | |
---|
135 | echo "======================================== port tests ..." |
---|
136 | $interpret -s port-tests.scm |
---|
137 | |
---|
138 | echo "======================================== fixnum tests ..." |
---|
139 | $compile fixnum-tests.scm |
---|
140 | ./a.out |
---|
141 | |
---|
142 | echo "======================================== srfi-18 tests ..." |
---|
143 | $interpret -s srfi-18-tests.scm |
---|
144 | echo "*** Skipping \"feeley-dynwind\" (for now) ***" |
---|
145 | # $interpret -s feeley-dynwind.scm |
---|
146 | |
---|
147 | echo "======================================== path tests ..." |
---|
148 | $interpret -bnq path-tests.scm |
---|
149 | |
---|
150 | echo "======================================== regular expression tests ..." |
---|
151 | $interpret -bnq test-irregex.scm |
---|
152 | |
---|
153 | echo "======================================== r4rstest ..." |
---|
154 | $interpret -e '(set! ##sys#procedure->string (constantly "#<procedure>"))' \ |
---|
155 | -i -s r4rstest.scm >r4rstest.log |
---|
156 | |
---|
157 | if test -n "$MSYSTEM"; then |
---|
158 | # the windows runtime library prints flonums differently |
---|
159 | tail r4rstest.log |
---|
160 | else |
---|
161 | diff -bu r4rstest.out r4rstest.log || true |
---|
162 | fi |
---|
163 | |
---|
164 | echo "======================================== compiler/nursery stress test ..." |
---|
165 | for s in 100000 120000 200000 250000 300000 350000 400000 450000 500000; do |
---|
166 | echo " $s" |
---|
167 | ../chicken ../utils.scm -:s$s -output-file tmp.c -include-path .. |
---|
168 | done |
---|
169 | |
---|
170 | echo "======================================== finalizer tests ..." |
---|
171 | $interpret -s test-finalizers.scm |
---|
172 | |
---|
173 | echo "======================================== finalizer tests (2) ..." |
---|
174 | $compile test-finalizers-2.scm |
---|
175 | ./a.out |
---|
176 | |
---|
177 | echo "======================================== locative stress test ..." |
---|
178 | $compile locative-stress-test.scm |
---|
179 | ./a.out |
---|
180 | |
---|
181 | echo "======================================== embedding (1) ..." |
---|
182 | $compile embedded1.c |
---|
183 | ./a.out |
---|
184 | |
---|
185 | echo "======================================== embedding (2) ..." |
---|
186 | $compile -e embedded2.scm |
---|
187 | ./a.out |
---|
188 | |
---|
189 | echo "======================================== benchmarks ..." |
---|
190 | cd ../benchmarks |
---|
191 | for x in `ls *.scm`; do |
---|
192 | case $x in |
---|
193 | "cscbench.scm");; |
---|
194 | "plists.scm");; |
---|
195 | *) |
---|
196 | echo $x |
---|
197 | ../csc $x -compiler $CHICKEN -I.. -L.. -O3 -d0 |
---|
198 | ./`basename $x .scm`;; |
---|
199 | esac |
---|
200 | done |
---|
201 | cd ${TEST_DIR} |
---|
202 | |
---|
203 | echo "======================================== done." |
---|