1
1
mirror of https://github.com/kanaka/mal.git synced 2024-10-26 14:22:25 +03:00

Tests: move step5 non-TCO tests to per impl.

- Remove most of the step5 excludes in the Makefile except for ones
  which don't have TCO capability at all (or the implementation is too
  slow): bash, make, mal, matlab.

- Make perf_EXCLUDES consistent with other excludes.

- Add a print-FOO target which prints the resolved value of Makefile
  variable FOO. For example, `make print-IMPLS` to print the list of
  implementations.
This commit is contained in:
Joel Martin 2016-03-14 23:39:21 -05:00
parent eaa6ceb47f
commit dca6b58578
48 changed files with 417 additions and 47 deletions

View File

@ -97,35 +97,12 @@ regress_step8 = $(regress_step7) step8
regress_step9 = $(regress_step8) step9
regress_stepA = $(regress_step9) stepA
STEP5_EXCLUDES += awk # completes at 10,000
STEP5_EXCLUDES += bash # no stack exhaustion or completion
STEP5_EXCLUDES += c # segfault
STEP5_EXCLUDES += cpp # completes at 10,000
STEP5_EXCLUDES += crystal # test completes, even at 1,000,000
STEP5_EXCLUDES += cs # fatal stack overflow fault
STEP5_EXCLUDES += d # completes at 10,000, fatal stack overflow at 1,000,000
STEP5_EXCLUDES += erlang # erlang is TCO, test passes
STEP5_EXCLUDES += elixir # elixir is TCO, test passes
STEP5_EXCLUDES += fsharp # completes at 10,000, fatal stack overflow at 100,000
STEP5_EXCLUDES += go # test completes, even at 100,000
STEP5_EXCLUDES += haskell # test completes
STEP5_EXCLUDES += io # too slow to complete 10,000
STEP5_EXCLUDES += make # no TCO capability/step
STEP5_EXCLUDES += mal # no TCO capability/step
STEP5_EXCLUDES += matlab # too slow to complete 10,000
STEP5_EXCLUDES += miniMAL # strange error with runtest.py
STEP5_EXCLUDES += nim # test completes, even at 100,000
STEP5_EXCLUDES += objc # completes at 10,000, crashes at 100,000
STEP5_EXCLUDES += objpascal # completes at 10,000
STEP5_EXCLUDES += php # test completes, even at 100,000
STEP5_EXCLUDES += racket # test completes
STEP5_EXCLUDES += ruby # test completes, even at 100,000
STEP5_EXCLUDES += rust # no catching stack overflows
STEP5_EXCLUDES += swift3 # no catching stack overflows
STEP5_EXCLUDES += ocaml # test completes, even at 1,000,000
STEP5_EXCLUDES += vb # completes at 10,000
test_EXCLUDES += test^bash^step5 # never completes at 10,000
test_EXCLUDES += test^make^step5 # no TCO capability (iteration or recursion)
test_EXCLUDES += test^mal^step5 # host impl dependent
test_EXCLUDES += test^matlab^step5 # never completes at 10,000
PERF_EXCLUDES = mal # TODO: fix this
perf_EXCLUDES = mal # TODO: fix this
dist_EXCLUDES += mal
# TODO: still need to implement dist
@ -294,14 +271,14 @@ STEPS = $(sort $(filter step%,$(.VARIABLES)))
DO_IMPLS = $(filter-out $(SKIP_IMPLS),$(IMPLS))
IMPL_TESTS = $(foreach impl,$(DO_IMPLS),test^$(impl))
STEP_TESTS = $(foreach step,$(STEPS),test^$(step))
ALL_TESTS = $(filter-out $(foreach impl,$(STEP5_EXCLUDES),test^$(impl)^step5),\
ALL_TESTS = $(filter-out $(test_EXCLUDES),\
$(strip $(sort \
$(foreach impl,$(DO_IMPLS),\
$(foreach step,$(STEPS),test^$(impl)^$(step))))))
DOCKER_BUILD = $(foreach impl,$(DO_IMPLS),docker-build^$(impl))
IMPL_PERF = $(foreach impl,$(filter-out $(PERF_EXCLUDES),$(DO_IMPLS)),perf^$(impl))
IMPL_PERF = $(foreach impl,$(filter-out $(perf_EXCLUDES),$(DO_IMPLS)),perf^$(impl))
IMPL_REPL = $(foreach impl,$(DO_IMPLS),repl^$(impl))
ALL_REPL = $(strip $(sort \
@ -421,6 +398,12 @@ $(ALL_REPL): $$(call $$(word 2,$$(subst ^, ,$$(@)))_STEP_TO_PROG,$$(word 3,$$(su
.SECONDEXPANSION:
$(IMPL_REPL): $$@^stepA
#
# Utility functions
#
.SECONDEXPANSION:
print-%:
@echo "$($(*))"
#
# Recursive rules (call make FOO in each subdirectory)

2
awk/tests/step5_tco.mal Normal file
View File

@ -0,0 +1,2 @@
;; awk: skipping non-TCO recursion
;; Reason: completes up to 50,000

2
c/tests/step5_tco.mal Normal file
View File

@ -0,0 +1,2 @@
;; C: skipping non-TCO recursion
;; Reason: segfaults (unrecoverable)

View File

@ -0,0 +1,15 @@
;; Test recursive non-tail call function
(def! sum-to (fn* (n) (if (= n 0) 0 (+ n (sum-to (- n 1))))))
(sum-to 10)
;=>55
;;; no try* yet, so test completion of side-effects
(def! res1 nil)
;=>nil
;;; For implementations without their own TCO this should fail and
;;; leave res1 unchanged
(def! res1 (sum-to 10000))
res1
;=>nil

View File

@ -0,0 +1,15 @@
;; Test recursive non-tail call function
(def! sum-to (fn* (n) (if (= n 0) 0 (+ n (sum-to (- n 1))))))
(sum-to 10)
;=>55
;;; no try* yet, so test completion of side-effects
(def! res1 nil)
;=>nil
;;; For implementations without their own TCO this should fail and
;;; leave res1 unchanged
(def! res1 (sum-to 10000))
res1
;=>nil

2
cpp/tests/step5_tco.mal Normal file
View File

@ -0,0 +1,2 @@
;; C++: skipping non-TCO recursion
;; Reason: completes at 10,000, segfaults at 20,000

View File

@ -0,0 +1,2 @@
;; Crystal: skipping non-TCO recursion
;; Reason: completes at 1,000,000

2
cs/tests/step5_tco.mal Normal file
View File

@ -0,0 +1,2 @@
;; C#: skipping non-TCO recursion
;; Reason: unrecoverable stack overflow at 10,000

2
d/tests/step5_tco.mal Normal file
View File

@ -0,0 +1,2 @@
;; D: skipping non-TCO recursion
;; Reason: completes at 10,000, segfaults at 40,000

15
elisp/tests/step5_tco.mal Normal file
View File

@ -0,0 +1,15 @@
;; Test recursive non-tail call function
(def! sum-to (fn* (n) (if (= n 0) 0 (+ n (sum-to (- n 1))))))
(sum-to 10)
;=>55
;;; no try* yet, so test completion of side-effects
(def! res1 nil)
;=>nil
;;; For implementations without their own TCO this should fail and
;;; leave res1 unchanged
(def! res1 (sum-to 10000))
res1
;=>nil

View File

@ -0,0 +1,2 @@
;; Elixir: skipping non-TCO recursion
;; Reason: Elixir has TCO, test always completes.

View File

@ -0,0 +1,2 @@
;; Erlang: skipping non-TCO recursion
;; Reason: Erlang has TCO, test always completes.

15
es6/tests/step5_tco.mal Normal file
View File

@ -0,0 +1,15 @@
;; Test recursive non-tail call function
(def! sum-to (fn* (n) (if (= n 0) 0 (+ n (sum-to (- n 1))))))
(sum-to 10)
;=>55
;;; no try* yet, so test completion of side-effects
(def! res1 nil)
;=>nil
;;; For implementations without their own TCO this should fail and
;;; leave res1 unchanged
(def! res1 (sum-to 10000))
res1
;=>nil

View File

@ -0,0 +1,15 @@
;; Test recursive non-tail call function
(def! sum-to (fn* (n) (if (= n 0) 0 (+ n (sum-to (- n 1))))))
(sum-to 10)
;=>55
;;; no try* yet, so test completion of side-effects
(def! res1 nil)
;=>nil
;;; For implementations without their own TCO this should fail and
;;; leave res1 unchanged
(def! res1 (sum-to 10000))
res1
;=>nil

15
forth/tests/step5_tco.mal Normal file
View File

@ -0,0 +1,15 @@
;; Test recursive non-tail call function
(def! sum-to (fn* (n) (if (= n 0) 0 (+ n (sum-to (- n 1))))))
(sum-to 10)
;=>55
;;; no try* yet, so test completion of side-effects
(def! res1 nil)
;=>nil
;;; For implementations without their own TCO this should fail and
;;; leave res1 unchanged
(def! res1 (sum-to 10000))
res1
;=>nil

View File

@ -0,0 +1,2 @@
;; F#: skipping non-TCO recursion
;; Reason: completes at 10,000, unrecoverable segfault at 20,000

2
go/tests/step5_tco.mal Normal file
View File

@ -0,0 +1,2 @@
;; Go: skipping non-TCO recursion
;; Reason: completes even at 100,000

View File

@ -0,0 +1,15 @@
;; Test recursive non-tail call function
(def! sum-to (fn* (n) (if (= n 0) 0 (+ n (sum-to (- n 1))))))
(sum-to 10)
;=>55
;;; no try* yet, so test completion of side-effects
(def! res1 nil)
;=>nil
;;; For implementations without their own TCO this should fail and
;;; leave res1 unchanged
(def! res1 (sum-to 10000))
res1
;=>nil

15
guile/tests/step5_tco.mal Normal file
View File

@ -0,0 +1,15 @@
;; Test recursive non-tail call function
(def! sum-to (fn* (n) (if (= n 0) 0 (+ n (sum-to (- n 1))))))
(sum-to 10)
;=>55
;;; no try* yet, so test completion of side-effects
(def! res1 nil)
;=>nil
;;; For implementations without their own TCO this should fail and
;;; leave res1 unchanged
(def! res1 (sum-to 10000))
res1
;=>nil

View File

@ -0,0 +1,2 @@
;; Haskell: skipping non-TCO recursion
;; Reason: completes up to 100,000, stackoverflow at 1,000,000

15
haxe/tests/step5_tco.mal Normal file
View File

@ -0,0 +1,15 @@
;; Test recursive non-tail call function
(def! sum-to (fn* (n) (if (= n 0) 0 (+ n (sum-to (- n 1))))))
(sum-to 10)
;=>55
;;; no try* yet, so test completion of side-effects
(def! res1 nil)
;=>nil
;;; For implementations without their own TCO this should fail and
;;; leave res1 unchanged
(def! res1 (sum-to 10000))
res1
;=>nil

2
io/tests/step5_tco.mal Normal file
View File

@ -0,0 +1,2 @@
;; Io: skipping non-TCO recursion
;; Reason: never completes, never segfaults

15
java/tests/step5_tco.mal Normal file
View File

@ -0,0 +1,15 @@
;; Test recursive non-tail call function
(def! sum-to (fn* (n) (if (= n 0) 0 (+ n (sum-to (- n 1))))))
(sum-to 10)
;=>55
;;; no try* yet, so test completion of side-effects
(def! res1 nil)
;=>nil
;;; For implementations without their own TCO this should fail and
;;; leave res1 unchanged
(def! res1 (sum-to 10000))
res1
;=>nil

15
js/tests/step5_tco.mal Normal file
View File

@ -0,0 +1,15 @@
;; Test recursive non-tail call function
(def! sum-to (fn* (n) (if (= n 0) 0 (+ n (sum-to (- n 1))))))
(sum-to 10)
;=>55
;;; no try* yet, so test completion of side-effects
(def! res1 nil)
;=>nil
;;; For implementations without their own TCO this should fail and
;;; leave res1 unchanged
(def! res1 (sum-to 10000))
res1
;=>nil

15
julia/tests/step5_tco.mal Normal file
View File

@ -0,0 +1,15 @@
;; Test recursive non-tail call function
(def! sum-to (fn* (n) (if (= n 0) 0 (+ n (sum-to (- n 1))))))
(sum-to 10)
;=>55
;;; no try* yet, so test completion of side-effects
(def! res1 nil)
;=>nil
;;; For implementations without their own TCO this should fail and
;;; leave res1 unchanged
(def! res1 (sum-to 10000))
res1
;=>nil

View File

@ -0,0 +1,15 @@
;; Test recursive non-tail call function
(def! sum-to (fn* (n) (if (= n 0) 0 (+ n (sum-to (- n 1))))))
(sum-to 10)
;=>55
;;; no try* yet, so test completion of side-effects
(def! res1 nil)
;=>nil
;;; For implementations without their own TCO this should fail and
;;; leave res1 unchanged
(def! res1 (sum-to 10000))
res1
;=>nil

15
lua/tests/step5_tco.mal Normal file
View File

@ -0,0 +1,15 @@
;; Test recursive non-tail call function
(def! sum-to (fn* (n) (if (= n 0) 0 (+ n (sum-to (- n 1))))))
(sum-to 10)
;=>55
;;; no try* yet, so test completion of side-effects
(def! res1 nil)
;=>nil
;;; For implementations without their own TCO this should fail and
;;; leave res1 unchanged
(def! res1 (sum-to 10000))
res1
;=>nil

View File

@ -0,0 +1,2 @@
;; miniMAL skipping non-TCO recursion
;; Reason: Unrecoverable stack overflow at 10,000

2
nim/tests/step5_tco.mal Normal file
View File

@ -0,0 +1,2 @@
;; Nim: skipping non-TCO recursion
;; Reason: completes at 10,000, unrecoverable segfault 20,000

2
objc/tests/step5_tco.mal Normal file
View File

@ -0,0 +1,2 @@
;; Objective C: skipping non-TCO recursion
;; Reason: completes at 10,000, unrecoverable segfault at 20,000

View File

@ -0,0 +1,2 @@
;; Object Pascal: skipping non-TCO recursion
;; Reason: completes at 10,000, unrecoverable segfault at 20,000

View File

@ -0,0 +1,2 @@
;; Ocaml skipping non-TCO recursion
;; Reason: completes at 50,000, unrecoverable segfaul at 100,000

15
perl/tests/step5_tco.mal Normal file
View File

@ -0,0 +1,15 @@
;; Test recursive non-tail call function
(def! sum-to (fn* (n) (if (= n 0) 0 (+ n (sum-to (- n 1))))))
(sum-to 10)
;=>55
;;; no try* yet, so test completion of side-effects
(def! res1 nil)
;=>nil
;;; For implementations without their own TCO this should fail and
;;; leave res1 unchanged
(def! res1 (sum-to 10000))
res1
;=>nil

2
php/tests/step5_tco.mal Normal file
View File

@ -0,0 +1,2 @@
;; PHP: skipping non-TCO recursion
;; Reason: completes at 10,000, unrecoverable segfault at 20,000

15
ps/tests/step5_tco.mal Normal file
View File

@ -0,0 +1,15 @@
;; Test recursive non-tail call function
(def! sum-to (fn* (n) (if (= n 0) 0 (+ n (sum-to (- n 1))))))
(sum-to 10)
;=>55
;;; no try* yet, so test completion of side-effects
(def! res1 nil)
;=>nil
;;; For implementations without their own TCO this should fail and
;;; leave res1 unchanged
(def! res1 (sum-to 10000))
res1
;=>nil

View File

@ -0,0 +1,15 @@
;; Test recursive non-tail call function
(def! sum-to (fn* (n) (if (= n 0) 0 (+ n (sum-to (- n 1))))))
(sum-to 10)
;=>55
;;; no try* yet, so test completion of side-effects
(def! res1 nil)
;=>nil
;;; For implementations without their own TCO this should fail and
;;; leave res1 unchanged
(def! res1 (sum-to 10000))
res1
;=>nil

15
r/tests/step5_tco.mal Normal file
View File

@ -0,0 +1,15 @@
;; Test recursive non-tail call function
(def! sum-to (fn* (n) (if (= n 0) 0 (+ n (sum-to (- n 1))))))
(sum-to 10)
;=>55
;;; no try* yet, so test completion of side-effects
(def! res1 nil)
;=>nil
;;; For implementations without their own TCO this should fail and
;;; leave res1 unchanged
(def! res1 (sum-to 10000))
res1
;=>nil

View File

@ -0,0 +1,2 @@
;; Racket: skipping non-TCO recursion
;; Reason: completes up to 1,000,000

View File

@ -0,0 +1,15 @@
;; Test recursive non-tail call function
(def! sum-to (fn* (n) (if (= n 0) 0 (+ n (sum-to (- n 1))))))
(sum-to 10)
;=>55
;;; no try* yet, so test completion of side-effects
(def! res1 nil)
;=>nil
;;; For implementations without their own TCO this should fail and
;;; leave res1 unchanged
(def! res1 (sum-to 10000))
res1
;=>nil

15
ruby/tests/step5_tco.mal Normal file
View File

@ -0,0 +1,15 @@
;; Test recursive non-tail call function
(def! sum-to (fn* (n) (if (= n 0) 0 (+ n (sum-to (- n 1))))))
(sum-to 10)
;=>55
;;; no try* yet, so test completion of side-effects
(def! res1 nil)
;=>nil
;;; For implementations without their own TCO this should fail and
;;; leave res1 unchanged
(def! res1 (sum-to 10000))
res1
;=>nil

2
rust/tests/step5_tco.mal Normal file
View File

@ -0,0 +1,2 @@
;; Rust: skipping non-TCO recursion
;; Reason: unrecoverable stack overflow

15
scala/tests/step5_tco.mal Normal file
View File

@ -0,0 +1,15 @@
;; Test recursive non-tail call function
(def! sum-to (fn* (n) (if (= n 0) 0 (+ n (sum-to (- n 1))))))
(sum-to 10)
;=>55
;;; no try* yet, so test completion of side-effects
(def! res1 nil)
;=>nil
;;; For implementations without their own TCO this should fail and
;;; leave res1 unchanged
(def! res1 (sum-to 10000))
res1
;=>nil

15
swift/tests/step5_tco.mal Normal file
View File

@ -0,0 +1,15 @@
;; Test recursive non-tail call function
(def! sum-to (fn* (n) (if (= n 0) 0 (+ n (sum-to (- n 1))))))
(sum-to 10)
;=>55
;;; no try* yet, so test completion of side-effects
(def! res1 nil)
;=>nil
;;; For implementations without their own TCO this should fail and
;;; leave res1 unchanged
(def! res1 (sum-to 10000))
res1
;=>nil

View File

@ -0,0 +1,2 @@
;; Swift 3: skipping non-TCO recursion
;; Reason: unrecoverable segfault at 10,000

15
tcl/tests/step5_tco.mal Normal file
View File

@ -0,0 +1,15 @@
;; Test recursive non-tail call function
(def! sum-to (fn* (n) (if (= n 0) 0 (+ n (sum-to (- n 1))))))
(sum-to 10)
;=>55
;;; no try* yet, so test completion of side-effects
(def! res1 nil)
;=>nil
;;; For implementations without their own TCO this should fail and
;;; leave res1 unchanged
(def! res1 (sum-to 10000))
res1
;=>nil

View File

@ -19,20 +19,3 @@ res2
(foo 10000)
;=>0
;; Test recursive non-tail call function
(def! sum-to (fn* (n) (if (= n 0) 0 (+ n (sum-to (- n 1))))))
(sum-to 10)
;=>55
;;; no try* yet, so test completion of side-effects
(def! res1 nil)
;=>nil
;;; For implementations without their own TCO this should fail and
;;; leave res1 unchanged
(def! res1 (sum-to 10000))
res1
;=>nil

2
vb/tests/step5_tco.mal Normal file
View File

@ -0,0 +1,2 @@
;; VB: skipping non-TCO recursion
;; Reason: unrecoverable segfault at 10,000

View File

@ -0,0 +1,15 @@
;; Test recursive non-tail call function
(def! sum-to (fn* (n) (if (= n 0) 0 (+ n (sum-to (- n 1))))))
(sum-to 10)
;=>55
;;; no try* yet, so test completion of side-effects
(def! res1 nil)
;=>nil
;;; For implementations without their own TCO this should fail and
;;; leave res1 unchanged
(def! res1 (sum-to 10000))
res1
;=>nil