Skip to content

Commit 7bfa82f

Browse files
sjoelundclaude
andauthored
Add wasm-jit testing (#289)
* Support simCodeTarget=wasm-jit in the test tool wasm-jit generates neither a makefile nor an executable; the model is JIT-compiled inside the omc that translated it. Detect the target from the customCommands (so `--extraflags` selects it), skip the build step and simulate with `simulate(..., resimulateExecutable=...)` in that same session instead of running an executable that does not exist. Two things turned a failure into a hang rather than a reported error: - `writeResultAndExit` called the builtin `quit()` instead of `quit_omc()`, so `SystemExit` was raised before `os._exit()` and the interpreter then waited forever for a thread stuck in a ZMQ receive. - `sendExpressionTimeout` only joined that thread with a timeout, so an omc that died mid-command was not noticed until the full `ulimitOmc` had elapsed. It now polls the process and exits as soon as it dies. The C path checks that the executable exists before running it. The default 8 GB virtual memory limit is too small for wasm-jit: omc peaks at ~5.8 GB and the JIT then reserves 4 GB of address space for the wasm memory, so every simulation failed with `mmap failed to reserve 0x104000000 bytes`. Use 16 GB for that target. Also adds the experimental wasm-jit regression job to the Jenkinsfile. * Separate wasm-jit compile time from sim time The wasm-jit target JIT-compiles the model inside omc, and the test tool ran `translateModel` followed by `simulate(resimulateExecutable=)`. That path never calls `buildModel`, so `timeCompile` is not measured and the compile lands in the simulation time instead — reported as a build time of 0 and a correspondingly inflated `sim`. `--nobuildmodel` translates, builds and runs in a single `simulate()` call, which reports the phase times itself, and takes the build and simulation times from that record rather than the wall clock around the command. For VehicleInterfaces the same run splits as: | Flag | build | sim | |-------------------|---------|---------| | (none) | 0.00000 | 0.44668 | | `--nobuildmodel` | 0.21299 | 0.21309 | `--coldhot` simulates each model twice in the same omc. The second run reuses the module compiled for the first, so it is the hot number; both are printed but only the hot one is stored, since the database columns are enumerated in the insert. Both flags only apply to `simCodeTarget=wasm-jit`, and only set their config key when passed, so the confighash — and therefore the stored history — of a normal run is unchanged. `runRegressiontest` gains a `testFlags` argument, passed to `test.py` verbatim; the wasm-jit job uses it for `--nobuildmodel`. Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
1 parent 0232044 commit 7bfa82f

0 file changed

File tree

    0 commit comments

    Comments
     (0)