| ;; NOTE: Assertions have been generated by update_lit_checks.py --output=fuzz-exec and should not be edited. |
| |
| ;; RUN: foreach %s %t wasm-opt -all --fuzz-exec-before | filecheck %s |
| |
| ;; $start runs before the first export, so we print 1 here. |
| (module |
| (global $global (mut i32) (i32.const 0)) |
| |
| (start $start) |
| |
| (func $start |
| (global.set $global |
| (i32.const 1) |
| ) |
| ) |
| |
| ;; CHECK: [fuzz-exec] export run |
| ;; CHECK-NEXT: [fuzz-exec] note result: run => 1 |
| ;; CHECK-NEXT: [trap unreachable] |
| ;; CHECK-NEXT: [exception thrown: start] |
| (func $run (export "run") (result i32) |
| ;; Due to limitations of the auto-updater, the trap and exception from the |
| ;; following two modules gets logged here. (There is at least no |
| ;; ambiguity: we first see that we finished ok and returned a value.) |
| (global.get $global) |
| ) |
| ) |
| |
| ;; A trapping start prevents any export from running. |
| (module |
| (start $trap) |
| |
| (func $trap |
| (unreachable) |
| ) |
| |
| (func $run (export "run") (result i32) |
| (i32.const 42) |
| ) |
| ) |
| |
| ;; A throwing start prevents any export from running. |
| (module |
| (tag $tag) |
| |
| (start $throw) |
| |
| (func $throw |
| (throw $tag) |
| ) |
| |
| (func $run (export "run") (result i32) |
| (i32.const 42) |
| ) |
| ) |