Skip to content

Add VM native module loader regression coverage#34

Draft
cursor[bot] wants to merge 2 commits intonext-gen-5from
cursor/missing-test-coverage-4cd0
Draft

Add VM native module loader regression coverage#34
cursor[bot] wants to merge 2 commits intonext-gen-5from
cursor/missing-test-coverage-4cd0

Conversation

@cursor
Copy link
Copy Markdown

@cursor cursor bot commented Mar 28, 2026

Summary

This PR adds focused unit-test coverage for native VM module fallback name resolution introduced in recent VM loader changes, with a minimal testability refactor that preserves runtime behavior.

Risky behavior now covered

  • Native VM module filename candidate ordering used by VM_TryLoadNativeModule:
    1. module.so
    2. module.<arch>.so
    3. module<arch>.so
  • Input validation behavior for candidate generation (invalid index, null/empty inputs, invalid output buffer).

These paths are high blast-radius because they affect dynamic loading for core modules (game/cgame/ui aliases) and fallback behavior across architectures.

Test files added/updated

  • Added: tests/unit/test_vm_native_loader.c
  • Added: src/qcommon/vm_native_loader.c
  • Added: src/qcommon/vm_native_loader.h
  • Updated: src/qcommon/vm.c (uses extracted helper in existing load flow)
  • Updated: CMakeLists.txt (registers unit_vm_native_loader target/test)

Why this materially reduces regression risk

  • Locks down the exact filename fallback sequence expected by recent production logic changes.
  • Prevents subtle architecture-specific loader regressions (e.g., accidental ordering changes, missing module.<arch>.so support) from shipping unnoticed.
  • Provides deterministic, dependency-light unit coverage for a core loading path without requiring renderer or full engine startup.

Validation

  • Reconfigured build directory and built the new unit target:
    • cmake -S /workspace -B /workspace/build-vk-Release
    • cmake --build /workspace/build-vk-Release --target unit_vm_native_loader
  • Ran focused test target:
    • ctest -R unit_vm_native_loader --output-on-failure
  • Result: PASS
Open in Web View Automation 

cursoragent and others added 2 commits March 28, 2026 10:13
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