2 # Command line settings
13 IMPLS
= bash c clojure coffee cs go haskell java js lua make mal \
14 ocaml perl php ps python r racket ruby rust scala vb
17 step1
= step1_read_print
20 step4
= step4_if_fn_do
28 EXCLUDE_TESTS
+= test^bash^step5
# no stack exhaustion or completion
29 EXCLUDE_TESTS
+= test^c^step5
# segfault
30 EXCLUDE_TESTS
+= test^cs^step5
# fatal stack overflow fault
31 EXCLUDE_TESTS
+= test^make^step5
# no TCO capability/step
32 EXCLUDE_TESTS
+= test^mal^step5
# no TCO capability/step
33 EXCLUDE_TESTS
+= test^go^step5
# test completes, even at 100,000
34 EXCLUDE_TESTS
+= test^php^step5
# test completes, even at 100,000
35 EXCLUDE_TESTS
+= test^ruby^step5
# test completes, even at 100,000
36 EXCLUDE_TESTS
+= test^rust^step5
# no catching stack overflows
37 EXCLUDE_TESTS
+= test^ocaml^step5
# test completes, even at 1,000,000
39 # interop tests now implemented yet
40 EXCLUDE_TESTS
+= test^cs^stepA
test^java^stepA
test^mal^stepA \
41 test^mal^step0
test^php^stepA
test^ps^stepA \
42 test^python^stepA
test^ruby^stepA
44 EXCLUDE_PERFS
= perf^mal
# TODO: fix this
50 STEP_TEST_FILES
= $(strip $(wildcard $(1)/tests
/$($(2)).mal
) $(wildcard tests
/$($(2)).mal
))
52 bash_STEP_TO_PROG
= bash
/$($(1)).sh
53 c_STEP_TO_PROG
= c
/$($(1))
54 clojure_STEP_TO_PROG
= clojure
/src
/$($(1)).clj
55 coffee_STEP_TO_PROG
= coffee
/$($(1)).coffee
56 cs_STEP_TO_PROG
= cs
/$($(1)).exe
57 go_STEP_TO_PROG
= go
/$($(1))
58 java_STEP_TO_PROG
= java
/src
/main
/java
/mal
/$($(1)).java
59 haskell_STEP_TO_PROG
= haskell
/$($(1))
60 js_STEP_TO_PROG
= js
/$($(1)).js
61 lua_STEP_TO_PROG
= lua
/$($(1)).lua
62 make_STEP_TO_PROG
= make
/$($(1)).mk
63 mal_STEP_TO_PROG
= mal
/$($(1)).mal
64 ocaml_STEP_TO_PROG
= ocaml
/$($(1))
65 perl_STEP_TO_PROG
= perl
/$($(1)).pl
66 php_STEP_TO_PROG
= php
/$($(1)).php
67 ps_STEP_TO_PROG
= ps
/$($(1)).ps
68 python_STEP_TO_PROG
= python
/$($(1)).py
69 r_STEP_TO_PROG
= r
/$($(1)).r
70 racket_STEP_TO_PROG
= racket
/$($(1)).rkt
71 ruby_STEP_TO_PROG
= ruby
/$($(1)).rb
72 rust_STEP_TO_PROG
= rust
/target
/$($(1))
73 scala_STEP_TO_PROG
= scala
/$($(1)).scala
74 vb_STEP_TO_PROG
= vb
/$($(1)).exe
77 bash_RUNSTEP
= bash ..
/$(2) $(3)
78 c_RUNSTEP
= ..
/$(2) $(3)
79 clojure_RUNSTEP
= lein with-profile
+$(1) trampoline run
$(3)
80 coffee_RUNSTEP
= coffee ..
/$(2) $(3)
81 cs_RUNSTEP
= mono ..
/$(2) --raw
$(3)
82 go_RUNSTEP
= ..
/$(2) $(3)
83 haskell_RUNSTEP
= ..
/$(2) $(3)
84 java_RUNSTEP
= mvn
-quiet exec
:java
-Dexec.mainClass
="mal.$($(1))" -Dexec.args
="--raw$(if $(3), $(3),)"
85 js_RUNSTEP
= node ..
/$(2) $(3)
86 lua_RUNSTEP
= ..
/$(2) $(3)
87 make_RUNSTEP
= make
-f ..
/$(2) $(3)
88 mal_RUNSTEP
= $(call
$(MAL_IMPL
)_RUNSTEP
,$(1),$(call
$(MAL_IMPL
)_STEP_TO_PROG
,stepA
),..
/$(2),") #"
89 ocaml_RUNSTEP
= ..
/$(2) $(3)
90 perl_RUNSTEP
= perl ..
/$(2) --raw
$(3)
91 php_RUNSTEP
= php ..
/$(2) $(3)
92 ps_RUNSTEP
= $(4)gs
-q
-I.
/ -dNODISPLAY
-- ..
/$(2) $(3)$(4)
93 python_RUNSTEP
= $(PYTHON
) ..
/$(2) $(3)
94 r_RUNSTEP
= Rscript ..
/$(2) $(3)
95 racket_RUNSTEP
= ..
/$(2) $(3)
96 ruby_RUNSTEP
= ruby ..
/$(2) $(3)
97 rust_RUNSTEP
= ..
/$(2) $(3)
98 scala_RUNSTEP
= sbt
'run-main $($(1))$(if $(3), $(3),)'
99 vb_RUNSTEP
= mono ..
/$(2) --raw
$(3)
101 # Extra options to pass to runtest.py
102 cs_TEST_OPTS
= --redirect
103 mal_TEST_OPTS
= --redirect
--start-timeout
60 --test-timeout
120
104 vb_TEST_OPTS
= --redirect
108 STEPS
= $(sort $(filter step
%,$(.VARIABLES
)))
109 IMPL_TESTS
= $(foreach impl
,$(IMPLS
),test^
$(impl
))
110 STEP_TESTS
= $(foreach step
,$(STEPS
),test^
$(step
))
111 ALL_TESTS
= $(filter-out $(EXCLUDE_TESTS
),\
113 $(foreach impl
,$(IMPLS
),\
114 $(foreach step
,$(STEPS
),test^
$(impl
)^
$(step
))))))
116 IMPL_STATS
= $(foreach impl
,$(IMPLS
),stats^
$(impl
))
117 IMPL_STATS_LISP
= $(foreach impl
,$(IMPLS
),stats-lisp^
$(impl
))
119 IMPL_PERF
= $(filter-out $(EXCLUDE_PERFS
),$(foreach impl
,$(IMPLS
),perf^
$(impl
)))
125 # Build a program in 'c' directory
127 $(MAKE
) -C
$(dir $(@
)) $(notdir $(@
))
129 # Allow test, test^STEP, test^IMPL, and test^IMPL^STEP
131 $(IMPL_TESTS
): $$(filter $$@^
%,$$(ALL_TESTS
))
134 $(STEP_TESTS
): $$(foreach step
,$$(subst test^
,,$$@
),$$(filter %^
$$(step
),$$(ALL_TESTS
)))
137 $(ALL_TESTS
): $$(call
$$(word 2,$$(subst ^
, ,$$(@
)))_STEP_TO_PROG
,$$(word 3,$$(subst ^
, ,$$(@
))))
138 @
$(foreach impl
,$(word 2,$(subst ^
, ,$(@
))),\
139 $(foreach step
,$(word 3,$(subst ^
, ,$(@
))),\
140 cd
$(if
$(filter mal
,$(impl
)),$(MAL_IMPL
),$(impl
)); \
141 $(foreach test,$(call STEP_TEST_FILES
,$(impl
),$(step
)),\
142 echo
'----------------------------------------------'; \
143 echo
'Testing $@, step file: $+, test file: $(test)'; \
144 echo
'Running: ../runtest.py $(call $(impl)_TEST_OPTS) ../$(test) -- $(call $(impl)_RUNSTEP,$(step),$(+))'; \
145 ..
/runtest.py
$(call
$(impl
)_TEST_OPTS
) ..
/$(test) -- $(call
$(impl
)_RUNSTEP
,$(step
),$(+)))))
154 stats-lisp
: $(IMPL_STATS_LISP
)
158 @echo
"----------------------------------------------"; \
159 $(foreach impl
,$(word 2,$(subst ^
, ,$(@
))),\
160 echo
"Stats for $(impl):"; \
161 $(MAKE
) --no-print-directory
-C
$(impl
) stats
)
165 @echo
"----------------------------------------------"; \
166 $(foreach impl
,$(word 2,$(subst ^
, ,$(@
))),\
167 echo
"Stats (lisp only) for $(impl):"; \
168 $(MAKE
) --no-print-directory
-C
$(impl
) stats-lisp
)
171 # Performance test rules
177 @echo
"----------------------------------------------"; \
178 $(foreach impl
,$(word 2,$(subst ^
, ,$(@
))),\
179 cd
$(if
$(filter mal
,$(impl
)),$(MAL_IMPL
),$(impl
)); \
180 echo
"Performance test for $(impl):"; \
181 echo
'Running: $(call $(impl)_RUNSTEP,stepA,$(call $(impl)_STEP_TO_PROG,stepA),../tests/perf1.mal)'; \
182 $(call
$(impl
)_RUNSTEP
,stepA
,$(call
$(impl
)_STEP_TO_PROG
,stepA
),..
/tests
/perf1.mal
); \
183 echo
'Running: $(call $(impl)_RUNSTEP,stepA,$(call $(impl)_STEP_TO_PROG,stepA),../tests/perf2.mal)'; \
184 $(call
$(impl
)_RUNSTEP
,stepA
,$(call
$(impl
)_STEP_TO_PROG
,stepA
),..
/tests
/perf2.mal
))