Skip to content

Commit

Permalink
In tests, change dune exec for direct binary call
Browse files Browse the repository at this point in the history
Using `dune exec`` means that the dune-project file
needs to be present in the dune sandbox, which
would sometimes not happen and lead to the very
annoying workflow of having to dune clean before
every dune runtest.

I tried adding the dune-project file as a dependency
but couldn't get it to work.

A direct call to the binary seems to solve the issue.
  • Loading branch information
krtab authored and zapashcanon committed Mar 5, 2024
1 parent 57319f3 commit 3c7b1c4
Show file tree
Hide file tree
Showing 61 changed files with 319 additions and 319 deletions.
2 changes: 1 addition & 1 deletion example/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
## Man page

```sh
$ dune exec -- owi --help=plain
$ owi --help=plain
NAME
owi - OCaml WebAssembly Interpreter

Expand Down
8 changes: 4 additions & 4 deletions example/c/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ We are defining one symbolic variable `x` using the function `owi_i32(void)`. Th
Then we use `owi_assert(poly != 0)`. Which should fail as this polynomial has multiple roots. Let's see what owi says about it:

```sh
$ dune exec owi -- c ./poly.c -w1
$ owi c ./poly.c -w1
...
Model:
(model
Expand Down Expand Up @@ -77,7 +77,7 @@ Let's run owi on this new input:


```sh
$ dune exec owi -- c ./poly2.c
$ owi c ./poly2.c
...
Model:
(model
Expand Down Expand Up @@ -172,7 +172,7 @@ int main (void) {
```
```sh
$ dune exec owi -- c ./maze.c
$ owi c ./maze.c
Assert failure: false
Model:
(model
Expand Down Expand Up @@ -211,7 +211,7 @@ Reached problem!
## Man page

```sh
$ dune exec owi -- c --help=plain
$ owi c --help=plain
NAME
owi-c - Compile a C file to Wasm and run the symbolic interpreter on
it
Expand Down
2 changes: 1 addition & 1 deletion example/define_host_function/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ let () =
You'll get the expected result:

```sh
$ dune exec -- ./extern.exe
$ ./extern.exe
42
13
```
Expand Down
4 changes: 2 additions & 2 deletions example/fmt/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ i32.lt_s
Owi will format it like this:

```sh
$ dune exec -- owi fmt horrible.wat
$ owi fmt horrible.wat
(module
(memory 10)
(func $f (param $n i32) (result i32)
Expand Down Expand Up @@ -99,7 +99,7 @@ Are you able to recognize the program now?
## Man page

```sh
$ dune exec owi -- fmt --help=plain
$ owi fmt --help=plain
NAME
owi-fmt - Format a .wat or .wast file

Expand Down
4 changes: 2 additions & 2 deletions example/opt/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,7 @@ Given the useless program `useless.wat`:
Owi is able to get rid of most of the code:

```sh
$ dune exec -- owi opt useless.wat
$ owi opt useless.wat
(module
(func $i32binop

Expand All @@ -364,7 +364,7 @@ $ dune exec -- owi opt useless.wat
## Man page

```sh
$ dune exec owi -- opt --help=plain
$ owi opt --help=plain
NAME
owi-opt - Optimize a module

Expand Down
6 changes: 3 additions & 3 deletions example/run/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@ Given a file `42.wat` with the following content:
Running the interpreter is as simple as:

```sh
$ dune exec owi -- run ./42.wat
$ owi run ./42.wat
```

Nothing is happening, so you can add the `--debug` option to print an execution trace:

```sh
$ dune exec owi -- run ./42.wat --debug
$ owi run ./42.wat --debug
parsing ...
checking ...
grouping ...
Expand All @@ -53,7 +53,7 @@ stack : [ ]
## Man page

```sh
$ dune exec owi -- run --help=plain
$ owi run --help=plain
NAME
owi-run - Run the concrete interpreter

Expand Down
2 changes: 1 addition & 1 deletion example/script/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@ Given the following `print.wast` file:
You can print the value thanks to the `print_i32` function imported from the `spectest` module:

```sh
$ dune exec owi -- script ./print.wast
$ owi script ./print.wast
42
```
4 changes: 2 additions & 2 deletions example/sym/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ In the following file, we define `x` as a symbolic variable. Then if `5 < x`, we
Let's see if owi is able to find a value for `x` that lead to an error:

```sh
$ dune exec owi -- sym ./mini.wat
$ owi sym ./mini.wat
Trap: unreachable
Model:
(model
Expand All @@ -42,7 +42,7 @@ TODO
## Man page

```sh
$ dune exec owi -- sym --help=plain
$ owi sym --help=plain
NAME
owi-sym - Run the symbolic interpreter

Expand Down
6 changes: 3 additions & 3 deletions example/validate/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,15 @@ Given a file `type_error.wat` with the following content:
Running the validator is as simple as:

```sh
$ dune exec owi -- validate ./type_error.wat
$ owi validate ./type_error.wat
type mismatch (pop)
[35]
```

You can also print a more detailed trace with the `--debug` option:

```sh
$ dune exec owi -- validate ./type_error.wat --debug
$ owi validate ./type_error.wat --debug
parsing ...
checking ...
grouping ...
Expand All @@ -43,7 +43,7 @@ type mismatch (pop)
## Man page

```sh
$ dune exec owi -- validate --help=plain
$ owi validate --help=plain
NAME
owi-validate - Validate a module

Expand Down
2 changes: 1 addition & 1 deletion test/c/malloc_aligned.t
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
$ dune exec owi -- c ./malloc_aligned.c
$ owi c ./malloc_aligned.c
All OK
2 changes: 1 addition & 1 deletion test/c/not_exists.t
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
file doesn't exist:
$ dune exec -- owi c idontexist.wat
$ owi c idontexist.wat
owi: no file 'idontexist.wat'
Usage: owi c [OPTION]… [ARG]…
Try 'owi c --help' or 'owi --help' for more information.
Expand Down
2 changes: 1 addition & 1 deletion test/c/test-comp/simple.t
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
$ dune exec owi -- c --testcomp ./simple.c
$ owi c --testcomp ./simple.c
Assert failure: (i32.ne (i32.mul symbol_0 symbol_0) (i32 0))
Model:
(model
Expand Down
2 changes: 1 addition & 1 deletion test/fmt/done.t
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
inplace:
$ dune exec owi -- fmt --inplace done.wat
$ owi fmt --inplace done.wat
2 changes: 1 addition & 1 deletion test/fmt/locals.t
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
print optimized locals:
$ dune exec owi -- opt locals.wat
$ owi opt locals.wat
(module
(func $f1 (param $a1 i32) (param $a2 i32) (param $a3 i32) (local $l1 i32) (local $l2 i32)
local.get 3
Expand Down
2 changes: 1 addition & 1 deletion test/fmt/locals_drop.t
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
print optimized locals:
$ dune exec owi -- opt locals_drop.wat
$ owi opt locals_drop.wat
(module
(func $f1 (param $a1 i32) (param $a2 i32) (param $a3 i32)

Expand Down
2 changes: 1 addition & 1 deletion test/fmt/not_exists.t
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
file doesn't exist:
$ dune exec -- owi fmt idontexist.wat
$ owi fmt idontexist.wat
owi: no file 'idontexist.wat'
Usage: owi fmt [--inplace] [OPTION]… [ARG]…
Try 'owi fmt --help' or 'owi --help' for more information.
Expand Down
2 changes: 1 addition & 1 deletion test/fmt/print.t
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
print symbolic:
$ dune exec owi -- fmt m.wat
$ owi fmt m.wat
(module
(func $f (param $x i32) (param $y i32) (result i32)
local.get $x
Expand Down
2 changes: 1 addition & 1 deletion test/fmt/script.t
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
print script:
$ dune exec owi -- fmt script.wast
$ owi fmt script.wast
(module
(func (param $x i32) (param $y i32) (result i32)
local.get $x
Expand Down
2 changes: 1 addition & 1 deletion test/help/help.t
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
no subcommand should print help
$ dune exec -- owi
$ owi
NAME
owi - OCaml WebAssembly Interpreter

Expand Down
2 changes: 1 addition & 1 deletion test/opt/binop.t
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
binary operations instructions:
$ dune exec -- owi opt binop.wat
$ owi opt binop.wat
(module
(func $i32binop

Expand Down
2 changes: 1 addition & 1 deletion test/opt/block_loop.t
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
block loop instructions:
$ dune exec -- owi opt block_loop.wat
$ owi opt block_loop.wat
(module
(func $start

Expand Down
2 changes: 1 addition & 1 deletion test/opt/br.t
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
br instructions:
$ dune exec -- owi opt br.wat
$ owi opt br.wat
(module
(func $br
i32.const 42
Expand Down
2 changes: 1 addition & 1 deletion test/opt/convert.t
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
f**.convert_i** instructions:
$ dune exec -- owi opt convert.wat
$ owi opt convert.wat
(module
(func $start

Expand Down
2 changes: 1 addition & 1 deletion test/opt/demote_promote.t
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
f32.demote_f64 f64.promote_f32 instructions:
$ dune exec -- owi opt demote_promote.wat
$ owi opt demote_promote.wat
(module
(func $start

Expand Down
2 changes: 1 addition & 1 deletion test/opt/drop.t
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
drop instruction:
$ dune exec -- owi opt drop.wat
$ owi opt drop.wat
(module
(func $start
call 1
Expand Down
2 changes: 1 addition & 1 deletion test/opt/extend_wrap.t
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
i**.extend_** i32.wrap_i64 instructions:
$ dune exec -- owi opt extend_wrap.wat
$ owi opt extend_wrap.wat
(module
(func $extend

Expand Down
2 changes: 1 addition & 1 deletion test/opt/fbinop.t
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
f32 / f64 binary operations:
$ dune exec -- owi opt fbinop.wat
$ owi opt fbinop.wat
(module
(func $start

Expand Down
2 changes: 1 addition & 1 deletion test/opt/ibinop.t
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
i32 / i64 binary operations:
$ dune exec -- owi opt ibinop.wat
$ owi opt ibinop.wat
(module
(func $start

Expand Down
2 changes: 1 addition & 1 deletion test/opt/if.t
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
if then else instruction:
$ dune exec -- owi opt if.wat
$ owi opt if.wat
(module
(func $start
(block (result i32)
Expand Down
2 changes: 1 addition & 1 deletion test/opt/local.t
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
unused local variables:
$ dune exec -- owi opt local.wat
$ owi opt local.wat
(module
(func $f0 (local i32)
i32.const 0
Expand Down
2 changes: 1 addition & 1 deletion test/opt/not_exists.t
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
file doesn't exist:
$ dune exec -- owi opt not_exists.wat --debug
$ owi opt not_exists.wat --debug
owi: no file 'not_exists.wat'
Usage: owi opt [--debug] [--unsafe] [OPTION]… [ARG]…
Try 'owi opt --help' or 'owi --help' for more information.
Expand Down
2 changes: 1 addition & 1 deletion test/opt/ref_nop.t
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
ref.null ref.is_null nop instructions:
$ dune exec -- owi opt ref_nop.wat
$ owi opt ref_nop.wat
(module
(func $start

Expand Down
2 changes: 1 addition & 1 deletion test/opt/reinterpret.t
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
f**.reinterpret_i** i**.reinterpret_f** instructions:
$ dune exec -- owi opt reinterpret.wat
$ owi opt reinterpret.wat
(module
(func $start

Expand Down
2 changes: 1 addition & 1 deletion test/opt/relop_testop.t
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
**.eq eqz lt gt ... instructions:
$ dune exec -- owi opt relop_testop.wat
$ owi opt relop_testop.wat
(module
(func $i32relop

Expand Down
2 changes: 1 addition & 1 deletion test/opt/return.t
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
return instructions:
$ dune exec -- owi opt return.wat
$ owi opt return.wat
(module
(func $return (result i32)
i32.const 42
Expand Down
2 changes: 1 addition & 1 deletion test/opt/select.t
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
select instruction:
$ dune exec -- owi opt select.wat
$ owi opt select.wat
(module
(func $start

Expand Down
2 changes: 1 addition & 1 deletion test/opt/tee.t
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
set get tee simplification:
$ dune exec -- owi opt tee.wat
$ owi opt tee.wat
(module
(func $start (local $x i32)
i32.const 41
Expand Down
2 changes: 1 addition & 1 deletion test/opt/trunc.t
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
**.trunc_** **.trunc_sat_** instructions:
$ dune exec -- owi opt trunc.wat
$ owi opt trunc.wat
(module
(func $trunc

Expand Down
2 changes: 1 addition & 1 deletion test/opt/unop.t
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
unop () instructions:
$ dune exec -- owi opt unop.wat
$ owi opt unop.wat
(module
(func $iunop

Expand Down
2 changes: 1 addition & 1 deletion test/run/not_exists.t
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
file doesn't exist:
$ dune exec -- owi run not_exists.wat
$ owi run not_exists.wat
owi: no file 'not_exists.wat'
Usage: owi run [OPTION]… [ARG]…
Try 'owi run --help' or 'owi --help' for more information.
Expand Down
Loading

0 comments on commit 3c7b1c4

Please sign in to comment.