1
1
mirror of https://github.com/kanaka/mal.git synced 2024-10-10 20:38:01 +03:00

Regress test of deferrables. Fix dart, factor.

Add a regression run to Travis that enables hard deferrables but
omits optionals so that we can test to make sure that all the
requirements are met for self-hosting in stepA.

Cleanup up some of the soft/deferrable/optional markings.
Deferrables are what will be needed eventually to self host but aren't
needed for the immediate next steps. Optional aren't even needed for
self-hosting but are nice things to have.

Also:
- Sync dart step9 and stepA with step8. Do not eval macroexpanded
  forms in macroexpand form.
- Fix stepA of factor which was missing some fixes from step9.
- Increase test timeouts in top-level Makefile for guile and io.
This commit is contained in:
Joel Martin 2019-07-24 01:29:40 -05:00
parent 7303226945
commit 77fd710cab
13 changed files with 74 additions and 67 deletions

View File

@ -109,4 +109,5 @@ script:
# Build, test, perf # Build, test, perf
- ./.travis_test.sh build ${IMPL} - ./.travis_test.sh build ${IMPL}
- ./.travis_test.sh test ${IMPL} - ./.travis_test.sh test ${IMPL}
- STEP=stepA REGRESS=1 HARD=1 OPTIONAL=0 ./.travis_test.sh test ${IMPL}
- ./.travis_test.sh perf ${IMPL} - ./.travis_test.sh perf ${IMPL}

View File

@ -61,6 +61,9 @@ test|perf)
if ! ${MAKE} TEST_OPTS="${TEST_OPTS}" \ if ! ${MAKE} TEST_OPTS="${TEST_OPTS}" \
${MAL_IMPL:+MAL_IMPL=${MAL_IMPL}} \ ${MAL_IMPL:+MAL_IMPL=${MAL_IMPL}} \
${REGRESS:+REGRESS=${REGRESS}} \ ${REGRESS:+REGRESS=${REGRESS}} \
${HARD:+HARD=${HARD}} \
${DEFERRABLE:+DEFERRABLE=${DEFERRABLE}} \
${OPTIONAL:+OPTIONAL=${OPTIONAL}} \
${ACTION}^${IMPL}${STEP:+^${STEP}}; then ${ACTION}^${IMPL}${STEP:+^${STEP}}; then
# print debug-file on error # print debug-file on error
cat ${ACTION}.err cat ${ACTION}.err

View File

@ -77,6 +77,7 @@ TEST_OPTS =
# later steps. # later steps.
REGRESS = REGRESS =
HARD=
DEFERRABLE=1 DEFERRABLE=1
OPTIONAL=1 OPTIONAL=1
@ -142,6 +143,8 @@ dist_EXCLUDES += guile io julia matlab swift
# Extra options to pass to runtest.py # Extra options to pass to runtest.py
bbc-basic_TEST_OPTS = --test-timeout 60 bbc-basic_TEST_OPTS = --test-timeout 60
guile_TEST_OPTS = --test-timeout 120
io_TEST_OPTS = --test-timeout 120
logo_TEST_OPTS = --start-timeout 60 --test-timeout 120 logo_TEST_OPTS = --start-timeout 60 --test-timeout 120
mal_TEST_OPTS = --start-timeout 60 --test-timeout 120 mal_TEST_OPTS = --start-timeout 60 --test-timeout 120
miniMAL_TEST_OPTS = --start-timeout 60 --test-timeout 120 miniMAL_TEST_OPTS = --start-timeout 60 --test-timeout 120
@ -270,6 +273,7 @@ noop =
SPACE = $(noop) $(noop) SPACE = $(noop) $(noop)
export FACTOR_ROOTS := . export FACTOR_ROOTS := .
opt_HARD = $(if $(strip $(HARD)),$(if $(filter t true T True TRUE 1 y yes Yes YES,$(HARD)),--hard,),)
opt_DEFERRABLE = $(if $(strip $(DEFERRABLE)),$(if $(filter t true T True TRUE 1 y yes Yes YES,$(DEFERRABLE)),--deferrable,--no-deferrable),--no-deferrable) opt_DEFERRABLE = $(if $(strip $(DEFERRABLE)),$(if $(filter t true T True TRUE 1 y yes Yes YES,$(DEFERRABLE)),--deferrable,--no-deferrable),--no-deferrable)
opt_OPTIONAL = $(if $(strip $(OPTIONAL)),$(if $(filter t true T True TRUE 1 y yes Yes YES,$(OPTIONAL)),--optional,--no-optional),--no-optional) opt_OPTIONAL = $(if $(strip $(OPTIONAL)),$(if $(filter t true T True TRUE 1 y yes Yes YES,$(OPTIONAL)),--optional,--no-optional),--no-optional)
@ -328,7 +332,7 @@ get_run_prefix = $(strip $(foreach mode,$(call actual_impl,$(1))_MODE, \
# Takes impl and step # Takes impl and step
# Returns the runtest command prefix (with runtest options) for testing the given step # Returns the runtest command prefix (with runtest options) for testing the given step
get_runtest_cmd = $(call get_run_prefix,$(1),$(2),$(if $(filter cs fsharp mal tcl vb,$(1)),RAW=1,)) \ get_runtest_cmd = $(call get_run_prefix,$(1),$(2),$(if $(filter cs fsharp mal tcl vb,$(1)),RAW=1,)) \
../runtest.py $(opt_DEFERRABLE) $(opt_OPTIONAL) $(call $(1)_TEST_OPTS) $(TEST_OPTS) ../runtest.py $(opt_HARD) $(opt_DEFERRABLE) $(opt_OPTIONAL) $(call $(1)_TEST_OPTS) $(TEST_OPTS)
# Takes impl and step # Takes impl and step
# Returns the runtest command prefix (with runtest options) for testing the given step # Returns the runtest command prefix (with runtest options) for testing the given step

View File

@ -188,8 +188,7 @@ MalType EVAL(MalType ast, Env env) {
ast = quasiquote(args.first); ast = quasiquote(args.first);
continue; continue;
} else if (symbol.value == 'macroexpand') { } else if (symbol.value == 'macroexpand') {
ast = macroexpand(args.first, env); return macroexpand(args.first, env);
continue;
} else if (symbol.value == 'try*') { } else if (symbol.value == 'try*') {
var body = args.first; var body = args.first;
if (args.length < 2) { if (args.length < 2) {

View File

@ -190,8 +190,7 @@ MalType EVAL(MalType ast, Env env) {
ast = quasiquote(args.first); ast = quasiquote(args.first);
continue; continue;
} else if (symbol.value == 'macroexpand') { } else if (symbol.value == 'macroexpand') {
ast = macroexpand(args.first, env); return macroexpand(args.first, env);
continue;
} else if (symbol.value == 'try*') { } else if (symbol.value == 'try*') {
var body = args.first; var body = args.first;
if (args.length < 2) { if (args.length < 2) {

View File

@ -50,8 +50,12 @@ DEFER: EVAL
:: eval-try* ( params env -- maltype ) :: eval-try* ( params env -- maltype )
[ params first env EVAL ] [ params first env EVAL ]
[ [
params second second env new-env [ env-set ] keep params length 1 > [
params second third swap EVAL params second second env new-env [ env-set ] keep
params second third swap EVAL
] [
throw
] if
] recover ; ] recover ;
: args-split ( bindlist -- bindlist restbinding/f ) : args-split ( bindlist -- bindlist restbinding/f )
@ -121,7 +125,11 @@ M: callable apply call( x -- y ) f ;
: PRINT ( maltype -- str ) pr-str ; : PRINT ( maltype -- str ) pr-str ;
: REP ( str -- str ) : REP ( str -- str )
[ READ repl-env get EVAL ] [ nip ] recover PRINT ; [
READ repl-env get EVAL PRINT
] [
nip pr-str "Error: " swap append
] recover ;
: REPL ( -- ) : REPL ( -- )
"(println (str \"Mal [\" *host-language* \"]\"))" REP drop "(println (str \"Mal [\" *host-language* \"]\"))" REP drop

View File

@ -164,10 +164,6 @@ false
;=>(splice-unquote (1 2 3)) ;=>(splice-unquote (1 2 3))
;>>> optional=True
;;
;; -------- Optional Functionality --------
;; Testing keywords ;; Testing keywords
:kw :kw
;=>:kw ;=>:kw
@ -221,16 +217,19 @@ false
1; comment after expression 1; comment after expression
;=>1 ;=>1
;; Testing read of ^/metadata
^{"a" 1} [1 2 3]
;=>(with-meta [1 2 3] {"a" 1})
;; Testing read of @/deref ;; Testing read of @/deref
@a @a
;=>(deref a) ;=>(deref a)
;>>> soft=True ;>>> soft=True
;>>> optional=True
;;
;; -------- Optional Functionality --------
;; Testing read of ^/metadata
^{"a" 1} [1 2 3]
;=>(with-meta [1 2 3] {"a" 1})
;; Non alphanumerice characters in strings ;; Non alphanumerice characters in strings
;;; \t is not specified enough to be tested ;;; \t is not specified enough to be tested

View File

@ -29,9 +29,8 @@
;=>() ;=>()
;>>> deferrable=True ;>>> deferrable=True
;>>> optional=True
;; ;;
;; -------- Deferrable/Optional Functionality -------- ;; -------- Deferrable Functionality --------
;; Testing evaluation within collection literals ;; Testing evaluation within collection literals
[1 2 (+ 1 2)] [1 2 (+ 1 2)]

View File

@ -64,9 +64,8 @@ y
;=>4 ;=>4
;>>> deferrable=True ;>>> deferrable=True
;>>> optional=True
;; ;;
;; -------- Deferrable/Optional Functionality -------- ;; -------- Deferrable Functionality --------
;; Testing let* with vector bindings ;; Testing let* with vector bindings
(let* [z 9] z) (let* [z 9] z)

View File

@ -420,9 +420,6 @@ nil
;/\(1 2 abc "\) def ;/\(1 2 abc "\) def
;=>nil ;=>nil
;>>> optional=True
;;
;; -------- Optional Functionality --------
;; Testing keywords ;; Testing keywords
(= :abc :abc) (= :abc :abc)

View File

@ -101,6 +101,28 @@
(fib 2) (fib 2)
;=>1 ;=>1
;; Testing `@` reader macro (short for `deref`)
(def! atm (atom 9))
@atm
;=>9
;;; TODO: really a step5 test
;; Testing that vector params not broken by TCO
(def! g (fn* [] 78))
(g)
;=>78
(def! g (fn* [a] (+ a 78)))
(g 3)
;=>81
;;
;; Testing that *ARGV* exists and is an empty list
(list? *ARGV*)
;=>true
*ARGV*
;=>()
;>>> soft=True
;>>> optional=True ;>>> optional=True
;; ;;
;; -------- Optional Functionality -------- ;; -------- Optional Functionality --------
@ -119,35 +141,12 @@
mymap mymap
;=>{"a" 1} ;=>{"a" 1}
;; Testing `@` reader macro (short for `deref`)
(def! atm (atom 9))
@atm
;=>9
;;; TODO: really a step5 test
;; Testing that vector params not broken by TCO
(def! g (fn* [] 78))
(g)
;=>78
(def! g (fn* [a] (+ a 78)))
(g 3)
;=>81
;; Checking that eval does not use local environments. ;; Checking that eval does not use local environments.
(def! a 1) (def! a 1)
;=>1 ;=>1
(let* (a 2) (eval (read-string "a"))) (let* (a 2) (eval (read-string "a")))
;=>1 ;=>1
;;
;; Testing that *ARGV* exists and is an empty list
(list? *ARGV*)
;=>true
*ARGV*
;=>()
;>>> soft=True
;; Non alphanumeric characters in comments in read-string ;; Non alphanumeric characters in comments in read-string
(read-string "1;!") (read-string "1;!")
;=>1 ;=>1

View File

@ -119,6 +119,22 @@ b
'(1 2 (3 4)) '(1 2 (3 4))
;=>(1 2 (3 4)) ;=>(1 2 (3 4))
;; Testing cons and concat with vectors
(cons [1] [2 3])
;=>([1] 2 3)
(cons 1 [2 3])
;=>(1 2 3)
(concat [1 2] (list 3 4) [5 6])
;=>(1 2 3 4 5 6)
(concat [1 2])
;=>(1 2)
;>>> optional=True
;;
;; -------- Optional Functionality --------
;; Testing ` (quasiquote) reader macro ;; Testing ` (quasiquote) reader macro
`7 `7
;=>7 ;=>7
@ -151,22 +167,6 @@ b
`(1 ~@c 3) `(1 ~@c 3)
;=>(1 1 "b" "d" 3) ;=>(1 1 "b" "d" 3)
;>>> optional=True
;;
;; -------- Optional Functionality --------
;; Testing cons and concat with vectors
(cons [1] [2 3])
;=>([1] 2 3)
(cons 1 [2 3])
;=>(1 2 3)
(concat [1 2] (list 3 4) [5 6])
;=>(1 2 3 4 5 6)
(concat [1 2])
;=>(1 2)
;; Testing unquote with vectors ;; Testing unquote with vectors
(def! a 8) (def! a 8)
;=>8 ;=>8

View File

@ -92,10 +92,6 @@ x
;=>"yes" ;=>"yes"
;>>> optional=True
;;
;; -------- Optional Functionality --------
;; Testing nth, first, rest with vectors ;; Testing nth, first, rest with vectors
(nth [1] 0) (nth [1] 0)
@ -132,6 +128,10 @@ x
;=>"yes" ;=>"yes"
;>>> soft=True ;>>> soft=True
;>>> optional=True
;;
;; ------- Optional Functionality --------------
;; ------- (Not needed for self-hosting) -------
;; Test that macros use closures ;; Test that macros use closures
(def! x 2) (def! x 2)