Skip to content

Match C GLOBAL_CODE repro assertions to failing Rust behavior#1

Open
zacharywhitley wants to merge 6 commits into
mainfrom
codex/create-minimal-rust-test-for-global_code-error
Open

Match C GLOBAL_CODE repro assertions to failing Rust behavior#1
zacharywhitley wants to merge 6 commits into
mainfrom
codex/create-minimal-rust-test-for-global_code-error

Conversation

@zacharywhitley
Copy link
Copy Markdown

Motivation

  • Reintroduce strict pre/post-drop verification in the C GLOBAL_CODE repro so it mirrors the stricter Rust repro checks and can reproduce the same lookup/unregistration failures.
  • Ensure the C test exercises immediate and delayed drops across single-threaded, pressure, and threaded pressure scenarios with explicit mapped/unmapped assertions.

Description

  • Added crates/c-api/tests/global_code.c helpers to obtain a module image start via wasmtime_module_image_range and to check /proc/self/maps for mapped/unmapped addresses.
  • Inserted pre-drop assert_mapped and post-drop assert_unmapped checks around module lifetime in all repro paths, and recorded module_start for delayed-drop cases.
  • Updated crates/c-api/tests/CMakeLists.txt to build and register test-global-code, and wrapped gtest setup behind the WASMTIME_CAPI_ENABLE_GTEST_TESTS option.

Testing

  • Built the C API tests with cmake -S crates/c-api -B target/c-api-build-offline -DBUILD_TESTS=ON -DWASMTIME_CAPI_ENABLE_GTEST_TESTS=OFF && cmake --build target/c-api-build-offline --target test-global-code -j4, which completed successfully.
  • Ran the repro test with ctest --test-dir target/c-api-build-offline -R test-global-code --output-on-failure, which reproduced the failing behavior (test run failed with threaded post-drop: expected unmapped address ...).

Codex Task

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant