Commit 7ad68c3
Zachary Whitley
test(wasmtime): integration coverage for tvm-guest-rt typed accessors + reducers
Closes the test-coverage gap where tvm-guest-rt's wasm32-only
extern "C" declarations (and the byte arithmetic in `with_offset`)
had no end-to-end validation reachable from a host-target test run.
Approach: a WAT module that **faithfully reproduces** the call
sequences tvm-guest-rt emits — same tvm.* raw imports, same packed-
handle-with-delta arithmetic, same little-endian byte layout — and
exercises every reducer + typed-accessor path through it.
If host ABI for tvm.<op> ever drifts, this test catches it before
real guest code does.
#4 — Typed load/store integration (tvm-guest-rt::RegionPtr::load_*,
store_*):
- typed_u8_round_trip — write/read every offset, verify pattern
- typed_u32_le_round_trip — round-trip 0, 1, 0xdeadbeef, edges
- typed_i64_le_round_trip — round-trip 0, ±MAX, ±MIN, mixed
- typed_load_against_host_seeded_bytes — seed via write_bytes,
read at non-zero deltas via the with_offset arithmetic; verifies
both u8 (every offset) and u32_le (aligned offsets) paths
#5 — Reducer raw imports integration (tvm-guest-rt::RegionPtr::{sum_u8,
popcount, count_byte, count_in_range, min_max_u8, find_byte, eq,
lex_cmp, hash_fnv1a, and_fold_u8, or_fold_u8, xor_fold_u8,
sum_u32_le, max_u32_le, fill, xor_with_byte, xor_into_region}):
- reducer_roundtrip_all_ops — exercises 14 reducer/comparison ops
against a known byte pattern; checks scalar results match
independently-computed references (sum, popcount, predicate
counts, min_max, fold values for the 0..255 sequence, hash
determinism, eq/lex_cmp on identical regions, sum/max u32_le).
- reducer_mutators_modify_in_place — fill, xor_with_byte,
xor_into_region; reads bytes back through TvmHost to confirm
the in-place mutations took effect.
6 new tests, all passing. Total integration coverage now includes
every host-side reducer/mutator import that tvm-guest-rt exposes
plus the typed-accessor byte arithmetic.1 parent b9df708 commit 7ad68c3
1 file changed
Lines changed: 438 additions & 0 deletions
0 commit comments