-
Notifications
You must be signed in to change notification settings - Fork 265
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
sysfs: drops os.File special casing for fs.FS to pass wasi-testsuite (#…
…1174) This adds a wazero adapter which passes wasi-testsuite 100pct on darwin, linux and windows. While the main change was adding inodes to the wasi `fd_readdir` dirents, there was a lot of incidental work needed. Most of the work was troubleshooting in nature, around windows specifically, but also wrapping of files. This backfills a lot of tests and reworked how wrapping works, particularly around windows. To accommodate this, we drop `os.File` special casing except for `sysfs.DirFS` Signed-off-by: Adrian Cole <[email protected]>
- Loading branch information
1 parent
4fd3d9d
commit e77f24f
Showing
33 changed files
with
883 additions
and
368 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
# adapter for wazero until/unless https://github.com/WebAssembly/wasi-testsuite/pull/55 | ||
|
||
import argparse | ||
import subprocess | ||
import sys | ||
import os | ||
import shlex | ||
|
||
# shlex.split() splits according to shell quoting rules | ||
WAZERO = shlex.split(os.getenv("TEST_RUNTIME_EXE", "wazero")) | ||
|
||
parser = argparse.ArgumentParser() | ||
parser.add_argument("--version", action="store_true") | ||
parser.add_argument("--test-file", action="store") | ||
parser.add_argument("--arg", action="append", default=[]) | ||
parser.add_argument("--env", action="append", default=[]) | ||
parser.add_argument("--dir", action="append", default=[]) | ||
|
||
args = parser.parse_args() | ||
|
||
if args.version: | ||
version = subprocess.run( | ||
WAZERO + ["version"], capture_output=True, text=True | ||
).stdout.strip() | ||
if version == "dev": | ||
version = "0.0.0" | ||
print("wazero", version) | ||
sys.exit(0) | ||
|
||
TEST_FILE = args.test_file | ||
TEST_DIR = os.path.dirname(TEST_FILE) | ||
PROG_ARGS = [] | ||
if args.arg: | ||
PROG_ARGS = ["--"] + args.arg | ||
ENV_ARGS = [f"-env={e}" for e in args.env] | ||
cwd = os.getcwd() | ||
DIR_ARGS = [f"-mount={cwd}/{dir}:{dir}" for dir in args.dir] | ||
|
||
PROG = ( | ||
WAZERO | ||
+ ["run", "-hostlogging=filesystem"] | ||
+ ENV_ARGS | ||
+ DIR_ARGS | ||
+ [TEST_FILE] | ||
+ PROG_ARGS | ||
) | ||
sys.exit(subprocess.run(PROG, cwd=TEST_DIR).returncode) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.