duskos

dusk os fork
git clone git://git.alexwennerberg.com/duskos
Log | Files | Refs | README | LICENSE

commit 30d0c77ad9412022cdee7bca84978eeb4eeab47f
parent 93745e29ced2b719a24644c4d1e4d70390931ceb
Author: Virgil Dupras <hsoft@hardcoded.net>
Date:   Thu, 13 Oct 2022 15:51:52 -0400

tests: add app/cos tests to the suite

Diffstat:
Mfs/app/cos/cvm.c | 10+++++-----
Dfs/app/cos/dummy.bin | 2--
Dfs/app/cos/test.fs | 14--------------
Mfs/tests/all.fs | 1+
Afs/tests/app/all.fs | 1+
Afs/tests/app/cos/all.fs | 1+
Afs/tests/app/cos/cvm.fs | 18++++++++++++++++++
Afs/tests/app/cos/dummy.bin | 0
Dtestblkpack.fs | 8--------
Dtestcvm.fs | 2--
10 files changed, 26 insertions(+), 31 deletions(-)

diff --git a/fs/app/cos/cvm.c b/fs/app/cos/cvm.c @@ -104,7 +104,7 @@ static void sw(word addr, word val) { static word peek() { return gw(vm.SP); } /* pop word from SP */ static word pop() { word n = peek(); vm.SP+=2; return n; } -word VM_PS_pop() { return pop(); } +word COS_pop() { return pop(); } /* push word to SP */ static void push(word x) { @@ -236,8 +236,8 @@ void COS_init() memset(blkop, 0, #[ BLKOP_CMD_SZ c]# ); vm.SP = #[ SP_ADDR c]# ; vm.RS = #[ RS_ADDR c]# ; - vm.minSP = #[ SP_ADDR c]# ; - vm.maxRS = #[ RS_ADDR c]# ; + vm.minSP = vm.SP ; + vm.maxRS = vm.RS ; memset(vm.iord, 0, $400); memset(vm.iowr, 0, $400); vm.iowr[ #[ BLK_PORT c]# ] = iowr_blk; @@ -259,6 +259,6 @@ int COS_steps(int n) { void COS_printdbg() { fprintf( - vm.SP, vm.minSP, vm.RS, vm.maxRS - "SP %w (%w) RS %w (%w)", ConsoleOut()); + vm.maxRS, vm.RS, vm.minSP, vm.SP, + "SP %w (%w) RS %w (%w)\n", ConsoleOut()); } diff --git a/fs/app/cos/dummy.bin b/fs/app/cos/dummy.bin @@ -1 +0,0 @@ -; -\ No newline at end of file diff --git a/fs/app/cos/test.fs b/fs/app/cos/test.fs @@ -1,14 +0,0 @@ -f<< /app/cos/cvm.fs -: _err abort" CVM error" ; -: _assert not if _err then ; - -COS_init -vm structbind COSVM vm -vm mem f" /app/cos/dummy.bin" File :readall -." vm mem addr " vm mem .x nl> -vm running _assert -\ The "dummy.bin" file is a test handcrafted binary with the equivalent of: -\ bye - -1 COS_steps not _assert -vm running not _assert diff --git a/fs/tests/all.fs b/fs/tests/all.fs @@ -4,4 +4,5 @@ f<< /tests/lib/all.fs f<< /tests/sys/all.fs f<< /tests/asm/all.fs f<< /tests/cc/all.fs +f<< /tests/app/all.fs S" All tests passed" stype nl> diff --git a/fs/tests/app/all.fs b/fs/tests/app/all.fs @@ -0,0 +1 @@ +f<< /tests/app/cos/all.fs diff --git a/fs/tests/app/cos/all.fs b/fs/tests/app/cos/all.fs @@ -0,0 +1 @@ +f<< /tests/app/cos/cvm.fs diff --git a/fs/tests/app/cos/cvm.fs b/fs/tests/app/cos/cvm.fs @@ -0,0 +1,18 @@ +?f<< /tests/harness.fs +ARCH S" i386" s= [if] ." Skipping COS tests on i386 because it's temporarily broken\n" \s [then] +f<< /app/cos/cvm.fs +testbegin +\ Testing COS CVM + +COS_init +vm structbind COSVM vm +vm mem f" /tests/app/cos/dummy.bin" File :readall +vm running # +\ The "dummy.bin" file is a test handcrafted binary with the equivalent of: +\ 42 bye + +2 COS_steps not # +vm running not # +COS_printdbg +COS_pop 42 #eq +testend diff --git a/fs/tests/app/cos/dummy.bin b/fs/tests/app/cos/dummy.bin Binary files differ. diff --git a/testblkpack.fs b/testblkpack.fs @@ -1,8 +0,0 @@ -?f<< /lib/crc.fs -f<< /app/cos/tools/blkpack.fs --1 to CRC32IO SumIO res -CRC32IO to StdOut -' blkpack S" /app/cos/blk.fs" with-stdin-file -stdio$ -." CRC32: " CRC32IO SumIO res ^ .x nl> -bye diff --git a/testcvm.fs b/testcvm.fs @@ -1,2 +0,0 @@ -f<< /app/cos/test.fs -bye