about summary refs log tree commit diff stats
path: root/subx
diff options
context:
space:
mode:
authorKartik Agaram <vc@akkartik.com>2018-10-10 23:39:50 -0700
committerKartik Agaram <vc@akkartik.com>2018-10-11 00:08:50 -0700
commitc25d9aa42a7d3ea142ca8cb3887030866ac32a6f (patch)
treeeffacfcb2088b3b36467e1abb5d281cc836dba22 /subx
parentb59b75310abdd3c6c6a63654ab2ae14d46c2028e (diff)
downloadmu-c25d9aa42a7d3ea142ca8cb3887030866ac32a6f.tar.gz
4684
Turns out the tests for 'trace' have been broken in native mode since the
original commit (4674). Dangers of running my tests on Darwin, where I
can't run them natively.

The test failures didn't get flagged on CI because I'd forgotten to update
the exit code of the factorial app in commit 4664. At least that's fixed
in this commit.
Diffstat (limited to 'subx')
-rw-r--r--subx/055trace.subx2
-rwxr-xr-xsubx/apps/crenshaw2-1bin2522 -> 2529 bytes
-rwxr-xr-xsubx/apps/factorialbin2520 -> 2533 bytes
-rw-r--r--subx/apps/factorial.subx5
-rwxr-xr-xsubx/test_apps8
5 files changed, 11 insertions, 4 deletions
diff --git a/subx/055trace.subx b/subx/055trace.subx
index 237fbed9..68309ab0 100644
--- a/subx/055trace.subx
+++ b/subx/055trace.subx
@@ -219,7 +219,7 @@ test-trace-single:
   81          0/subop/add         3/mod/direct    4/rm32/ESP    .           .             .           .           .               8/imm32           # add to ESP
   # check-ints-equal(*Test-trace-stream.data, 41/A 62/b 0a/newline 00, msg)
     # push args
-  68/push  "F - test-trace"/imm32
+  68/push  "F - test-trace-single"/imm32
   68/push  0x0a6241/imm32/Ab-newline
     # push *Test-trace-stream.data
   b8/copy-to-EAX  Test-trace-stream/imm32
diff --git a/subx/apps/crenshaw2-1 b/subx/apps/crenshaw2-1
index f551dbf9..40c1e72d 100755
--- a/subx/apps/crenshaw2-1
+++ b/subx/apps/crenshaw2-1
Binary files differdiff --git a/subx/apps/factorial b/subx/apps/factorial
index 5b7811bc..ad2c98a4 100755
--- a/subx/apps/factorial
+++ b/subx/apps/factorial
Binary files differdiff --git a/subx/apps/factorial.subx b/subx/apps/factorial.subx
index 8eac94bc..578aeb70 100644
--- a/subx/apps/factorial.subx
+++ b/subx/apps/factorial.subx
@@ -36,9 +36,10 @@
     # check result
   3d/compare-EAX  1/imm32
   75/jump-if-not-equal  $run-main/disp8
-  # then
+  # then return run-tests()
   e8/call  run-tests/disp32
-  eb/jump  $main-exit/disp8
+  8b/copy                         0/mod/indirect  5/rm32/.disp32            .             .           0/r32/EAX   Num-test-failures/disp32          # copy *Num-test-failures to EAX
+  eb/jump  $main-exit/disp8  # where EAX will get copied to EBX
   # else EAX = factorial(5)
 $run-main:
     # push arg
diff --git a/subx/test_apps b/subx/test_apps
index 8f00e538..a8060016 100755
--- a/subx/test_apps
+++ b/subx/test_apps
@@ -115,7 +115,11 @@ echo ex11
 CFLAGS=-g ./subx translate examples/ex11.subx  -o examples/ex11
 test `uname -m` = 'i686'  &&  git diff --quiet examples/ex11
 CFLAGS=-g ./subx run examples/ex11
-test `uname` = 'Linux'  &&  examples/ex11
+echo
+test `uname` = 'Linux'  &&  {
+  examples/ex11
+  echo
+}
 
 echo ex12
 CFLAGS=-g ./subx translate examples/ex12.subx  -o examples/ex12
@@ -129,10 +133,12 @@ test `uname -m` = 'i686'  &&  git diff --quiet apps/factorial
 CFLAGS=-g ./subx run apps/factorial  ||  ret=$?
 test $ret -eq 120  # factorial(5)
 CFLAGS=-g ./subx run apps/factorial test
+echo
 test `uname` = 'Linux'  &&  {
   apps/factorial  ||  ret=$?
   test $ret -eq 120  # factorial(5)
   apps/factorial test
+  echo
 }
 
 echo crenshaw2-1