Skip to content

Add regression tests for VM native module filename fallbacks#35

Draft
cursor[bot] wants to merge 1 commit intonext-gen-5from
cursor/missing-test-coverage-3022
Draft

Add regression tests for VM native module filename fallbacks#35
cursor[bot] wants to merge 1 commit intonext-gen-5from
cursor/missing-test-coverage-3022

Conversation

@cursor
Copy link
Copy Markdown

@cursor cursor bot commented Mar 29, 2026

Summary

  • add focused unit coverage for VM native module native-library filename fallbacks introduced in recent VM loader changes
  • extract native module candidate filename formatting into a tiny helper (src/qcommon/vm_native_module_names.c/.h) without changing loader behavior
  • wire new unit test into CTest (unit_vm_native_module_names)

Risky behavior now covered

  • exact fallback candidate ordering used by native VM loading:
    1. module.so
    2. module.arch.so
    3. modulearch.so
  • invalid candidate index handling (must produce empty output)
  • defensive behavior for null inputs and tiny output buffers (no stale output / deterministic empty string)

Test files added/updated

  • Added: tests/unit/test_vm_native_module_names.c
  • Added: src/qcommon/vm_native_module_names.c
  • Added: src/qcommon/vm_native_module_names.h
  • Updated: src/qcommon/vm.c (uses helper, behavior-preserving refactor)
  • Updated: CMakeLists.txt (register new unit target/test)

Validation run

  • cmake -S /workspace -B /workspace/build-vk-Release
  • cmake --build /workspace/build-vk-Release --target unit_vm_native_module_names unit_macros -j4
  • ctest -R "unit_(macros|vm_native_module_names)" --output-on-failure -V (passed)

Why this materially reduces regression risk

Native VM loading is a core startup path with high blast radius: if fallback filename formatting/order regresses, game/client/ui modules can fail to load at runtime. These tests lock the exact candidate contract and edge-condition behavior, catching subtle naming/fallback regressions early without requiring platform-specific runtime setups.

Open in Web View Automation 

Co-authored-by: Tim Fox <timfox@outlook.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant