Commit graph

526 commits

Author SHA1 Message Date
Fabian 70e637b31b Integration test: Check serial text 2020-12-31 19:14:29 -06:00
Fabian 7d48636dda Integration tests: Use debug bios 2020-12-31 19:14:29 -06:00
Fabian e2eecc7295 task_switch_test*_jit: assert that jit agrees 2020-12-31 19:14:29 -06:00
Fabian 492a2cf78e Update previous_ip only if page fault is going to happen 2020-12-31 19:14:29 -06:00
Fabian c47b4b252c Optimise cr0 access in task_switch_test (only low byte needed) 2020-12-31 19:14:29 -06:00
Fabian 7f41e6fe48 Test for mov [mem], sreg 2020-12-31 19:14:29 -06:00
Fabian c5cd93678e Pass local to gen_safe_read, add single function for modrm_resolve and gen_safe_read (preparation for later optimisations) 2020-12-31 19:14:29 -06:00
Fabian aad8072aa7 Optimise push reg 2020-12-31 19:14:28 -06:00
Fabian 43fcdf9fc2 Introduce LocalOrImmediate for more efficient parameter passing to cmp/test instructions 2020-12-31 19:14:28 -06:00
Fabian bc3c73a607 wasm state machine: Fallthrough 2020-12-31 19:14:28 -06:00
Fabian 63afa77167 Global pointers: Align general purpose registers, sse registers and flags 2020-12-31 19:14:28 -06:00
Fabian 6e005a2058 Integration test: Mark Windows 3 as slow test, print diff output in qemu tests 2020-12-31 19:14:28 -06:00
Fabian 5f31a8aba2 Update expect tests for flags and arithmetic code generation (last two commits) 2020-12-31 19:14:28 -06:00
Fabian b5a72061fb Custom codegen for absolute jmp/call (FF_2/FF_4) 2020-12-31 19:14:28 -06:00
github-jane-doe 15ff296628
Typos (#371)
Fix typos
2020-10-04 19:46:41 +02:00
Fabian aadaf13854 Update expect tests 2020-08-30 19:37:15 -05:00
Fabian 58292cfbc8 namstests: Handle pagefaults 2020-08-30 19:37:15 -05:00
Fabian 8eae31295d nasmtests: Handle exceptions in forced-jit mode 2020-08-30 19:37:15 -05:00
Fabian 158bb75fec FPU: Implement zero divide fault 2020-08-30 19:37:15 -05:00
Fabian 0269e9cecf Fix fxtract 2020-08-30 19:37:15 -05:00
Fabian 9959e758d5 nasmtests: Fix display of integers 2020-08-30 19:37:15 -05:00
Fabian c2508bc61e Update expect tests 2020-08-30 19:37:15 -05:00
Fabian 0c42ea0d1f Custom code generation for leave (C9) 2020-08-30 19:37:15 -05:00
Fabian 837e6ff362 Custom code generation for ret imm (C2) 2020-08-30 19:37:15 -05:00
Fabian fc954cecea Update libwabt (fix failing decoding of large generated modules) 2020-08-30 19:37:15 -05:00
Ernest Wong 644d2cfca8 Filestorage tests: Improve mock transaction lifetimes
- Assert that transaction operations are done within their callback
scopes.
- Improve test performance by using setImmediate for queueing macrotasks
instead of using setTimeout.
- Check for in-progress callbacks before completing transactions.

Note that promise callbacks are run as microtasks. When request
onsuccess callbacks are run, the transaction becomes active again and allows
further requests to be placed against that transaction. The transaction
becomes inactive when the program reaches the end of the event loop
iteration. However, all microtasks are exhausted before the event loop
iteration ends, so the transaction remains active even within the promise
callbacks.
2020-08-30 19:37:15 -05:00
Ernest Wong 22412f3815 Filestorage tests: Test non-existent files 2020-08-30 19:37:15 -05:00
Ernest Wong 1d41054001 style(Filestorage tests): Move openning braces to new lines 2020-08-30 19:37:15 -05:00
Ernest Wong 79928bae4d Filestorage tests: Mock transaction.abort and store.count 2020-08-30 19:37:15 -05:00
Ernest Wong 5a085f32e3 Filestorage tests: Check for unexpected early exits 2020-08-30 19:37:15 -05:00
Fabian 958fb7b9d6 Update expect tests 2020-08-30 19:37:15 -05:00
Fabian 29395181d2 Update expect test results 2020-08-30 19:37:15 -05:00
Fabian 05296b0586 Enable fpu instructions in nasm tests 2020-08-30 19:37:15 -05:00
Ernest Wong 9e82dde504 Filestorage tests: Mock idb transaction.oncomplete 2020-08-30 19:37:15 -05:00
Ernest Wong 27b365b30a Filestorage tests: Set failure exit code 2020-08-30 19:37:15 -05:00
Fabian 9e13650c19 fixup expect tests 2020-08-30 19:37:15 -05:00
Fabian 5b95165de2 Add TEST_RELEASE_BUILD to run tests on release build 2020-08-30 19:37:15 -05:00
Fabian 52b6e0caae Normalise memory offset in output wast in expect tests 2020-08-30 19:37:15 -05:00
Fabian 3f3446b5dd Update linux-boot benchmark script 2020-08-30 19:37:15 -05:00
Ernest Wong ba8a67f249 Filestorage tests: Avoid globals to improve script readability 2020-08-30 19:37:15 -05:00
Ernest Wong c928964562 Minor: Tidy quotes and spacing 2020-08-30 19:37:15 -05:00
Ernest Wong c273741405 Add tests for file storage chunking 2020-08-30 19:37:15 -05:00
Ernest Wong dfb47f5907 Filesystem Tests: Add stopping-on-first-failure option 2020-08-30 19:37:15 -05:00
Fabian 639ec0019b Commit a temporary workaround 2020-08-30 19:37:15 -05:00
Fabian ff3945bab4 Don't skip Linux 4 bzImage test 2020-08-30 19:37:15 -05:00
Fabian 7a31922078 Add test for bzimage_initrd_from_filesystem 2020-08-30 19:37:15 -05:00
Fabian 92346f51ed Add test for clean shutdown 2020-08-30 19:37:15 -05:00
Fabian d2f86799e9 Simplify load_from_json: Accept json object directly, don't run asynchronously 2020-08-30 19:37:14 -05:00
Fabian 99a7bdd6e3 Fix error message when libv86-debug.js hasn't been built 2020-08-30 19:37:14 -05:00
Fabian ae4733a25e Integration test: Boot from bzimage 2020-08-30 19:37:14 -05:00
Fabian 028e131ddb Rename OnJSONLoaded & small refactor 2020-08-30 19:37:14 -05:00
Fabian 23a2ac9c44 Default to synchronous execution for nasm tests 2020-08-30 19:37:14 -05:00
Fabian 148be53525 Try fixing nasmtests hang for gdb 8.2 2020-08-30 19:37:14 -05:00
Fabian b83ed1b7c1 Minor 2020-08-30 19:29:54 -05:00
Fabian 0798a0b40e Don't create unnecessary entry points
This commit prevents creation of entry points for jumps within the same
page. In interpreted mode, execution is continued on these kinds of
jumps.

Since this prevents the old hotness detection from working efficiently,
hotness detection has also been changed to work based on instruction
counters, and is such more precise (longer basic blocks are compiled
earlier).

This also breaks the old detection loop safety mechanism and causes
Linux to sometimes loop forever on "calibrating delay loop", so
JIT_ALWAYS_USE_LOOP_SAFETY has been set to 1.
2020-08-30 19:29:54 -05:00
Fabian fc35ea3ee2 Add emms after code that uses mmx registers before code that uses fpu registers 2020-08-30 19:29:54 -05:00
Fabian fd1f8e1108 Test more edge cases for sse shifts 2020-08-30 19:29:54 -05:00
Fabian 76cc19dee4 Tests for sse shifts with 64 bit shift operand 2020-08-30 19:29:54 -05:00
Ernest Wong a23b4f969e Filesystem tests: Also use non-blocking flock -n 2020-08-30 19:29:54 -05:00
Ernest Wong 401b814f93 Filesystem: Store infinite lock lengths
Having both lock.length and lock.get_length() giving different values is
confusing.
2020-08-30 19:29:54 -05:00
Ernest Wong f7ee28d8ca Filesystem tests: Replace nlinks script with function
Simplifies the code, as well as to experiment to see why there are
processes being killed during only the hard links test and only on CI.
2020-08-30 19:29:54 -05:00
Ernest Wong 400ed64d54 Filesystem: Add tests for byte-range file locks 2020-08-30 19:29:54 -05:00
Ernest Wong e14ef4b8a9 Filesystem: Add tests for whole-file locks. 2020-08-30 19:29:54 -05:00
Fabian b70a5c081a Allow fast path for memory reads from pages that contain code 2020-08-30 19:29:54 -05:00
Ernest Wong 3773f0bfdf Filesystem tests: Increase memory size to 64MiB
OOM Killer was killing the processes.
2020-08-30 19:29:54 -05:00
Ernest Wong e5a689ac2d Filesystem: Expand tests for hard links
Verify multiple hardlinks and verify nlinks counter.
2020-08-30 19:29:54 -05:00
Ernest Wong c7dda46de1 Filesystem: Disallow hardlinks across filesystems
Although hardlinks across filesystems worked quite well in the current
implementation, we will run into problems when we try to implement
different backends for each sub-filesystem.

Note: EPERM is used instead of EXDEV since the mv command will silently
try to use copy-and-unlink when rename(2) fails with EXDEV.

The rules for linking has been reverted back:
 - Before commit: Any inode, including forwarders, could be linked as
long as the parent is not a forwarder and is a directory.
 - After commit: Only non-forwarders and root-forwarders are allowed to
be linked, and must be linked under a directory and not a forwarder.
2020-08-30 19:29:54 -05:00
Ernest Wong 00b9ad683a Filesystem tests: don't rely on inode.name 2020-08-30 19:29:54 -05:00
Ernest Wong d368ccf617 Add more tests for filesystem hardlinks 2020-08-30 19:29:54 -05:00
Fabian 295985e8e0 Remove code section: Only a single buffer is used for generating code 2020-08-30 19:29:54 -05:00
Fabian 1a3c491647 More tests for rep {movs,stos}{b,d} 2020-08-30 19:29:54 -05:00
Fabian 920d150c8b qemu: Enable all sse2 tests, add tests for approximate operations 2020-08-30 19:29:54 -05:00
Fabian 0a9c2bf6e2 qemu tests: init fpu before fxsave as fpu state contains undefined values from previous operations 2020-08-30 19:29:54 -05:00
Fabian 12eb838939 Expect tests: Catch libwabt errors and try to help 2020-08-30 19:29:54 -05:00
Fabian 3b1063d58a Expect tests: Accept TEST_NAME env variable 2020-08-30 19:29:54 -05:00
Fabian 3706bcac12 Use jit for read-modify-write arithmetic instructions 2020-08-30 19:29:54 -05:00
Fabian ca36680d52 PAGE_FAULT is u8 2020-08-30 19:29:54 -05:00
Fabian d4d7d236d5 Make all instructions non-faulting; handle faulting case in gen_safe_{read,write} (#44) 2020-08-30 19:29:54 -05:00
Fabian d67b91b895 Update expect tests 2020-08-30 19:29:53 -05:00
Fabian 1faf8ccc86 Allocate memory via Rust instead of ahead-of-time 2020-08-30 19:29:53 -05:00
Awal Garg 26fc44a61f simplify push16,32 2020-08-30 19:29:53 -05:00
Awal Garg bfc04b80fb jit E8 2020-08-30 19:29:53 -05:00
Awal Garg 73cbea7d0f call gen_pop{16,32} instead of using interpreted variants, update expect
tests
2020-08-30 19:29:53 -05:00
Fabian 28ac891dc3 Filesystem: Load files via their sha256 2020-08-30 19:29:53 -05:00
Ernest Wong 4a76c66ff3 Improve tests for fs.Rename across mounts
- Test both file and directory.
- Test combinations of forwarder/non-forwarder source/destinations
- Test different destination filenames
- Test empty file

Can't test early failure behaviour when destination can't be unlinked,
since right now only non-empty directories and root directories can't be
unlinked and busybox's mv program does not support mv
--no-target-directory.
2020-08-30 19:29:53 -05:00
Ernest Wong 0a4b6c8388 Add fs test for using .. across filesystems 2020-08-30 19:29:53 -05:00
Ernest Wong e683e812fd Mount only onto non-existent paths, existent parent
If mountpoint already exists, then we're silently making its children
inaccessible which may not be what we expected/intended.

Create a new forwarder inode upon mounting.
2020-08-30 19:29:53 -05:00
Ernest Wong 89592e8283 Use fs.RecursiveDelete before each fs test
Don't need to involve the guest os to delete everything.
2020-08-30 19:29:53 -05:00
Ernest Wong 1c6e5f2a51 Add failing tests for fs.SearchPath
Bugs in fs.SearchPath is causing problems with fs.Mount.
2020-08-30 19:29:53 -05:00
Ernest Wong 070c38c6a1 Add tests for host-side fs mounting
The testing "framework" code is slowly turning into spaghetti due to the
asynchronous nature of the triggers. Using async functions will help
clarify the program flow if we think we should address this issue.
2020-08-30 19:29:53 -05:00
Ernest Wong fa7ffd6ccc FS tests: include preparation steps in timeout
Stop hangs caused by faults during mounting and file loading
2020-08-30 19:29:53 -05:00
Ernest Wong d96a3373a6 FS tests: add enable-logs switch, simplify basefs option 2020-08-30 19:29:53 -05:00
Fabian 21018b880e Enable a few more sse tests 2020-08-30 19:29:53 -05:00
Fabian 6fa702c8aa Implement {min,max,div}{p,s}{s,d} sse instructions (#57) 2020-08-30 19:29:53 -05:00
Fabian 70ae4b720a Remove use of raising cpu exceptions for trigger_ud 2020-08-30 19:29:53 -05:00
Fabian 7e574dde52 Implement some floating point sse1/sse2 instructions (#57) 2020-08-30 19:29:53 -05:00
Fabian 384b7f3f73 Add more full tests and skip slow tests by default 2020-08-30 19:29:53 -05:00
Awal Garg 9b0fdc5019 Improve locals handling
Issuing of locals should only happen with set_new_local and
tee_new_local now
2020-08-30 19:29:53 -05:00
Awal Garg 7a14a010a8 Improve handling of locals and add tests
- adds alloc_local and free_local
- slightly better wasmgen tests
- caller of gen_safe_write32 is responsible for allocating
  and freeing locals for address and value
- updates expect-tests
2020-08-30 19:29:53 -05:00
Fabian 848b07a628 Skip tests that fail due to qemu bugs 2020-08-30 19:29:53 -05:00
Fabian 7d627ac13a Make tests a bit more robust 2020-08-30 19:29:53 -05:00
Fabian c108aaaadd Extend qemu paging tests with cross-page page faults 2020-08-30 19:29:53 -05:00
Fabian 510c6c186b qemu tests: More sse shift tests 2020-08-30 19:29:53 -05:00
Fabian 9bd1e30439 qemu tests: Re-enable some sse tests and reduce diff between upstream version 2020-08-30 19:29:53 -05:00
Fabian a7c25c423e nasmtests: Add timeout and clarify 2020-08-30 19:29:53 -05:00
Fabian 1ee5895c44 api test: Print error 2020-08-30 19:29:53 -05:00
Fabian f43ab3387a Remove use of cpu exceptions for trigger_gp for instructions 2020-08-30 19:29:53 -05:00
Fabian 4ee7da8f83 Remove use of cpu exceptions for divisions 2020-08-30 19:29:53 -05:00
Ernest Wong a538ba9960 Fix 9p caps test and add tests for xattr 2020-08-30 19:29:53 -05:00
Awal Garg b3e415cf9f jit inline 0xC3 2020-08-30 19:29:53 -05:00
Awal Garg 9224fc3878 jit inline 0xEB 2020-08-30 19:29:53 -05:00
Ernest Wong 5ec59fa019 Increase 9p tests' timeouts 2020-08-30 19:29:51 -05:00
Fabian 766c50b6fb Enable api tests 2020-08-30 19:29:13 -05:00
Fabian e0d3ebd6bc Test for atime of new files 2020-08-30 19:29:13 -05:00
Fabian 5df3b702ab Nasmtests: Fix gdb execution on docker 2020-08-30 19:29:13 -05:00
Fabian b74869dc67 Don't initialise loop counter when it's not used 2020-08-30 19:29:13 -05:00
Fabian 1253b72906 Generate prefix handling for string instructions 2020-08-30 19:29:13 -05:00
Fabian 3a8d644d75 Port jit to Rust
The following files and functions were ported:
- jit.c
- codegen.c
- _jit functions in instructions*.c and misc_instr.c
- generate_{analyzer,jit}.js (produces Rust code)
- jit_* from cpu.c

And the following data structures:
- hot_code_addresses
- wasm_table_index_free_list
- entry_points
- jit_cache_array
- page_first_jit_cache_entry

Other miscellaneous changes:
- Page is an abstract type
- Addresses, locals and bitflags are unsigned
- Make the number of entry points a growable type
- Avoid use of global state wherever possible
- Delete string packing
- Make CachedStateFlags abstract
- Make AnalysisType product type
- Make BasicBlockType product type
- Restore opcode assertion
- Set opt-level=2 in debug mode (for test performance)
- Delete JIT_ALWAYS instrumentation (now possible via api)
- Refactor generate_analyzer.js
- Refactor generate_jit.js
2020-08-30 19:29:13 -05:00
Ernest Wong 30a72e5874 Filesystem tests: include newlines in capture
- keep empty lines
- handle word wraps
- remove extra space in assert failure logging
2020-08-30 19:29:13 -05:00
Ernest Wong 72a4dc6448 Filesystem tests tidyup and ls --color=never 2020-08-30 19:29:13 -05:00
Ernest Wong 496e63f76e Add walk to filesystem stress test 2020-08-30 19:29:13 -05:00
Ernest Wong 8c6bfdb6da Minor improvements to filesystem tests 2020-08-30 19:29:13 -05:00
Ernest Wong 42d21bde56 Extend 9p tests to cover most file system calls 2020-08-30 19:29:02 -05:00
Fabian 3812cb5489 Update expect tests due to following of call instructions 2020-08-30 19:27:07 -05:00
Fabian 793c68a501 Update expect tests due to optimisation of memory writes 2020-08-30 19:27:07 -05:00
Fabian 8ac1e2a995 Update expect tests due to optimisation of loop iterations 2020-08-30 19:27:07 -05:00
Fabian f8dd22cf04 Expect test: Accept tests interactively (#15) 2020-08-30 19:27:07 -05:00
Fabian c06d141ea6 Run full tests in debug mode 2020-08-30 19:27:07 -05:00
Awal Garg f346fb2c7d increase freedos tests time limit to 20 seconds 2020-08-30 19:27:07 -05:00
Awal Garg 853bf477cc minor fixes 2020-08-30 19:27:07 -05:00
Awal Garg e33cc8f072 rust restructuring, some refactoring 2020-08-30 19:27:07 -05:00
Awal Garg 863c020785 delete codegen test 2020-08-30 19:27:07 -05:00
Awal Garg fc7f4b468c add wasmgen tests to makefile 2020-08-30 19:27:07 -05:00
Fabian 94b0376186 Remove timing profiler 2020-08-30 19:27:07 -05:00
Fabian 0cc47d72d1 nasmtests: Catch general protection error / sigsegv 2020-08-30 19:27:07 -05:00
Fabian c898611196 Regression tests for 8-bit jumps 2020-08-30 19:27:07 -05:00
Fabian c40a5ccf25 nasmtests: Put multiboot section early into binary 2020-08-30 19:27:07 -05:00
Fabian 67af8f55e1 nasmtests: Allow running specific test by name 2020-08-30 19:27:07 -05:00
Fabian f10dd50be6 Full test: Verbose mode 2020-08-30 19:27:07 -05:00
Fabian 2fcbfdaf19 Full test: Add extra time for more stability 2020-08-30 19:27:07 -05:00
Fabian e9eeba2248 Remove deprecated use of new Buffer 2020-08-30 19:27:07 -05:00
Ernest Wong 129269fc14 Add devices test to CI + update tests to linux4 2020-08-30 19:27:07 -05:00
Ernest Wong a75eb60e45 Use linux4 for virtio9p test + tidy up test logic 2020-08-30 19:27:07 -05:00
Ernest Wong 2bb5b194dc Fix virtio 9p tests
I wrongly assumed that libv86 would perform faster than libv86-debug.
Using libv86 caused ttyS0 to timeout before initialising, so there was
not serial terminal to use by the time debian booted.
2020-08-30 19:27:07 -05:00
Ernest Wong fe40ebc0f8 Add tests for virtio 9p (tests are currently incorrect)
These tests do not work yet: it fails to capture the serial output
after root login.

In addition, these tests are currently too slow to run
since it takes a while to boot the debian image (> 16 minutes on my
machine while running the test in the terminal.)

Would need to switch to a newer minimal linux image when available.
2020-08-30 19:27:07 -05:00
Fabian 4764d5b41e Set log level to zero (in case of running in debug mode) 2020-08-30 19:27:07 -05:00
Fabian 4423cf3010 Also test synchronous cdrom state saving/restoring (currently failing) 2020-08-30 19:27:07 -05:00
Fabian 617d962eba qemutests: More rounding tests 2020-08-30 19:27:07 -05:00
Fabian 7ba14bb47e Add debian-bytemark benchmark script 2020-08-30 19:27:07 -05:00
Amaan Cheval 3641bc3b87 codegen: Make SCALE_INDEX_FOR_ARRAY32 more specific and revert
This reverts commit b830fe8d7acb0f83c3c8a0febd7e172927ae2f46 and makes
the macro more specific
2020-08-30 19:27:07 -05:00