2 # Command line settings
13 IMPLS
= bash c clojure coffee cs go java js make mal perl php ps \
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
38 # interop tests now implemented yet
39 EXCLUDE_TESTS
+= test^cs^stepA
test^java^stepA
test^mal^stepA \
40 test^mal^step0
test^php^stepA
test^ps^stepA \
41 test^python^stepA
test^ruby^stepA
43 EXCLUDE_PERFS
= perf^mal
# TODO: fix this
49 STEP_TEST_FILES
= $(strip $(wildcard $(1)/tests
/$($(2)).mal
) $(wildcard tests
/$($(2)).mal
))
51 bash_STEP_TO_PROG
= bash
/$($(1)).sh
52 c_STEP_TO_PROG
= c
/$($(1))
53 clojure_STEP_TO_PROG
= clojure
/src
/$($(1)).clj
54 coffee_STEP_TO_PROG
= coffee
/$($(1)).coffee
55 cs_STEP_TO_PROG
= cs
/$($(1)).exe
56 go_STEP_TO_PROG
= go
/$($(1))
57 java_STEP_TO_PROG
= java
/src
/main
/java
/mal
/$($(1)).java
58 js_STEP_TO_PROG
= js
/$($(1)).js
59 make_STEP_TO_PROG
= make
/$($(1)).mk
60 mal_STEP_TO_PROG
= mal
/$($(1)).mal
61 perl_STEP_TO_PROG
= perl
/$($(1)).pl
62 php_STEP_TO_PROG
= php
/$($(1)).php
63 ps_STEP_TO_PROG
= ps
/$($(1)).ps
64 python_STEP_TO_PROG
= python
/$($(1)).py
65 r_STEP_TO_PROG
= r
/$($(1)).r
66 ruby_STEP_TO_PROG
= ruby
/$($(1)).rb
67 rust_STEP_TO_PROG
= rust
/target
/$($(1))
68 vb_STEP_TO_PROG
= vb
/$($(1)).exe
71 bash_RUNSTEP
= bash ..
/$(2) $(3)
72 c_RUNSTEP
= ..
/$(2) $(3)
73 clojure_RUNSTEP
= lein with-profile
+$(1) trampoline run
$(3)
74 coffee_RUNSTEP
= coffee ..
/$(2) $(3)
75 cs_RUNSTEP
= mono ..
/$(2) --raw
$(3)
76 go_RUNSTEP
= ..
/$(2) $(3)
77 java_RUNSTEP
= mvn
-quiet exec
:java
-Dexec.mainClass
="mal.$($(1))" -Dexec.args
="--raw$(if $(3), $(3),)"
78 js_RUNSTEP
= node ..
/$(2) $(3)
79 make_RUNSTEP
= make
-f ..
/$(2) $(3)
80 mal_RUNSTEP
= $(call
$(MAL_IMPL
)_RUNSTEP
,$(1),$(call
$(MAL_IMPL
)_STEP_TO_PROG
,stepA
),..
/$(2),") #"
81 perl_RUNSTEP
= perl ..
/$(2) $(3)
82 php_RUNSTEP
= php ..
/$(2) $(3)
83 ps_RUNSTEP
= $(4)gs
-q
-I.
/ -dNODISPLAY
-- ..
/$(2) $(3)$(4)
84 python_RUNSTEP
= $(PYTHON
) ..
/$(2) $(3)
85 r_RUNSTEP
= Rscript ..
/$(2) $(3)
86 ruby_RUNSTEP
= ruby ..
/$(2) $(3)
87 rust_RUNSTEP
= ..
/$(2) $(3)
88 vb_RUNSTEP
= mono ..
/$(2) --raw
$(3)
90 # Extra options to pass to runtest.py
91 cs_TEST_OPTS
= --redirect
92 mal_TEST_OPTS
= --redirect
--start-timeout
60 --test-timeout
120
93 vb_TEST_OPTS
= --redirect
97 STEPS
= $(sort $(filter step
%,$(.VARIABLES
)))
98 IMPL_TESTS
= $(foreach impl
,$(IMPLS
),test^
$(impl
))
99 STEP_TESTS
= $(foreach step
,$(STEPS
),test^
$(step
))
100 ALL_TESTS
= $(filter-out $(EXCLUDE_TESTS
),\
102 $(foreach impl
,$(IMPLS
),\
103 $(foreach step
,$(STEPS
),test^
$(impl
)^
$(step
))))))
105 IMPL_STATS
= $(foreach impl
,$(IMPLS
),stats^
$(impl
))
106 IMPL_STATS_LISP
= $(foreach impl
,$(IMPLS
),stats-lisp^
$(impl
))
108 IMPL_PERF
= $(filter-out $(EXCLUDE_PERFS
),$(foreach impl
,$(IMPLS
),perf^
$(impl
)))
114 # Build a program in 'c' directory
116 $(MAKE
) -C
$(dir $(@
)) $(notdir $(@
))
118 # Allow test, test^STEP, test^IMPL, and test^IMPL^STEP
120 $(IMPL_TESTS
): $$(filter $$@^
%,$$(ALL_TESTS
))
123 $(STEP_TESTS
): $$(foreach step
,$$(subst test^
,,$$@
),$$(filter %^
$$(step
),$$(ALL_TESTS
)))
126 $(ALL_TESTS
): $$(call
$$(word 2,$$(subst ^
, ,$$(@
)))_STEP_TO_PROG
,$$(word 3,$$(subst ^
, ,$$(@
))))
127 @
$(foreach impl
,$(word 2,$(subst ^
, ,$(@
))),\
128 $(foreach step
,$(word 3,$(subst ^
, ,$(@
))),\
129 cd
$(if
$(filter mal
,$(impl
)),$(MAL_IMPL
),$(impl
)); \
130 $(foreach test,$(call STEP_TEST_FILES
,$(impl
),$(step
)),\
131 echo
'----------------------------------------------'; \
132 echo
'Testing $@, step file: $+, test file: $(test)'; \
133 echo
'Running: ../runtest.py $(call $(impl)_TEST_OPTS) ../$(test) -- $(call $(impl)_RUNSTEP,$(step),$(+))'; \
134 ..
/runtest.py
$(call
$(impl
)_TEST_OPTS
) ..
/$(test) -- $(call
$(impl
)_RUNSTEP
,$(step
),$(+)))))
143 stats-lisp
: $(IMPL_STATS_LISP
)
147 @echo
"----------------------------------------------"; \
148 $(foreach impl
,$(word 2,$(subst ^
, ,$(@
))),\
149 echo
"Stats for $(impl):"; \
150 $(MAKE
) --no-print-directory
-C
$(impl
) stats
)
154 @echo
"----------------------------------------------"; \
155 $(foreach impl
,$(word 2,$(subst ^
, ,$(@
))),\
156 echo
"Stats (lisp only) for $(impl):"; \
157 $(MAKE
) --no-print-directory
-C
$(impl
) stats-lisp
)
160 # Performance test rules
166 @echo
"----------------------------------------------"; \
167 $(foreach impl
,$(word 2,$(subst ^
, ,$(@
))),\
168 cd
$(if
$(filter mal
,$(impl
)),$(MAL_IMPL
),$(impl
)); \
169 echo
"Performance test for $(impl):"; \
170 echo
'Running: $(call $(impl)_RUNSTEP,stepA,$(call $(impl)_STEP_TO_PROG,stepA),../tests/perf1.mal)'; \
171 $(call
$(impl
)_RUNSTEP
,stepA
,$(call
$(impl
)_STEP_TO_PROG
,stepA
),..
/tests
/perf1.mal
); \
172 echo
'Running: $(call $(impl)_RUNSTEP,stepA,$(call $(impl)_STEP_TO_PROG,stepA),../tests/perf2.mal)'; \
173 $(call
$(impl
)_RUNSTEP
,stepA
,$(call
$(impl
)_STEP_TO_PROG
,stepA
),..
/tests
/perf2.mal
))