Fix unit-test segfault on missing shipped profile in sparse CI checkout

The Unit Tests job sparse-checks-out only .github/scripts/tests, so the
baked-in absolute PROFILES_DIR was missing at runtime; the shipped-profile
test then read a non-existent JSON and null-dereferenced in opt_string.
Check out resources/ in the unit-test job, and guard the test helper to
skip when the profile is absent and require the key before dereferencing.
This commit is contained in:
SoftFever
2026-07-15 14:55:41 +08:00
parent c3f78723fb
commit d55e7834c8
2 changed files with 16 additions and 2 deletions

View File

@@ -28,11 +28,15 @@ jobs:
- name: Checkout
uses: actions/checkout@v7
with:
# tests/data is referenced by absolute path (TEST_DATA_DIR).
# Tests reach outside tests/ at runtime: tests/data (TEST_DATA_DIR) and
# resources/profiles (PROFILES_DIR) by baked-in absolute path, plus
# resources/info (nozzle data) via resources_dir() during a real slice.
# Check out all of resources/ so no test hits a missing-file path.
sparse-checkout: |
.github
scripts
tests
resources
- name: Apt-Install Dependencies
if: runner.os == 'Linux' && !vars.SELF_HOSTED
uses: ./.github/actions/apt-install-deps