Commit graph

49 commits

Author SHA1 Message Date
Fabian d4831d3b10 Remove some unncessary quoting 2022-08-02 21:40:57 +09:00
Nitin Tejuja 0615be5d60
Fixed issue #632 async/await (#633)
Co-authored-by: Fabian <copy@copy.sh>
2022-07-25 14:55:07 +02:00
Fabian ea50e29e5f Remove dead & improve 2020-12-31 19:14:29 -06:00
Fabian d5c9b29942 Upgrade jshint 2020-12-31 19:14:29 -06: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
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 5b95165de2 Add TEST_RELEASE_BUILD to run tests on release build 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 d2f86799e9 Simplify load_from_json: Accept json object directly, don't run asynchronously 2020-08-30 19:37:14 -05:00
Fabian 028e131ddb Rename OnJSONLoaded & small refactor 2020-08-30 19:37:14 -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
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 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
Ernest Wong a538ba9960 Fix 9p caps test and add tests for xattr 2020-08-30 19:29:53 -05:00
Ernest Wong 5ec59fa019 Increase 9p tests' timeouts 2020-08-30 19:29:51 -05:00
Fabian e0d3ebd6bc Test for atime of new files 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
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