Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create Testing.md #1

Open
wants to merge 60 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
60 commits
Select commit Hold shift + click to select a range
7e56336
Added sizes and alignments to WASI docs (#268)
torch2424 May 2, 2020
d6eec86
Add a meeting page for the 05-07 meeting. (#270)
sunfishcode May 5, 2020
68ef365
Add some agenda topics. (#271)
sunfishcode May 7, 2020
b827aa0
Fix links to dirent struct in fd_readdir description (#274)
kubkon May 11, 2020
8d06ed0
Document why there is no path_filestat_set_size (#180)
marmistrz May 13, 2020
2627acd
Fix link to event struct (#275)
kubkon May 13, 2020
8125353
Move $d_namlen to the end of $dirent (#264)
caspervonb May 18, 2020
7408db4
Document atomicity of `write` and `pwrite`, and technical fix about P…
igrep May 18, 2020
de20e79
Add an agenda for the 05-21 meeting. (#277)
sunfishcode May 19, 2020
e910968
Fix: Broken link in DesignPrinciples.md #269 (#278)
igrep May 19, 2020
9a1cb4d
Elaborate on the definitions of commands and reactors. (#282)
sunfishcode May 29, 2020
2ccb606
Add an agenda for the 06-04 meeting. (#286)
sunfishcode Jun 3, 2020
7d1f396
witx: Add trait implementations to `Id` (#287)
Jun 4, 2020
ecda51c
Fix link in phases/README.md (#284)
nasso Jun 8, 2020
4fa4f4a
witx crate: bump dep version, crate version (#291)
Jun 23, 2020
2dc4ed7
Add an agenda for the 07-02 meeting. (#293)
sunfishcode Jul 2, 2020
ceaad06
Improve spelling (#295)
Jul 6, 2020
63fa3d4
Add an agenda for the 07-16 meeting. (#300)
sunfishcode Jul 16, 2020
38d4a62
chore: update links to WebAssembly/threads issues (#301)
rawkode Jul 16, 2020
356b3a8
Add an agenda for the 07-30 meeting. (#305)
sunfishcode Jul 30, 2020
6b34a6f
Fix typo (#308)
abrown Aug 7, 2020
71f0425
latest wast in witx (#311)
Aug 17, 2020
c237580
Add an agenda for the 2020-08-27 meeting. (#314)
sunfishcode Aug 26, 2020
c75c158
Add an agenda for the 2020-09-10 meeting. (#314) (#320)
sunfishcode Sep 10, 2020
429a060
Add an agenda for the 09-24 meeting. (#321)
sunfishcode Sep 21, 2020
77540eb
Add an agenda for the 10-08 meeting. (#324)
sunfishcode Oct 5, 2020
11b37c7
CI: use $GITHUB_PATH rather than add-path
pchickey Oct 5, 2020
63f92d1
Remove reference to non existent modules.md file
andrewdavidmackenzie Sep 5, 2020
60931e0
Add several meeting agenda items.
sunfishcode Oct 7, 2020
a96dfe9
Add an agenda for the 10-22 meeting.
sunfishcode Oct 9, 2020
4a562db
Update WASI-10-22.md
abrown Oct 9, 2020
a206794
Fix typo in open param name
vapier Oct 11, 2020
b453eca
Fix links for existing proposals
abrown Oct 8, 2020
ca5701b
Add wasi-nn proposal
abrown Oct 8, 2020
a7927c1
Alphabetize proposal links
abrown Oct 8, 2020
a5b12ef
Add proposal link to main page; re-organize content
abrown Oct 8, 2020
a558a2f
Add proposal to cover WASI Logo in next WASI meeting (#337)
syrusakbary Oct 21, 2020
acbbc81
Add note about myself hosting this meeting
sbc100 Oct 21, 2020
791d649
Add an agenda item for a presentation on character encodings. (#339)
sunfishcode Oct 21, 2020
7baa0e5
Move wasi-nn to phase 2 (#343)
abrown Oct 22, 2020
bfb68a8
add action items (#342)
sbc100 Oct 22, 2020
ea16476
Add 10-22 meeting notes (#344)
sbc100 Oct 23, 2020
6e65cec
Update WASI-10-22.md (#345)
syrusakbary Oct 23, 2020
5db774e
Create documentation landing page
abrown Oct 26, 2020
ab547c8
Add an agenda for the 11-05 meeting.
sunfishcode Oct 30, 2020
96c8f8a
Add an agenda for the 11-19 meeting.
sunfishcode Nov 18, 2020
84f332a
Updated module-types links to module-linking links (#330)
MendyBerger Nov 22, 2020
8b0c829
Add 11-19 meeting notes (#354)
linclark Nov 24, 2020
52cb4fe
Add an agenda for the 12-03 meeting. (#355)
linclark Nov 24, 2020
fa7c8f5
witx: remove supertypes from the handle type (#358)
Nov 30, 2020
4cd609b
Add agenda items for 12-03 meeting (#361)
linclark Dec 3, 2020
4dfe8ed
Add 12-03 meeting notes (#362)
linclark Dec 4, 2020
f8f40fa
Add 12-17 meeting agenda (#363)
linclark Dec 4, 2020
7256722
Fix time typos in 12-17 meeting agenda
linclark Dec 8, 2020
f2c83ea
Add DOI link to README
linclark Dec 15, 2020
cbfa8b3
Cancel 12-17 meeting and add agendas for 01-14 and 01-28. (#367)
linclark Dec 16, 2020
8deb71d
Add the `(@witx noreturn)` annotation to proc_exit (#371)
Jan 6, 2021
a333ebe
Reorganize the directory structure to better support proposals.
sunfishcode Dec 10, 2020
ab893a3
Remove `repos`.
sunfishcode Jan 13, 2021
99ebb2a
Create Testing.md
caspervonb Jan 14, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
- name: Install Rust (macos)
run: |
curl https://sh.rustup.rs | sh -s -- -y
echo "##[add-path]$HOME/.cargo/bin"
echo "$HOME/.cargo/bin" >> $GITHUB_PATH
if: matrix.os == 'macos-latest'
- run: cargo fetch
working-directory: tools/witx
Expand Down
4 changes: 2 additions & 2 deletions Charter.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ the sections of the [CG charter](https://webassembly.github.io/cg-charter/) rela

## Goals

The mission of this sugbroup is to provide a forum for pre-standardization
The mission of this subgroup is to provide a forum for pre-standardization
collaboration on a system interface API for WebAssembly programs.

## Scope
Expand All @@ -21,7 +21,7 @@ The Subgroup will consider topics related to system interface APIs, including:
- APIs for host filesystems, network stacks, and other resources.
- APIs for graphics, audio, input devices
- APIs for encryption, format conversion, and other transformations
(particularly where hardware accelleration may be available on some platforms)
(particularly where hardware acceleration may be available on some platforms)


## Deliverables
Expand Down
32 changes: 16 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.4323447.svg)](https://doi.org/10.5281/zenodo.4323447)

# WebAssembly System Interface

![WASI](WASI.png)

This repository is for the WebAssembly System Interface (WASI) Subgroup of the
[WebAssembly Community Group]. Its [Charter] describes the goals, scope and
deliverables of the group. The repository may contain meeting notes, reports,
documentation, specifications and/or software produced by the group (although
larger projects may also have their own repositories).
[WebAssembly Community Group]. It includes:
- [charter]: describes the goals, scope and deliverables of the group
- [docs]: learn more about WASI
- [meetings]: schedules and agendas for video conference and in-person meetings
- [phases]: the current WASI specifications
- [proposals]: the status of each new specification proposal

[charter]: Charter.md
[docs]: docs/README.md
[meetings]: meetings/README.md
[phases]: phases/README.md
[proposals]: docs/Proposals.md
[WebAssembly Community Group]: https://www.w3.org/community/webassembly/
[Charter]: Charter.md

We'll be adding more content here before long, but for now, check out these:
- https://hacks.mozilla.org/2019/03/standardizing-wasi-a-webassembly-system-interface/ - Blog post introducing WASI
- https://wasi.dev/ - Links to more information about WASI, including
how to get started using it.
- https://github.com/WebAssembly/WASI/issues - This repo's issue tracker
### Contributing

The issue tracker is the place to ask questions, make suggestions, and start
discussions.
The [issue tracker] is the place to ask questions, make suggestions, and start discussions.

Schedules and agendas for video conference and in-person meetings are posted
[here](meetings/README.md).

API specification proposals are [here](phases/README.md).
[issue tracker]: https://github.com/WebAssembly/WASI/issues
40 changes: 27 additions & 13 deletions design/application-abi.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
WASI Application ABI
====================

In addition to the APIs defined by the various WASI [modules](modules.md) there
In addition to the APIs defined by the various WASI modules there
are also certain expectations that the WASI runtime places on an application
that wishes to be portable across WASI implementations.

Expand All @@ -15,26 +15,40 @@ Current Unstable ABI
There are two kinds of modules:

- A *command* exports a function named `_start`, with no arguments and no return
values. Environments shall call this function once, after instantiating the
module and all of its dependencies. After this function exits, the instance
is considered terminated and no further use of any of its exports should be
permitted.
values.

- A *reactor* exports a function named `_initialize`, with no arguments and no
return values. Environments shall call this function once, after instantiating
the module and all of its dependencies. After this function exits, the instance
remains live, and its exports may be accessed.
Command instances may assume that they will be called from the environment
at most once. Command instances may assume that none of their exports are
accessed outside the duraction of that call.

- All other modules are *reactors*. A reactor may export a function named
`_initialize`, with no arguments and no return values.

If an `_initialize` export is present, reactor instances may assume that it
will be called by the environment at most once, and that none of their
other exports are accessed before that call.

After being instantiated, and after any `_initialize` function is called,
a reactor instance remains live, and its exports may be accessed.

These kinds are mutually exclusive; implementations should report an error if
asked to instantiate a module containing exports which declare it to be of
multiple kinds.

Regardless of the kind, all programs accessing WASI APIs also export a linear
memory with the name `memory`. Pointers in WASI API calls are relative to this
memory's index space.
Regardless of the kind, all modules accessing WASI APIs also export a linear
memory with the name `memory`. Data pointers in WASI API calls are relative to
this memory's index space.

Regardless of the kind, all modules accessing WASI APIs also export a table
with the name `__indirect_function_table`. Function pointers in WASI API calls
are relative to this table's index space.

Environments shall not access exports named `__heap_base` or `__data_end`.
Toolchains are encouraged to avoid providing these exports.

In the future, as the underlying WebAssembly platform offers more features, we
we hope to eliminate the requirement to export all of linear memory.
we hope to eliminate the requirement to export all of linear memory or all of
the indirect function table.

Planned Stable ABI
------------------
Expand Down
8 changes: 4 additions & 4 deletions docs/DesignPrinciples.md
Original file line number Diff line number Diff line change
Expand Up @@ -228,8 +228,8 @@ aligning with them so that we'll be ready when they are.
As another example, WASI's
[witx](https://github.com/WebAssembly/WASI/blob/master/docs/witx.md)
file format is designed to be a
straightforward superset of the [module type
proposal](https://github.com/WebAssembly/module-types/blob/master/proposals/module-types/Overview.md)'s
straightforward superset of the [module linking
proposal](https://github.com/WebAssembly/module-linking/blob/master/proposals/module-linking/Explainer.md)'s
.wit format and the [annotations
proposal](https://github.com/WebAssembly/annotations/)'s annotation
syntax.
Expand All @@ -243,8 +243,8 @@ transparently. This can be used to adapt or attenuate the functionality
of a WASI API without changing the code using it.

In WASI, we envision interposition will primarily be configured
through the mechanisms in the interface types' [linking
proposal](https://github.com/WebAssembly/interface-types/blob/linking/proposals/interface-types/linking/Explainer.md).
through the mechanisms in the module linking' [link-time virtualization
](https://github.com/WebAssembly/module-linking/blob/master/proposals/module-linking/Explainer.md#link-time-virtualization).
Imports are resolved when a module is instantiated, which may happen
during the runtime of a larger logical application, so we can support
interposition of WASI APIs without defining them in terms of explicit
Expand Down
18 changes: 10 additions & 8 deletions docs/Proposals.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ Proposals follow [this process document](https://github.com/WebAssembly/WASI/blo
| [Clocks][wasi-clocks] | Dan Gohman |
| [Random][wasi-random] | Dan Gohman |
| [Misc][wasi-misc] | Dan Gohman |
| [Machine Learning (wasi-nn)][wasi-nn] | Andrew Brown and Mingqiu Sun |

### Phase 1 - Feature Proposal (CG)

Expand All @@ -49,11 +50,12 @@ Proposals follow [this process document](https://github.com/WebAssembly/WASI/blo

Please see [Contributing to WebAssembly](https://github.com/WebAssembly/WASI/blob/master/Contributing.md) for the most up-to-date information on contributing proposals to standard.

[wasi-io]: https://github.com/WebAssembly/WASI/phases
[filesystem]: https://github.com/WebAssembly/WASI/phases
[wasi-command-line]: https://github.com/WebAssembly/WASI/phases
[clocks]: https://github.com/WebAssembly/WASI/phases
[random]: https://github.com/WebAssembly/WASI/phases
[misc]: https://github.com/WebAssembly/WASI/phases
[wasi-crypto]: https://github.com/WebAssembly/WASI-crypto
[wasi-proxy-wasm]: https://github.com/WebAssembly/WASI
[wasi-clocks]: https://github.com/WebAssembly/wasi-clocks
[wasi-command-line]: https://github.com/WebAssembly/wasi-classic-command
[wasi-crypto]: https://github.com/WebAssembly/wasi-crypto
[wasi-filesystem]: https://github.com/WebAssembly/wasi-filesystem
[wasi-io]: https://github.com/WebAssembly/wasi-io
[wasi-misc]: https://github.com/WebAssembly/wasi-misc
[wasi-nn]: https://github.com/WebAssembly/wasi-nn
[wasi-proxy-wasm]: https://github.com/proxy-wasm/spec
[wasi-random]: https://github.com/WebAssembly/wasi-random
15 changes: 15 additions & 0 deletions docs/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Documentation

WASI documentation includes:
- [Overview](WASI-overview.md): provides an introduction to WASI and its history
- [Goals](HighLevelGoals.md): a succinct list of WASI's design goals
- [Design Principles](DesignPrinciples.md): discusses details on the principles of capability-based security, scope,
POSIX/Web, etc.
- [WITX](witx.md): an introduction to the WITX specification language
- [Process](Process.md): describes how to move a WASI proposal in to the specification
- [Proposals](Proposals.md): lists the current WASI proposals by phase

Additionally, here are some links that may be helpful in understanding WASI:
- The blog post introducing WASI: [Standardizing WASI: A system interface to run WebAssembly outside the web](https://hacks.mozilla.org/2019/03/standardizing-wasi-a-webassembly-system-interface/)
- The [wasi.dev](https://wasi.dev) web site includes links to more information about WASI, including how to get started using it
- This repository's [issue tracker](https://github.com/WebAssembly/WASI/issues)
88 changes: 88 additions & 0 deletions docs/Testing.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
# Testing

A test case takes the form of a binary \<basename\>.wasm file, next to that that there will always be a \<basename\>.\<ext\> source file from which the test was originally compiled from which can be used as a reference in the event of an error.

Additionally, any of the following optional auxilary files and directories may be present:

- \<basename\>.arg
- \<basename\>.env
- \<basename\>.dir
- \<basename\>.stdin
- \<basename\>.stdout
- \<basename\>.stderr
- \<basename\>.status

## Running tests

```bash
# Usage: $1 <runtime> <path_to_binary.wasm>
# $1 wasmtime proc_exit-success.wasm
# $1 wasmer proc_exit-failure.wasm
#!/usr/bin/env bash

runtime=$1
input=$2

prefix=${input%.*}
if [ -e "$prefix.stdin" ]; then
stdin="$prefix.stdin"
else
stdin="/dev/null"
fi

output="$(mktemp -d)"
stdout_actual="$output/stdout"
stderr_actual="$output/stderr"
status_actual="$output/status"

if [ -e "$prefix.arg" ]; then
arg=$(cat "$prefix.env")
else
arg=""
fi

if [ -e "$prefix.env" ]; then
env=$(sed -e 's/^/--env /' < "$prefix.env")
else
env=""
fi

if [ -e "$prefix.dir" ]; then
dir="--dir $prefix.dir"
else
dir=""
fi

status=0

"$runtime" $dir $input -- $arg \
< "$stdin" \
> "$stdout_actual" \
2> "$stderr_actual" \
|| status=$?

echo $status > "$status_actual"

stdout_expected="$prefix.stdout"
if [ -e "$stdout_expected" ]; then
diff -u "$stderr_expected" "$stderr_actual"
fi

stderr_expected="$prefix.stderr"
if [ -e "$stderr_expected" ]; then
diff -u "$stdout_expected" "$stdout_actual"
fi

status_expected="$prefix.status"
if [ -e "$prefix.status" ]; then
diff -u "$status_expected" "$status_actual"
elif [ ! "$status" -eq "0" ]; then
cat $stderr_actual
exit 1
fi
```

## Writing tests

- Use the following naming convention of \<system_call\>[-\<variant\>].<ext>.
- Scope tests to the smallest unit possible.
4 changes: 2 additions & 2 deletions docs/witx.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Know your `witx`

The `witx` file format is an experimental format which is based on the
[module types] text format (`wit`), (which is in turn based on the
[module linking] text format (`wit`), (which is in turn based on the
[wat format], which is based on [S-expressions]). It adds some features
using the same syntax as [interface types], some features with syntax
similar to [gc types], as well as a few special features of its own.
Expand All @@ -22,7 +22,7 @@ the goals here are to remain aligned with interface types and other relevant
WebAssembly standards and proposals wherever practical, and to be an input
into the design process of interface types.

[module types]: https://github.com/WebAssembly/module-types/blob/master/proposals/module-types/Overview.md
[module linking]: https://github.com/WebAssembly/module-linking/blob/master/proposals/module-linking/Explainer.md
[interface types]: https://github.com/WebAssembly/interface-types/blob/master/proposals/interface-types/Explainer.md
[gc types]: https://github.com/WebAssembly/gc
[wat format]: https://webassembly.github.io/spec/core/bikeshed/index.html#text-format%E2%91%A0
Expand Down
48 changes: 48 additions & 0 deletions meetings/2020/WASI-04-09.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,51 @@ Installation is required, see the calendar invite.
1. Discussion: Next steps.

## Meeting Notes

Agenda: https://github.com/WebAssembly/WASI/blob/master/meetings/2020/WASI-04-09.md

Attendees:

Dan Gohman
Lee Campbell
Yury Delendik
Jacob Mischka
Andrew Brown
Mark McCaskey
Matthew Fisher
Radu Matei
Piotr Sikora
Pat Hickey
Benjamin Brittain
Johnnie Birch

Meeting notes:
Moving to a CG-style phases process: https://github.com/WebAssembly/WASI/pull/252
LC: What should be the expectations for wasi-sdk and/or other toolchains when a feature is stabilized?
DG: witx support will help wasi-sdk, Rust, and others adopt to new APIs
PH: witx is written in Rust, we’re happy for people to implement it in other languages as well. Currently it just emits markdown docs. Wasi-libc has a C header generator.
LC: witx becomes the ABI standard, “bytes on the wire”. Clients may have higher-level abstractions. The ABI is where the stability is. Applications may link against different versions of higher-level abstraction layers, but as long as the ABI layer is stable they can run on ABI-conforming implementations.


Proxy-wasm
Vote: approve for Phase 1 (see previous item)?
Result - approved, unanimous

Discussion: Next steps.
Piotr to split out pieces of the spec which can be considered independently.

Discussion: Threads in APIs
https://github.com/WebAssembly/threads/issues/138
LC: It’d be nice to start thinking about thread safety and which APIs are thread-safe.
BB: Function signatures are typically not sufficient to know if something is thread-safe.
LW: The “is shared” predicate needs to be propagated through APIs. Everything is unshared by default. We need a shared attribute for tables, etc., and we’d need to have the shared attribute on functions to make them shared.
Without the shared attribute, functions can only be called from one thread.
The shared attribute for functions would need to be added in the core wasm spec, and then witx, being based on core wasm, would inherit it.
LW: Part of adding threading support sufficient for WASI would require adding a thread-local storage mechanism.

Discussion: mmap
LC: What is the short-term plan for mmap?
DG: On the web, mmap is complicated by web compat. But WASI can pursue this.
LW: FWIW, https://github.com/WebAssembly/design/blob/master/FutureFeatures.md#finer-grained-control-over-memory is a long-standing thing we’ve said we’ve wanted in the wasm CG, but maybe it’s better solved by WASI

LW: I can put together a proposal for a platform-independent mmap interface.
Loading