Commit Graph

11 Commits

Author SHA1 Message Date
Crypt Keeper
ec6a054119 gojs: implements umask (#1230)
This implements host-side umask for gojs, which allows
`os.TestMkdirStickyUmask` to pass.

Signed-off-by: Adrian Cole <adrian@tetrate.io>
2023-03-14 08:01:50 +08:00
Crypt Keeper
6243091dc2 renames exit log scope to proc and resolves gojs files to cwd (#1223)
Many tests failed in gojs due to needing to be resolved against the CWD,
which is atypically stored host side. This fixes that and renames the
"exit" scope to "proc" so we can use it for other proc concerns besides
exit.

This reduces known failures on GOOS=js from 23 to 14:
```bash
$ wazero run -mount=/usr/local/go/src/os:/:ro -mount=/tmp:/tmp -mount=/etc:/etc:ro -mount=/usr:/usr:ro -mount=/dev:/dev:ro os.wasm |grep '^--- FAIL'|wc -l
      14
```

See #1222

Signed-off-by: Adrian Cole <adrian@tetrate.io>
2023-03-13 11:41:19 +08:00
Crypt Keeper
d944c3c70d logging: adds clock scope (#1071)
Signed-off-by: Adrian Cole <adrian@tetrate.io>
2023-01-28 19:11:37 +02:00
Edoardo Vacchi
599c097603 Add -hostlogging=crypto (#1064)
This allows you to specify multiple logging scopes, both in API and the CLI.

e.g for the CLI.
```bash
$ wazero run --hostlogging=crypto --hostlogging=filesystem --mount=.:/:ro cat.wasm
```

e.g. for Go
```go
loggingCtx := context.WithValue(testCtx, experimental.FunctionListenerFactoryKey{},
	logging.NewHostLoggingListenerFactory(&log, logging.LogScopeCrypto|logging.LogScopeFilesystem))
```

Signed-off-by: Edoardo Vacchi <evacchi@users.noreply.github.com>
Signed-off-by: Adrian Cole <adrian@tetrate.io>
Co-authored-by: Adrian Cole <adrian@tetrate.io>
2023-01-28 12:51:44 +02:00
Crypt Keeper
65c7d9dd1b gojs: stubs all remaining filesystem calls to ENOSYS (#1001)
This stubs all remaining syscalls for `GOARCH=wasm GOOS=js` to return
ENOSYS, instead of panic'ing. This allows us to see the parameters it
receives.

For example:
```
==> go.syscall/js.valueCall(fs.truncate(path=/tmp/_Go_TestTruncate135754730,length=0))
<== (err=function not implemented,ok=false)
```

Signed-off-by: Adrian Cole <adrian@tetrate.io>
2023-01-03 15:54:29 +08:00
Crypt Keeper
94491fef0b Implements rename in GOOS=js and WASI (#991)
This implements rename, which is the last function needed to pass TinyGo
os package tests:

Signed-off-by: Adrian Cole <adrian@tetrate.io>
2022-12-31 16:37:28 +08:00
Crypt Keeper
efc72de1e6 gojs: implements timeout events (#984)
Signed-off-by: Adrian Cole <adrian@tetrate.io>
2022-12-31 08:26:32 +08:00
Crypt Keeper
9a4a372642 renames writefs to syscallfs and implements utimes in gojs (#979)
This renames the internal writefs package to syscallfs as it is largely
dependent on syscall signatures. This also implements utimes in gojs.
WASI will be a follow-up change as it requires more infrastructure.
Notably, we also need non-TinyGo tests because TinyGo doesn't yet
support os.Chtimes or corresponding syscalls.

Signed-off-by: Adrian Cole <adrian@tetrate.io>
2022-12-30 14:18:06 +08:00
Crypt Keeper
15dc3d7d37 Adds experimental write support and implements on gojs (#970)
This adds writefs.FS, allowing functions to create and delete files.
This begins by implementing them on `GOARCH=js GOOS=wasm`. The current
status is a lot farther than before, even if completing write on WASI is
left for a later PR (possibly by another volunteer).

Signed-off-by: Adrian Cole <adrian@tetrate.io>
2022-12-28 19:49:46 +08:00
Crypt Keeper
921df7e7a6 cli: adds -hostlogging=filesystem for diagnosing problems (#966)
Signed-off-by: Adrian Cole <adrian@tetrate.io>
2022-12-28 11:38:24 +08:00
Crypt Keeper
5751bd758c gojs: extracts parameter names into a pseudo name section (#963)
`GOARCH=wasm GOOS=js` defines parameter names in go source, and they are
indirectly related to the wasm parameter "sp". This creates a pseudo
name section so that we can access the parameter names. The alternative
would be adding a hack to normal FunctionDefinition, only used for gojs.

Signed-off-by: Adrian Cole <adrian@tetrate.io>
2022-12-27 14:09:20 +08:00