about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorKartik Agaram <vc@akkartik.com>2020-09-29 20:21:30 -0700
committerKartik Agaram <vc@akkartik.com>2020-09-29 20:33:29 -0700
commit8246324ebb83078109a64cb43a40fe0703033c81 (patch)
treee5274774ae1e5df719794cfa26465c593424dc49
parentcf1ddc4170e9d76eea196e4bc34dcf5f9bc66fdd (diff)
downloadmu-8246324ebb83078109a64cb43a40fe0703033c81.tar.gz
6903
Make a few tests more self-contained.

I'd prefer to just run a function called `setup` first thing on startup
and move this portion of convert-mu to it:
    # initialize global data structures
    c7 0/subop/copy *Next-block-index 1/imm32
    8b/-> *Primitive-type-ids 0/r32/eax
    89/<- *Type-id 0/r32/eax  # stream-write
    c7 0/subop/copy *_Program-functions 0/imm32
    c7 0/subop/copy *_Program-functions->payload 0/imm32
    c7 0/subop/copy *_Program-types 0/imm32
    c7 0/subop/copy *_Program-types->payload 0/imm32
    c7 0/subop/copy *_Program-signatures 0/imm32
    c7 0/subop/copy *_Program-signatures->payload 0/imm32

However, this approach doesn't fix my run_one_test tooling.
-rwxr-xr-xapps/mubin396171 -> 396315 bytes
-rw-r--r--apps/mu.subx29
2 files changed, 29 insertions, 0 deletions
diff --git a/apps/mu b/apps/mu
index 3578f813..9b66a156 100755
--- a/apps/mu
+++ b/apps/mu
Binary files differdiff --git a/apps/mu.subx b/apps/mu.subx
index 683df3be..4d842f32 100644
--- a/apps/mu.subx
+++ b/apps/mu.subx
@@ -8245,6 +8245,8 @@ test-function-header-with-arg:
     55/push-ebp
     89/<- %ebp 4/r32/esp
     # setup
+    8b/-> *Primitive-type-ids 0/r32/eax
+    89/<- *Type-id 0/r32/eax  # stream-write
     (clear-stream _test-input-stream)
     (write _test-input-stream "foo n: int {\n")
     # var result/ecx: function
@@ -8283,6 +8285,8 @@ test-function-header-with-multiple-args:
     55/push-ebp
     89/<- %ebp 4/r32/esp
     # setup
+    8b/-> *Primitive-type-ids 0/r32/eax
+    89/<- *Type-id 0/r32/eax  # stream-write
     (clear-stream _test-input-stream)
     (write _test-input-stream "foo a: int, b: int c: int {\n")
     # result/ecx: function
@@ -8354,6 +8358,8 @@ test-function-header-with-multiple-args-and-outputs:
     55/push-ebp
     89/<- %ebp 4/r32/esp
     # setup
+    8b/-> *Primitive-type-ids 0/r32/eax
+    89/<- *Type-id 0/r32/eax  # stream-write
     (clear-stream _test-input-stream)
     (write _test-input-stream "foo a: int, b: int, c: int -> x/ecx: int y/edx: int {\n")
     # result/ecx: function
@@ -9018,6 +9024,9 @@ test-parse-var-with-type:
     # . prologue
     55/push-ebp
     89/<- %ebp 4/r32/esp
+    # setup
+    8b/-> *Primitive-type-ids 0/r32/eax
+    89/<- *Type-id 0/r32/eax  # stream-write
     # (eax..ecx) = "x:"
     b8/copy-to-eax "x:"/imm32
     8b/-> *eax 1/r32/ecx
@@ -9056,6 +9065,9 @@ test-parse-var-with-type-and-register:
     # . prologue
     55/push-ebp
     89/<- %ebp 4/r32/esp
+    # setup
+    8b/-> *Primitive-type-ids 0/r32/eax
+    89/<- *Type-id 0/r32/eax  # stream-write
     # (eax..ecx) = "x/eax:"
     b8/copy-to-eax "x/eax:"/imm32
     8b/-> *eax 1/r32/ecx
@@ -9097,6 +9109,9 @@ test-parse-var-with-trailing-characters:
     # . prologue
     55/push-ebp
     89/<- %ebp 4/r32/esp
+    # setup
+    8b/-> *Primitive-type-ids 0/r32/eax
+    89/<- *Type-id 0/r32/eax  # stream-write
     # (eax..ecx) = "x:"
     b8/copy-to-eax "x:"/imm32
     8b/-> *eax 1/r32/ecx
@@ -9137,6 +9152,9 @@ test-parse-var-with-register-and-trailing-characters:
     # . prologue
     55/push-ebp
     89/<- %ebp 4/r32/esp
+    # setup
+    8b/-> *Primitive-type-ids 0/r32/eax
+    89/<- *Type-id 0/r32/eax  # stream-write
     # (eax..ecx) = "x/eax:"
     b8/copy-to-eax "x/eax:"/imm32
     8b/-> *eax 1/r32/ecx
@@ -9178,6 +9196,9 @@ test-parse-var-with-compound-type:
     # . prologue
     55/push-ebp
     89/<- %ebp 4/r32/esp
+    # setup
+    8b/-> *Primitive-type-ids 0/r32/eax
+    89/<- *Type-id 0/r32/eax  # stream-write
     # (eax..ecx) = "x:"
     b8/copy-to-eax "x:"/imm32
     8b/-> *eax 1/r32/ecx
@@ -10050,6 +10071,8 @@ test-parse-mu-var-def:
     55/push-ebp
     89/<- %ebp 4/r32/esp
     # setup
+    8b/-> *Primitive-type-ids 0/r32/eax
+    89/<- *Type-id 0/r32/eax  # stream-write
     (clear-stream _test-input-stream)
     (write _test-input-stream "n: int\n")  # caller has consumed the 'var'
     c7 0/subop/copy *Curr-block-depth 1/imm32
@@ -10096,6 +10119,8 @@ test-parse-mu-reg-var-def:
     55/push-ebp
     89/<- %ebp 4/r32/esp
     # setup
+    8b/-> *Primitive-type-ids 0/r32/eax
+    89/<- *Type-id 0/r32/eax  # stream-write
     (clear-stream _test-input-stream)
     (write _test-input-stream "n/eax: int <- copy 0\n")  # caller has consumed the 'var'
     c7 0/subop/copy *Curr-block-depth 1/imm32
@@ -11021,6 +11046,8 @@ test-parse-mu-stmt:
     55/push-ebp
     89/<- %ebp 4/r32/esp
     # setup
+    8b/-> *Primitive-type-ids 0/r32/eax
+    89/<- *Type-id 0/r32/eax  # stream-write
     (clear-stream _test-input-stream)
     (write _test-input-stream "increment n\n")
     # var vars/ecx: (stack (addr var) 16)
@@ -11077,6 +11104,8 @@ test-parse-mu-stmt-with-comma:
     55/push-ebp
     89/<- %ebp 4/r32/esp
     # setup
+    8b/-> *Primitive-type-ids 0/r32/eax
+    89/<- *Type-id 0/r32/eax  # stream-write
     (clear-stream _test-input-stream)
     (write _test-input-stream "copy-to n, 3\n")
     # var vars/ecx: (stack (addr var) 16)