Commit | Line | Data |
---|---|---|
31690700 JM |
1 | # |
2 | # Command line settings | |
3 | # | |
4 | ||
5 | MAL_IMPL = js | |
6 | ||
a05f7822 JM |
7 | PYTHON = python |
8 | ||
31690700 JM |
9 | # |
10 | # Settings | |
11 | # | |
12 | ||
58b84dd5 | 13 | IMPLS = bash c clojure coffee cpp crystal cs erlang factor forth go groovy \ |
a9cd6543 | 14 | haskell java julia js lua make mal ocaml matlab miniMAL nim \ |
80320efc | 15 | perl php ps python r racket rpython ruby rust scala swift vb guile |
31690700 JM |
16 | |
17 | step0 = step0_repl | |
18 | step1 = step1_read_print | |
19 | step2 = step2_eval | |
20 | step3 = step3_env | |
21 | step4 = step4_if_fn_do | |
22 | step5 = step5_tco | |
23 | step6 = step6_file | |
24 | step7 = step7_quote | |
25 | step8 = step8_macros | |
01c97316 | 26 | step9 = step9_try |
90f618cb | 27 | stepA = stepA_mal |
31690700 | 28 | |
cc021efe JM |
29 | EXCLUDE_TESTS += test^bash^step5 # no stack exhaustion or completion |
30 | EXCLUDE_TESTS += test^c^step5 # segfault | |
0fbd1b81 | 31 | EXCLUDE_TESTS += test^cpp^step5 # completes at 10,000 |
cc021efe | 32 | EXCLUDE_TESTS += test^cs^step5 # fatal stack overflow fault |
e07b9830 | 33 | EXCLUDE_TESTS += test^erlang^step5 # erlang is TCO, test passes |
7907cd90 | 34 | EXCLUDE_TESTS += test^haskell^step5 # test completes |
cc021efe JM |
35 | EXCLUDE_TESTS += test^make^step5 # no TCO capability/step |
36 | EXCLUDE_TESTS += test^mal^step5 # no TCO capability/step | |
dbac60df JM |
37 | EXCLUDE_TESTS += test^miniMAL^step5 # strange error with runtest.py |
38 | EXCLUDE_TESTS += test^nim^step5 # test completes, even at 100,000 | |
17e1c5f9 | 39 | EXCLUDE_TESTS += test^go^step5 # test completes, even at 100,000 |
cc021efe | 40 | EXCLUDE_TESTS += test^php^step5 # test completes, even at 100,000 |
7907cd90 | 41 | EXCLUDE_TESTS += test^racket^step5 # test completes |
cc021efe | 42 | EXCLUDE_TESTS += test^ruby^step5 # test completes, even at 100,000 |
a77e2b31 | 43 | EXCLUDE_TESTS += test^rust^step5 # no catching stack overflows |
44d4e31f | 44 | EXCLUDE_TESTS += test^ocaml^step5 # test completes, even at 1,000,000 |
dbac60df | 45 | EXCLUDE_TESTS += test^vb^step5 # completes at 10,000 |
725ee0bd | 46 | EXCLUDE_TESTS += test^crystal^step5 # test completes, even at 1,000,000 |
cc021efe | 47 | |
db4c329a | 48 | EXCLUDE_PERFS = perf^mal # TODO: fix this |
31690700 JM |
49 | |
50 | # | |
51 | # Utility functions | |
52 | # | |
53 | ||
54 | STEP_TEST_FILES = $(strip $(wildcard $(1)/tests/$($(2)).mal) $(wildcard tests/$($(2)).mal)) | |
55 | ||
db4c329a JM |
56 | bash_STEP_TO_PROG = bash/$($(1)).sh |
57 | c_STEP_TO_PROG = c/$($(1)) | |
31690700 | 58 | clojure_STEP_TO_PROG = clojure/src/$($(1)).clj |
891c3f3b | 59 | coffee_STEP_TO_PROG = coffee/$($(1)).coffee |
9ddaa0b9 | 60 | cpp_STEP_TO_PROG = cpp/$($(1)) |
86fe6314 | 61 | crystal_STEP_TO_PROG = crystal/$($(1)) |
db4c329a | 62 | cs_STEP_TO_PROG = cs/$($(1)).exe |
2cc3804b | 63 | erlang_STEP_TO_PROG = erlang/$($(1)) |
389c9b8a | 64 | factor_STEP_TO_PROG = factor/src/$($(1))/$($(1)).factor |
59038a10 | 65 | forth_STEP_TO_PROG = forth/$($(1)).fs |
69b4abd6 | 66 | go_STEP_TO_PROG = go/$($(1)) |
a9cd6543 | 67 | groovy_STEP_TO_PROG = groovy/$($(1)).groovy |
db4c329a | 68 | java_STEP_TO_PROG = java/src/main/java/mal/$($(1)).java |
b76aa73b | 69 | haskell_STEP_TO_PROG = haskell/$($(1)) |
a23e0cdb | 70 | julia_STEP_TO_PROG = julia/$($(1)).jl |
db4c329a | 71 | js_STEP_TO_PROG = js/$($(1)).js |
9d42904e | 72 | lua_STEP_TO_PROG = lua/$($(1)).lua |
db4c329a JM |
73 | make_STEP_TO_PROG = make/$($(1)).mk |
74 | mal_STEP_TO_PROG = mal/$($(1)).mal | |
59d10e1b | 75 | ocaml_STEP_TO_PROG = ocaml/$($(1)) |
9a54ea18 | 76 | matlab_STEP_TO_PROG = matlab/$($(1)).m |
c1fe72ae | 77 | miniMAL_STEP_TO_PROG = miniMAL/$($(1)).json |
dbac60df | 78 | nim_STEP_TO_PROG = nim/$($(1)) |
b5dedee0 | 79 | perl_STEP_TO_PROG = perl/$($(1)).pl |
db4c329a JM |
80 | php_STEP_TO_PROG = php/$($(1)).php |
81 | ps_STEP_TO_PROG = ps/$($(1)).ps | |
82 | python_STEP_TO_PROG = python/$($(1)).py | |
4d1456b9 | 83 | r_STEP_TO_PROG = r/$($(1)).r |
f5223195 | 84 | racket_STEP_TO_PROG = racket/$($(1)).rkt |
80320efc | 85 | rpython_STEP_TO_PROG = rpython/$($(1)) |
db4c329a | 86 | ruby_STEP_TO_PROG = ruby/$($(1)).rb |
434516e0 | 87 | rust_STEP_TO_PROG = rust/target/release/$($(1)) |
821930db | 88 | scala_STEP_TO_PROG = scala/$($(1)).scala |
2539e6af | 89 | swift_STEP_TO_PROG = swift/$($(1)) |
ee7cd585 | 90 | vb_STEP_TO_PROG = vb/$($(1)).exe |
5eb1f5cb | 91 | guile_STEP_TO_PROG = guile/$($(1)).scm |
db4c329a | 92 | |
c4033aab JM |
93 | # Needed some argument munging |
94 | COMMA = , | |
95 | noop = | |
96 | SPACE = $(noop) $(noop) | |
389c9b8a | 97 | export FACTOR_ROOTS := src |
db4c329a JM |
98 | |
99 | bash_RUNSTEP = bash ../$(2) $(3) | |
100 | c_RUNSTEP = ../$(2) $(3) | |
101 | clojure_RUNSTEP = lein with-profile +$(1) trampoline run $(3) | |
891c3f3b | 102 | coffee_RUNSTEP = coffee ../$(2) $(3) |
9ddaa0b9 | 103 | cpp_RUNSTEP = ../$(2) $(3) |
86fe6314 | 104 | crystal_RUNSTEP = ../$(2) $(3) |
db4c329a | 105 | cs_RUNSTEP = mono ../$(2) --raw $(3) |
2cc3804b | 106 | erlang_RUNSTEP = ../$(2) $(3) |
389c9b8a | 107 | factor_RUNSTEP = factor ../$(2) $(3) |
59038a10 | 108 | forth_RUNSTEP = gforth ../$(2) $(3) |
69b4abd6 | 109 | go_RUNSTEP = ../$(2) $(3) |
a9cd6543 | 110 | groovy_RUNSTEP = groovy ../$(2) $(3) |
b76aa73b | 111 | haskell_RUNSTEP = ../$(2) $(3) |
798206ac | 112 | java_RUNSTEP = mvn -quiet exec:java -Dexec.mainClass="mal.$($(1))" $(if $(3), -Dexec.args="$(3)",) |
a23e0cdb | 113 | julia_RUNSTEP = ../$(2) $(3) |
db4c329a | 114 | js_RUNSTEP = node ../$(2) $(3) |
798206ac | 115 | lua_RUNSTEP = ../$(2) $(3) |
db4c329a JM |
116 | make_RUNSTEP = make -f ../$(2) $(3) |
117 | mal_RUNSTEP = $(call $(MAL_IMPL)_RUNSTEP,$(1),$(call $(MAL_IMPL)_STEP_TO_PROG,stepA),../$(2),") #" | |
59d10e1b | 118 | ocaml_RUNSTEP = ../$(2) $(3) |
7f567f36 JM |
119 | matlab_args = $(subst $(SPACE),$(COMMA),$(foreach x,$(strip $(1)),'$(x)')) |
120 | matlab_RUNSTEP = matlab -nodisplay -nosplash -nodesktop -nojvm -r "$($(1))($(call matlab_args,$(3)));quit;" | |
c1fe72ae | 121 | miniMAL_RUNSTEP = miniMAL ../$(2) $(3) |
dbac60df | 122 | nim_RUNSTEP = ../$(2) $(3) |
82acd3de | 123 | perl_RUNSTEP = perl ../$(2) $(3) |
db4c329a | 124 | php_RUNSTEP = php ../$(2) $(3) |
01c97316 | 125 | ps_RUNSTEP = $(4)gs -q -I./ -dNODISPLAY -- ../$(2) $(3)$(4) |
db4c329a | 126 | python_RUNSTEP = $(PYTHON) ../$(2) $(3) |
4d1456b9 | 127 | r_RUNSTEP = Rscript ../$(2) $(3) |
f5223195 | 128 | racket_RUNSTEP = ../$(2) $(3) |
80320efc | 129 | rpython_RUNSTEP = ../$(2) $(3) |
db4c329a | 130 | ruby_RUNSTEP = ruby ../$(2) $(3) |
abdd56eb | 131 | rust_RUNSTEP = ../$(2) $(3) |
821930db | 132 | scala_RUNSTEP = sbt 'run-main $($(1))$(if $(3), $(3),)' |
2539e6af | 133 | swift_RUNSTEP = ../$(2) $(3) |
ee7cd585 | 134 | vb_RUNSTEP = mono ../$(2) --raw $(3) |
5eb1f5cb | 135 | # needs TERM=dumb to work with readline |
44af092c | 136 | guile_RUNSTEP = guile -L ../guile ../$(2) $(3) |
db4c329a JM |
137 | |
138 | # Extra options to pass to runtest.py | |
7907cd90 | 139 | mal_TEST_OPTS = --start-timeout 60 --test-timeout 120 |
31690700 JM |
140 | |
141 | ||
142 | # Derived lists | |
143 | STEPS = $(sort $(filter step%,$(.VARIABLES))) | |
8569b2af JM |
144 | DO_IMPLS = $(filter-out $(SKIP_IMPLS),$(IMPLS)) |
145 | IMPL_TESTS = $(foreach impl,$(DO_IMPLS),test^$(impl)) | |
31690700 JM |
146 | STEP_TESTS = $(foreach step,$(STEPS),test^$(step)) |
147 | ALL_TESTS = $(filter-out $(EXCLUDE_TESTS),\ | |
148 | $(strip $(sort \ | |
8569b2af | 149 | $(foreach impl,$(DO_IMPLS),\ |
31690700 JM |
150 | $(foreach step,$(STEPS),test^$(impl)^$(step)))))) |
151 | ||
8569b2af JM |
152 | IMPL_STATS = $(foreach impl,$(DO_IMPLS),stats^$(impl)) |
153 | IMPL_STATS_LISP = $(foreach impl,$(DO_IMPLS),stats-lisp^$(impl)) | |
31690700 | 154 | |
8569b2af | 155 | IMPL_PERF = $(filter-out $(EXCLUDE_PERFS),$(foreach impl,$(DO_IMPLS),perf^$(impl))) |
db4c329a | 156 | |
31690700 JM |
157 | # |
158 | # Build rules | |
159 | # | |
160 | ||
161 | # Build a program in 'c' directory | |
162 | c/%: | |
163 | $(MAKE) -C $(dir $(@)) $(notdir $(@)) | |
164 | ||
9ddaa0b9 ST |
165 | # Build a program in 'cpp' directory |
166 | cpp/%: | |
167 | $(MAKE) -C $(dir $(@)) $(notdir $(@)) | |
168 | ||
31690700 JM |
169 | # Allow test, test^STEP, test^IMPL, and test^IMPL^STEP |
170 | .SECONDEXPANSION: | |
171 | $(IMPL_TESTS): $$(filter $$@^%,$$(ALL_TESTS)) | |
172 | ||
173 | .SECONDEXPANSION: | |
174 | $(STEP_TESTS): $$(foreach step,$$(subst test^,,$$@),$$(filter %^$$(step),$$(ALL_TESTS))) | |
175 | ||
176 | .SECONDEXPANSION: | |
177 | $(ALL_TESTS): $$(call $$(word 2,$$(subst ^, ,$$(@)))_STEP_TO_PROG,$$(word 3,$$(subst ^, ,$$(@)))) | |
178 | @$(foreach impl,$(word 2,$(subst ^, ,$(@))),\ | |
179 | $(foreach step,$(word 3,$(subst ^, ,$(@))),\ | |
180 | cd $(if $(filter mal,$(impl)),$(MAL_IMPL),$(impl)); \ | |
181 | $(foreach test,$(call STEP_TEST_FILES,$(impl),$(step)),\ | |
182 | echo '----------------------------------------------'; \ | |
183 | echo 'Testing $@, step file: $+, test file: $(test)'; \ | |
db4c329a | 184 | echo 'Running: ../runtest.py $(call $(impl)_TEST_OPTS) ../$(test) -- $(call $(impl)_RUNSTEP,$(step),$(+))'; \ |
dbac60df | 185 | ../runtest.py $(call $(impl)_TEST_OPTS) ../$(test) -- $(call $(impl)_RUNSTEP,$(step),$(+));))) |
31690700 JM |
186 | |
187 | test: $(ALL_TESTS) | |
188 | tests: $(ALL_TESTS) | |
189 | ||
190 | ||
191 | # Stats rules | |
192 | ||
db4c329a JM |
193 | stats: $(IMPL_STATS) |
194 | stats-lisp: $(IMPL_STATS_LISP) | |
195 | ||
31690700 JM |
196 | .SECONDEXPANSION: |
197 | $(IMPL_STATS): | |
198 | @echo "----------------------------------------------"; \ | |
199 | $(foreach impl,$(word 2,$(subst ^, ,$(@))),\ | |
200 | echo "Stats for $(impl):"; \ | |
201 | $(MAKE) --no-print-directory -C $(impl) stats) | |
202 | ||
712af9ef JM |
203 | .SECONDEXPANSION: |
204 | $(IMPL_STATS_LISP): | |
205 | @echo "----------------------------------------------"; \ | |
206 | $(foreach impl,$(word 2,$(subst ^, ,$(@))),\ | |
207 | echo "Stats (lisp only) for $(impl):"; \ | |
208 | $(MAKE) --no-print-directory -C $(impl) stats-lisp) | |
209 | ||
db4c329a JM |
210 | |
211 | # Performance test rules | |
212 | ||
213 | perf: $(IMPL_PERF) | |
214 | ||
215 | .SECONDEXPANSION: | |
216 | $(IMPL_PERF): | |
217 | @echo "----------------------------------------------"; \ | |
218 | $(foreach impl,$(word 2,$(subst ^, ,$(@))),\ | |
219 | cd $(if $(filter mal,$(impl)),$(MAL_IMPL),$(impl)); \ | |
220 | echo "Performance test for $(impl):"; \ | |
221 | echo 'Running: $(call $(impl)_RUNSTEP,stepA,$(call $(impl)_STEP_TO_PROG,stepA),../tests/perf1.mal)'; \ | |
222 | $(call $(impl)_RUNSTEP,stepA,$(call $(impl)_STEP_TO_PROG,stepA),../tests/perf1.mal); \ | |
223 | echo 'Running: $(call $(impl)_RUNSTEP,stepA,$(call $(impl)_STEP_TO_PROG,stepA),../tests/perf2.mal)'; \ | |
699f0ad2 JM |
224 | $(call $(impl)_RUNSTEP,stepA,$(call $(impl)_STEP_TO_PROG,stepA),../tests/perf2.mal); \ |
225 | echo 'Running: $(call $(impl)_RUNSTEP,stepA,$(call $(impl)_STEP_TO_PROG,stepA),../tests/perf3.mal)'; \ | |
226 | $(call $(impl)_RUNSTEP,stepA,$(call $(impl)_STEP_TO_PROG,stepA),../tests/perf3.mal)) |