Skip to content

tests: guard pk3 native library cache behavior#195

Draft
cursor[bot] wants to merge 3 commits intonext-gen-5from
cursor/regression-test-coverage-670f
Draft

tests: guard pk3 native library cache behavior#195
cursor[bot] wants to merge 3 commits intonext-gen-5from
cursor/regression-test-coverage-670f

Conversation

@cursor
Copy link
Copy Markdown

@cursor cursor Bot commented May 6, 2026

Summary

  • Adds a deterministic regression source guard for pk3-backed native library extraction/cache behavior.
  • Registers the guard as test_pk3_native_library_cache in CTest.

Risky behavior now covered

  • com_nativeLibraryExtractPk3 remains default-on, archived, documented, and logged at startup.
  • pk3 native libraries are cached under vm/native_cache/ using only the basename and the homepath game directory.
  • Cache reuse requires matching pk3 CRC, disk length, and disk CRC before attempting to load from cache.
  • New extraction keeps the direct write path and warning/extraction logs, and FS_LoadLibrary tries the pk3 cache before loose filesystem paths.

Test files added/updated

  • Added tests/scripts/test_pk3_native_library_cache.sh
  • Updated CMakeLists.txt

Why this reduces regression risk

This path controls native module loading from .pk3 packages, so mistakes can break standalone/full-conversion UI or game module loading, bypass the intended cache safety checks, or load stale/corrupt extracted libraries. The test guards the security- and compatibility-relevant invariants without requiring game data, a display, or dynamic loader success.

Validation

  • tests/scripts/test_pk3_native_library_cache.sh
  • cmake -S . -B build-coverage-tests -DBUILD_TESTING=ON -DBUILD_UNIT_TESTS=OFF && ctest --test-dir build-coverage-tests -R test_pk3_native_library_cache --output-on-failure
Open in Web View Automation 

cursoragent and others added 3 commits May 6, 2026 10:04
Co-authored-by: Tim Fox <timfox@outlook.com>
Co-authored-by: Tim Fox <timfox@outlook.com>
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