Skip to content

Commit

Permalink
test: Update spectests README
Browse files Browse the repository at this point in the history
  • Loading branch information
chfast authored and axic committed Sep 9, 2020
1 parent fb54e5f commit f4557c4
Showing 1 changed file with 20 additions and 15 deletions.
35 changes: 20 additions & 15 deletions test/spectests/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,34 +3,39 @@
## Build and run

Fizzy must be built with the `FIZZY_TESTING` option turned on:
```sh
$ mkdir build && cd build
$ cmake -DFIZZY_TESTING=ON ..
$ cmake --build .
```shell script
mkdir build && cd build
cmake -DFIZZY_TESTING=ON ..
cmake --build .
```

It can then be executed:
```sh
$ bin/fizzy-spectests <test directory>
```

This will execute all test cases, but since Fizzy does not implement the complete validation specification, most of
those cases will fail. It is possible to skip them:
```sh
$ bin/fizzy-spectests --skip-validation <test directory>
```shell script
bin/fizzy-spectests <test directory>
```

## Preparing tests

Fizzy uses the official WebAssembly "[spec tests]", albeit not directly.
It requires the Wast files to be translated into a JSON format using [wabt]'s `wast2json` tool.

The reason for this is a design decision of Fizzy to not support the WebAssembly text format –– and unfortunately
The reason for this is a design decision of Fizzy to not support the WebAssembly text format, and unfortunately
the official test cases are in a text format.

In order to prepare the tests, run the following command for each file:
```sh
$ wast2json <file.wast> -o <file.json>
```shell script
wast2json <file.wast> -o <file.json>
```

Make sure to disable all WebAssembly extensions when using `wast2json`:
```shell script
wast2json --disable-saturating-float-to-int --disable-sign-extension --disable-multi-value
```

To convert all files at once:
```shell script
# Make sure $options here contains the above settings
find test/core -name '*.wast' -exec wast2json $options {} \;
```

For ease of use, we have placed the JSON files of the spec tests [w3c-v1.0 branch] here:
Expand Down

0 comments on commit f4557c4

Please sign in to comment.