Skip to content

svc: make the failed-mount replacement test independent of other drives - #7

Draft
FacuM wants to merge 1 commit into
mainfrom
fix/svc-test-letter-race
Draft

FacuM wants to merge 1 commit into
mainfrom
fix/svc-test-letter-race

Conversation

@FacuM

@FacuM FacuM commented Nov 1, 2026

Copy link
Copy Markdown
Collaborator

Problem

unit.svc failed once in a tools/ci-local.ps1 -Pipeline run (x86-ia32) at svc_autostart_failed_mount_is_replaced_by_a_new_mount: "P:" != "X:". The test checks that a new mount of a profile whose boot autostart failed gets the same auto letter back — that is what proves the failed record released its letter. But the service picks auto letters from the live GetLogicalDrives() mask, so a drive mounted meanwhile by another gate test running in parallel (dokany.mount, webdav.redirector) moves the second pick to another letter.

Fix

  • svc_opts.logical_drives: the drive mask read by the letter pick and the target_in_use check. NULL = GetLogicalDrives (shipping behavior unchanged).
  • The boot-autostart cores of test_service.c (fake backend, which maps no letter) pass a fixed mask with only C: in use.
  • The test keeps the "same letter" assertion and now also pins it: the autostart takes Z:, and the replacement must take Z: again; if the failed record still held its letter, the new mount would get Y:.

Verification

  • ctest --test-dir build/x86-ia32 -C Release -R "^unit\.svc$" --repeat until-fail:20: 20/20 passed.
  • tools/ci-local.ps1 -Pipeline: all five presets pass (x86 presets skip dokany.mount under WOW64, as usual).

svc_autostart_failed_mount_is_replaced_by_a_new_mount checks that the new
mount of a profile whose autostart mount failed gets the same auto letter
back, which proves the failed record released it. The service picked that
letter from the live GetLogicalDrives() mask, so a drive mounted by another
gate test (dokany.mount, webdav.redirector) between the two picks moved the
second mount to another letter ("P:" != "X:" once in x86-ia32).

Add svc_opts.logical_drives, the drive mask the letter pick and the
target_in_use check read (NULL = GetLogicalDrives). The boot cores of the
tests use the fake backend, which maps no letter, and pass a fixed mask
with only C: in use, so the autostart takes Z: and the replacement must
take Z: again; the test now asserts that letter too.
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