WebAssembly / WebAssembly/wabt

wasm2c: custom trap handler function needs testing

Open
#2,195 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C++
Stars
8.1k
Forks
827
Avg merge
4d 6h
Merged PRs (30d)
18

Description

Per discussion in #2194

@sbc100 @keith We can definitely write a custom test for this, but would you have thoughts on the best way to add this to the existing harness. The test probably has to look something like this.

**Wasm module**
memory size = 1
func foo that accesses memory index 2

**Compilation**
Compile above module with
- flag `-DWASM_RT_TRAP_HANDLER=trap_handler`
- A main func that invokes the foo
- A `trap_handler` func

Test succeeds if trap_handler is called and fails otherwise.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the existing wasm2c test harness and the path that compiles modules with a custom trap handler. Add the described module, main function, trap_handler, and compilation flag, then verify the test succeeds only when trap_handler is called.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, wasm
Domain
devtools, testing
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.