Skip to content

Commit

Permalink
Tests: move step5 non-TCO tests to per impl.
Browse files Browse the repository at this point in the history
- 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.
  • Loading branch information
kanaka committed Mar 15, 2016
1 parent eaa6ceb commit dca6b58
Show file tree
Hide file tree
Showing 48 changed files with 418 additions and 48 deletions.
45 changes: 14 additions & 31 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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

PERF_EXCLUDES = mal # TODO: fix this
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

dist_EXCLUDES += mal
# TODO: still need to implement dist
Expand Down Expand Up @@ -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 \
Expand Down Expand Up @@ -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)
Expand Down
2 changes: 2 additions & 0 deletions awk/tests/step5_tco.mal
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
;; awk: skipping non-TCO recursion
;; Reason: completes up to 50,000
2 changes: 2 additions & 0 deletions c/tests/step5_tco.mal
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
;; C: skipping non-TCO recursion
;; Reason: segfaults (unrecoverable)
15 changes: 15 additions & 0 deletions clojure/tests/step5_tco.mal
Original file line number Diff line number Diff line change
@@ -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 changes: 15 additions & 0 deletions coffee/tests/step5_tco.mal
Original file line number Diff line number Diff line change
@@ -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 changes: 2 additions & 0 deletions cpp/tests/step5_tco.mal
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
;; C++: skipping non-TCO recursion
;; Reason: completes at 10,000, segfaults at 20,000
2 changes: 2 additions & 0 deletions crystal/tests/step5_tco.mal
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
;; Crystal: skipping non-TCO recursion
;; Reason: completes at 1,000,000
2 changes: 2 additions & 0 deletions cs/tests/step5_tco.mal
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
;; C#: skipping non-TCO recursion
;; Reason: unrecoverable stack overflow at 10,000
2 changes: 2 additions & 0 deletions d/tests/step5_tco.mal
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
;; D: skipping non-TCO recursion
;; Reason: completes at 10,000, segfaults at 40,000
15 changes: 15 additions & 0 deletions elisp/tests/step5_tco.mal
Original file line number Diff line number Diff line change
@@ -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 changes: 2 additions & 0 deletions elixir/tests/step5_tco.mal
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
;; Elixir: skipping non-TCO recursion
;; Reason: Elixir has TCO, test always completes.
2 changes: 2 additions & 0 deletions erlang/tests/step5_tco.mal
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
;; Erlang: skipping non-TCO recursion
;; Reason: Erlang has TCO, test always completes.
15 changes: 15 additions & 0 deletions es6/tests/step5_tco.mal
Original file line number Diff line number Diff line change
@@ -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 changes: 15 additions & 0 deletions factor/tests/step5_tco.mal
Original file line number Diff line number Diff line change
@@ -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 changes: 15 additions & 0 deletions forth/tests/step5_tco.mal
Original file line number Diff line number Diff line change
@@ -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 changes: 2 additions & 0 deletions fsharp/tests/step5_tco.mal
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
;; F#: skipping non-TCO recursion
;; Reason: completes at 10,000, unrecoverable segfault at 20,000
2 changes: 2 additions & 0 deletions go/tests/step5_tco.mal
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
;; Go: skipping non-TCO recursion
;; Reason: completes even at 100,000
15 changes: 15 additions & 0 deletions groovy/tests/step5_tco.mal
Original file line number Diff line number Diff line change
@@ -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 changes: 15 additions & 0 deletions guile/tests/step5_tco.mal
Original file line number Diff line number Diff line change
@@ -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 changes: 2 additions & 0 deletions haskell/tests/step5_tco.mal
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
;; Haskell: skipping non-TCO recursion
;; Reason: completes up to 100,000, stackoverflow at 1,000,000
15 changes: 15 additions & 0 deletions haxe/tests/step5_tco.mal
Original file line number Diff line number Diff line change
@@ -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 changes: 2 additions & 0 deletions io/tests/step5_tco.mal
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
;; Io: skipping non-TCO recursion
;; Reason: never completes, never segfaults
15 changes: 15 additions & 0 deletions java/tests/step5_tco.mal
Original file line number Diff line number Diff line change
@@ -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 changes: 15 additions & 0 deletions js/tests/step5_tco.mal
Original file line number Diff line number Diff line change
@@ -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 changes: 15 additions & 0 deletions julia/tests/step5_tco.mal
Original file line number Diff line number Diff line change
@@ -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 changes: 15 additions & 0 deletions kotlin/tests/step5_tco.mal
Original file line number Diff line number Diff line change
@@ -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 changes: 15 additions & 0 deletions lua/tests/step5_tco.mal
Original file line number Diff line number Diff line change
@@ -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 changes: 2 additions & 0 deletions miniMAL/tests/step5_tco.mal
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
;; miniMAL skipping non-TCO recursion
;; Reason: Unrecoverable stack overflow at 10,000
2 changes: 2 additions & 0 deletions nim/tests/step5_tco.mal
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
;; Nim: skipping non-TCO recursion
;; Reason: completes at 10,000, unrecoverable segfault 20,000
2 changes: 2 additions & 0 deletions objc/tests/step5_tco.mal
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
;; Objective C: skipping non-TCO recursion
;; Reason: completes at 10,000, unrecoverable segfault at 20,000
2 changes: 2 additions & 0 deletions objpascal/tests/step5_tco.mal
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
;; Object Pascal: skipping non-TCO recursion
;; Reason: completes at 10,000, unrecoverable segfault at 20,000
2 changes: 2 additions & 0 deletions ocaml/tests/step5_tco.mal
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
;; Ocaml skipping non-TCO recursion
;; Reason: completes at 50,000, unrecoverable segfaul at 100,000
15 changes: 15 additions & 0 deletions perl/tests/step5_tco.mal
Original file line number Diff line number Diff line change
@@ -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 changes: 2 additions & 0 deletions php/tests/step5_tco.mal
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
;; PHP: skipping non-TCO recursion
;; Reason: completes at 10,000, unrecoverable segfault at 20,000
15 changes: 15 additions & 0 deletions ps/tests/step5_tco.mal
Original file line number Diff line number Diff line change
@@ -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 changes: 15 additions & 0 deletions python/tests/step5_tco.mal
Original file line number Diff line number Diff line change
@@ -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
Loading

0 comments on commit dca6b58

Please sign in to comment.