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 | ||
d993b22f PS |
13 | IMPLS = bash c clojure coffee cpp cs forth fsharp go haskell java \ |
14 | julia js lua make mal ocaml matlab miniMAL nim perl php ps \ | |
15 | python r racket ruby rust scala swift vb | |
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 |
8862f80e | 33 | EXCLUDE_TESTS += test^fsharp^step5 # completes at 10,000, fatal stack overflow at 100,000 |
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 |
cc021efe | 46 | |
db4c329a | 47 | EXCLUDE_PERFS = perf^mal # TODO: fix this |
31690700 JM |
48 | |
49 | # | |
50 | # Utility functions | |
51 | # | |
52 | ||
53 | STEP_TEST_FILES = $(strip $(wildcard $(1)/tests/$($(2)).mal) $(wildcard tests/$($(2)).mal)) | |
54 | ||
db4c329a JM |
55 | bash_STEP_TO_PROG = bash/$($(1)).sh |
56 | c_STEP_TO_PROG = c/$($(1)) | |
31690700 | 57 | clojure_STEP_TO_PROG = clojure/src/$($(1)).clj |
891c3f3b | 58 | coffee_STEP_TO_PROG = coffee/$($(1)).coffee |
9ddaa0b9 | 59 | cpp_STEP_TO_PROG = cpp/$($(1)) |
db4c329a | 60 | cs_STEP_TO_PROG = cs/$($(1)).exe |
59038a10 | 61 | forth_STEP_TO_PROG = forth/$($(1)).fs |
1c358979 | 62 | fsharp_STEP_TO_PROG = fsharp/$($(1)).exe |
69b4abd6 | 63 | go_STEP_TO_PROG = go/$($(1)) |
db4c329a | 64 | java_STEP_TO_PROG = java/src/main/java/mal/$($(1)).java |
b76aa73b | 65 | haskell_STEP_TO_PROG = haskell/$($(1)) |
a23e0cdb | 66 | julia_STEP_TO_PROG = julia/$($(1)).jl |
db4c329a | 67 | js_STEP_TO_PROG = js/$($(1)).js |
9d42904e | 68 | lua_STEP_TO_PROG = lua/$($(1)).lua |
db4c329a JM |
69 | make_STEP_TO_PROG = make/$($(1)).mk |
70 | mal_STEP_TO_PROG = mal/$($(1)).mal | |
59d10e1b | 71 | ocaml_STEP_TO_PROG = ocaml/$($(1)) |
9a54ea18 | 72 | matlab_STEP_TO_PROG = matlab/$($(1)).m |
c1fe72ae | 73 | miniMAL_STEP_TO_PROG = miniMAL/$($(1)).json |
dbac60df | 74 | nim_STEP_TO_PROG = nim/$($(1)) |
b5dedee0 | 75 | perl_STEP_TO_PROG = perl/$($(1)).pl |
db4c329a JM |
76 | php_STEP_TO_PROG = php/$($(1)).php |
77 | ps_STEP_TO_PROG = ps/$($(1)).ps | |
78 | python_STEP_TO_PROG = python/$($(1)).py | |
4d1456b9 | 79 | r_STEP_TO_PROG = r/$($(1)).r |
f5223195 | 80 | racket_STEP_TO_PROG = racket/$($(1)).rkt |
db4c329a | 81 | ruby_STEP_TO_PROG = ruby/$($(1)).rb |
434516e0 | 82 | rust_STEP_TO_PROG = rust/target/release/$($(1)) |
821930db | 83 | scala_STEP_TO_PROG = scala/$($(1)).scala |
2539e6af | 84 | swift_STEP_TO_PROG = swift/$($(1)) |
ee7cd585 | 85 | vb_STEP_TO_PROG = vb/$($(1)).exe |
db4c329a | 86 | |
c4033aab JM |
87 | # Needed some argument munging |
88 | COMMA = , | |
89 | noop = | |
90 | SPACE = $(noop) $(noop) | |
db4c329a JM |
91 | |
92 | bash_RUNSTEP = bash ../$(2) $(3) | |
93 | c_RUNSTEP = ../$(2) $(3) | |
94 | clojure_RUNSTEP = lein with-profile +$(1) trampoline run $(3) | |
891c3f3b | 95 | coffee_RUNSTEP = coffee ../$(2) $(3) |
9ddaa0b9 | 96 | cpp_RUNSTEP = ../$(2) $(3) |
db4c329a | 97 | cs_RUNSTEP = mono ../$(2) --raw $(3) |
59038a10 | 98 | forth_RUNSTEP = gforth ../$(2) $(3) |
1c358979 | 99 | fsharp_RUNSTEP = mono ../$(2) --raw $(3) |
69b4abd6 | 100 | go_RUNSTEP = ../$(2) $(3) |
b76aa73b | 101 | haskell_RUNSTEP = ../$(2) $(3) |
798206ac | 102 | java_RUNSTEP = mvn -quiet exec:java -Dexec.mainClass="mal.$($(1))" $(if $(3), -Dexec.args="$(3)",) |
a23e0cdb | 103 | julia_RUNSTEP = ../$(2) $(3) |
db4c329a | 104 | js_RUNSTEP = node ../$(2) $(3) |
798206ac | 105 | lua_RUNSTEP = ../$(2) $(3) |
db4c329a JM |
106 | make_RUNSTEP = make -f ../$(2) $(3) |
107 | mal_RUNSTEP = $(call $(MAL_IMPL)_RUNSTEP,$(1),$(call $(MAL_IMPL)_STEP_TO_PROG,stepA),../$(2),") #" | |
59d10e1b | 108 | ocaml_RUNSTEP = ../$(2) $(3) |
7f567f36 JM |
109 | matlab_args = $(subst $(SPACE),$(COMMA),$(foreach x,$(strip $(1)),'$(x)')) |
110 | matlab_RUNSTEP = matlab -nodisplay -nosplash -nodesktop -nojvm -r "$($(1))($(call matlab_args,$(3)));quit;" | |
c1fe72ae | 111 | miniMAL_RUNSTEP = miniMAL ../$(2) $(3) |
dbac60df | 112 | nim_RUNSTEP = ../$(2) $(3) |
82acd3de | 113 | perl_RUNSTEP = perl ../$(2) $(3) |
db4c329a | 114 | php_RUNSTEP = php ../$(2) $(3) |
01c97316 | 115 | ps_RUNSTEP = $(4)gs -q -I./ -dNODISPLAY -- ../$(2) $(3)$(4) |
db4c329a | 116 | python_RUNSTEP = $(PYTHON) ../$(2) $(3) |
4d1456b9 | 117 | r_RUNSTEP = Rscript ../$(2) $(3) |
f5223195 | 118 | racket_RUNSTEP = ../$(2) $(3) |
db4c329a | 119 | ruby_RUNSTEP = ruby ../$(2) $(3) |
abdd56eb | 120 | rust_RUNSTEP = ../$(2) $(3) |
821930db | 121 | scala_RUNSTEP = sbt 'run-main $($(1))$(if $(3), $(3),)' |
2539e6af | 122 | swift_RUNSTEP = ../$(2) $(3) |
ee7cd585 | 123 | vb_RUNSTEP = mono ../$(2) --raw $(3) |
db4c329a JM |
124 | |
125 | # Extra options to pass to runtest.py | |
7907cd90 | 126 | mal_TEST_OPTS = --start-timeout 60 --test-timeout 120 |
31690700 JM |
127 | |
128 | ||
129 | # Derived lists | |
130 | STEPS = $(sort $(filter step%,$(.VARIABLES))) | |
8569b2af JM |
131 | DO_IMPLS = $(filter-out $(SKIP_IMPLS),$(IMPLS)) |
132 | IMPL_TESTS = $(foreach impl,$(DO_IMPLS),test^$(impl)) | |
31690700 JM |
133 | STEP_TESTS = $(foreach step,$(STEPS),test^$(step)) |
134 | ALL_TESTS = $(filter-out $(EXCLUDE_TESTS),\ | |
135 | $(strip $(sort \ | |
8569b2af | 136 | $(foreach impl,$(DO_IMPLS),\ |
31690700 JM |
137 | $(foreach step,$(STEPS),test^$(impl)^$(step)))))) |
138 | ||
8569b2af JM |
139 | IMPL_STATS = $(foreach impl,$(DO_IMPLS),stats^$(impl)) |
140 | IMPL_STATS_LISP = $(foreach impl,$(DO_IMPLS),stats-lisp^$(impl)) | |
31690700 | 141 | |
8569b2af | 142 | IMPL_PERF = $(filter-out $(EXCLUDE_PERFS),$(foreach impl,$(DO_IMPLS),perf^$(impl))) |
db4c329a | 143 | |
31690700 JM |
144 | # |
145 | # Build rules | |
146 | # | |
147 | ||
148 | # Build a program in 'c' directory | |
149 | c/%: | |
150 | $(MAKE) -C $(dir $(@)) $(notdir $(@)) | |
151 | ||
9ddaa0b9 ST |
152 | # Build a program in 'cpp' directory |
153 | cpp/%: | |
154 | $(MAKE) -C $(dir $(@)) $(notdir $(@)) | |
155 | ||
31690700 JM |
156 | # Allow test, test^STEP, test^IMPL, and test^IMPL^STEP |
157 | .SECONDEXPANSION: | |
158 | $(IMPL_TESTS): $$(filter $$@^%,$$(ALL_TESTS)) | |
159 | ||
160 | .SECONDEXPANSION: | |
161 | $(STEP_TESTS): $$(foreach step,$$(subst test^,,$$@),$$(filter %^$$(step),$$(ALL_TESTS))) | |
162 | ||
163 | .SECONDEXPANSION: | |
164 | $(ALL_TESTS): $$(call $$(word 2,$$(subst ^, ,$$(@)))_STEP_TO_PROG,$$(word 3,$$(subst ^, ,$$(@)))) | |
165 | @$(foreach impl,$(word 2,$(subst ^, ,$(@))),\ | |
166 | $(foreach step,$(word 3,$(subst ^, ,$(@))),\ | |
167 | cd $(if $(filter mal,$(impl)),$(MAL_IMPL),$(impl)); \ | |
168 | $(foreach test,$(call STEP_TEST_FILES,$(impl),$(step)),\ | |
169 | echo '----------------------------------------------'; \ | |
170 | echo 'Testing $@, step file: $+, test file: $(test)'; \ | |
db4c329a | 171 | echo 'Running: ../runtest.py $(call $(impl)_TEST_OPTS) ../$(test) -- $(call $(impl)_RUNSTEP,$(step),$(+))'; \ |
dbac60df | 172 | ../runtest.py $(call $(impl)_TEST_OPTS) ../$(test) -- $(call $(impl)_RUNSTEP,$(step),$(+));))) |
31690700 JM |
173 | |
174 | test: $(ALL_TESTS) | |
175 | tests: $(ALL_TESTS) | |
176 | ||
177 | ||
178 | # Stats rules | |
179 | ||
db4c329a JM |
180 | stats: $(IMPL_STATS) |
181 | stats-lisp: $(IMPL_STATS_LISP) | |
182 | ||
31690700 JM |
183 | .SECONDEXPANSION: |
184 | $(IMPL_STATS): | |
185 | @echo "----------------------------------------------"; \ | |
186 | $(foreach impl,$(word 2,$(subst ^, ,$(@))),\ | |
187 | echo "Stats for $(impl):"; \ | |
188 | $(MAKE) --no-print-directory -C $(impl) stats) | |
189 | ||
712af9ef JM |
190 | .SECONDEXPANSION: |
191 | $(IMPL_STATS_LISP): | |
192 | @echo "----------------------------------------------"; \ | |
193 | $(foreach impl,$(word 2,$(subst ^, ,$(@))),\ | |
194 | echo "Stats (lisp only) for $(impl):"; \ | |
195 | $(MAKE) --no-print-directory -C $(impl) stats-lisp) | |
196 | ||
db4c329a JM |
197 | |
198 | # Performance test rules | |
199 | ||
200 | perf: $(IMPL_PERF) | |
201 | ||
202 | .SECONDEXPANSION: | |
203 | $(IMPL_PERF): | |
204 | @echo "----------------------------------------------"; \ | |
205 | $(foreach impl,$(word 2,$(subst ^, ,$(@))),\ | |
206 | cd $(if $(filter mal,$(impl)),$(MAL_IMPL),$(impl)); \ | |
207 | echo "Performance test for $(impl):"; \ | |
208 | echo 'Running: $(call $(impl)_RUNSTEP,stepA,$(call $(impl)_STEP_TO_PROG,stepA),../tests/perf1.mal)'; \ | |
209 | $(call $(impl)_RUNSTEP,stepA,$(call $(impl)_STEP_TO_PROG,stepA),../tests/perf1.mal); \ | |
210 | echo 'Running: $(call $(impl)_RUNSTEP,stepA,$(call $(impl)_STEP_TO_PROG,stepA),../tests/perf2.mal)'; \ | |
699f0ad2 JM |
211 | $(call $(impl)_RUNSTEP,stepA,$(call $(impl)_STEP_TO_PROG,stepA),../tests/perf2.mal); \ |
212 | echo 'Running: $(call $(impl)_RUNSTEP,stepA,$(call $(impl)_STEP_TO_PROG,stepA),../tests/perf3.mal)'; \ | |
213 | $(call $(impl)_RUNSTEP,stepA,$(call $(impl)_STEP_TO_PROG,stepA),../tests/perf3.mal)) | |
db4c329a | 214 |