diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2015-02-11 01:09:07 -0800 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2015-02-11 02:36:07 -0800 |
commit | 6195ab7d55a2f5dfe1dcd9fb5172b48b6ac6e74e (patch) | |
tree | 27f6d86e3037727bccfb04e72092208a693ad8db | |
parent | e25036038374f6879db794ad2086711521311e97 (diff) | |
download | mu-6195ab7d55a2f5dfe1dcd9fb5172b48b6ac6e74e.tar.gz |
742 - turns out chessboard test logs were incomplete
Now that we aren't loading system software for every test we can afford to log the loading of test functions.
-rw-r--r-- | chessboard.arc.t | 4 | ||||
-rw-r--r-- | mu.arc | 29 | ||||
-rw-r--r-- | mu.arc.t | 13 |
3 files changed, 26 insertions, 20 deletions
diff --git a/chessboard.arc.t b/chessboard.arc.t index 32f0b416..00f0723b 100644 --- a/chessboard.arc.t +++ b/chessboard.arc.t @@ -48,6 +48,8 @@ (add-code:readfile "chessboard.mu") ; initialize some variables at specific raw locations ;? (prn "== init") +(freeze function*) +(load-system-functions) (run-code test-init (1:channel-address/raw <- init-channel 1:literal) (2:terminal-address/raw <- init-fake-terminal 20:literal 10:literal) @@ -64,7 +66,7 @@ (wipe completed-routines*) ; check that read-move consumes it and then goes to sleep (enq read-move-routine running-routines*) - (run) + (run-more) (when (ran-to-completion 'read-move) (prn "F - chessboard waits after first letter of move")) (wipe completed-routines*) diff --git a/mu.arc b/mu.arc index 9590f561..c5a14eca 100644 --- a/mu.arc +++ b/mu.arc @@ -322,9 +322,10 @@ (def run fn-names (freeze function*) (load-system-functions) -;? (write function*) -;? (quit) - (= traces* (queue)) + (apply run-more fn-names)) + +; assume we've already frozen; throw on a few more routines and continue scheduling +(def run-more fn-names (each it fn-names (enq make-routine.it running-routines*)) (while (~empty running-routines*) @@ -335,10 +336,7 @@ (trace "schedule" label.routine*) (routine-mark (run-for-time-slice scheduling-interval*)) - (update-scheduler-state) -;? (tr "after run iter " running-routines*) -;? (tr "after run iter " empty.running-routines*) - )) + (update-scheduler-state))) ; prepare next iteration of round-robin scheduler ; @@ -1282,7 +1280,9 @@ (when (and (nondummy oarg) (is v.oarg 0) (iso ty.oarg '(space-address))) - (assert (no next-space-generator*.name) "function can have only one next-space-generator environment") + (assert (or (no next-space-generator*.name) + (is next-space-generator*.name (alref oarg 'names))) + "function can have only one next-space-generator environment") (tr "next-space-generator of @name is @(alref oarg 'names)") (= next-space-generator*.name (alref oarg 'names)))))))) @@ -1295,7 +1295,7 @@ (replace-names-with-location instrs name)) (def assign-names-to-location (instrs name) -;? (tr name) + (trace "cn0" "convert-names in @name") ;? (prn name ": " location*) ;? 1 (point return (ret location (table) @@ -1589,6 +1589,12 @@ ; we could clear location* at this point, but maybe we'll find a use for it ) +(def freeze-another (fn-name) + (= function*.fn-name (convert-labels:convert-braces:tokenize-args:insert-code function*.fn-name fn-name)) + (check-default-space function*.fn-name fn-name) + (add-next-space-generator function*.fn-name fn-name) + (convert-names function*.fn-name fn-name)) + (def tokenize-arg (arg) ;? (tr "tokenize-arg " arg) (if (in arg '<- '_) @@ -1660,10 +1666,13 @@ :else (recur (+ addr 1) (+ idx 1)))))) +; run code in tests (mac run-code (name . body) + ; careful to avoid re-processing functions and adding noise to traces `(do (add-code '((function ,name [ ,@body ]))) - (run ',name))) + (freeze-another ',name) + (run-more ',name))) (def routine-that-ran (f) (find [some [is f _!fn-name] stack._] diff --git a/mu.arc.t b/mu.arc.t index 08ff3535..a74117a2 100644 --- a/mu.arc.t +++ b/mu.arc.t @@ -165,8 +165,8 @@ ;? (prn memory*) (when (~is memory*.1 23) (prn "F - 'copy' writes its lone 'arg' after the instruction name to its lone 'oarg' or output arg before the arrow. After this test, the value 23 is stored in memory address 1.")) -;? (reset) ;? 1 -;? (quit) ;? 1 +;? (reset) ;? 2 +;? (quit) ;? 2 ; Our basic arithmetic ops can operate on memory locations or literals. ; (Ignore hardware details like registers for now.) @@ -918,13 +918,8 @@ (~is (memory* (+ second 1)) t) (~is memory*.10 nil)))) (prn "F - lists can contain elements of different types")))) -(add-code - '((function test2 [ - (10:list-address <- list-next 1:list-address) - ]))) -;? (set dump-trace*) -(run 'test2) -;? (prn memory*) +(run-code test2 + (10:list-address <- list-next 1:list-address)) (each routine completed-routines* (aif rep.routine!error (prn "error - " it))) (when (~is memory*.10 memory*.6) |