Problem
On Windows, cargo test / cargo make check fails to launch the
integration test binary built from tests/add_remove_update.rs:
Running tests\add_remove_update.rs (target\debug\deps\add_remove_update-XXXX.exe)
error: test failed, to rerun pass `--test add_remove_update`
Caused by:
could not execute process `...\add_remove_update-XXXX.exe` (never executed)
Caused by:
要求された操作には管理者特権が必要です。 (os error 740)
The test code itself never runs — process creation fails before
the binary's main is entered, with ERROR_ELEVATION_REQUIRED
(0x2E4 / 740).
Cause
Windows' Installer Detection Technology heuristically
flags unmanifested 32/64-bit executables whose filenames contain
keywords like install, setup, update, patch, etc. as
legacy installers and demands UAC elevation before launch.
Our test binary's filename is
add_remove_update-<hash>.exe — the update substring matches
the heuristic. Rust test binaries don't embed a manifest with
<requestedExecutionLevel level=\"asInvoker\"/> by default, so
they're subject to the rule.
Sibling integration tests in the same target/debug/deps/
directory (e.g. apply_basic-XXXX.exe, merge_section-XXXX.exe)
run fine because none of their filenames trip the heuristic.
This is Windows-only — CI on Linux/macOS, and on a Windows runner
running with an unattended administrator session, never sees it.
Impact
- Local pre-push hook (
cargo make check) is permanently broken
on developer Windows machines until they either rename the
file, embed a manifest, or disable installer detection in local
policy (the last isn't portable).
- A developer who only runs the lib tests via
cargo test --lib
doesn't notice; a developer who runs cargo test does and has
to dig.
Proposed
Rename the test file to one that doesn't contain
install / setup / update / patch keywords. The current
name ("add / remove / update") describes the worktree lifecycle
the test covers, so something like:
tests/worktree_lifecycle.rs
tests/branch_lifecycle.rs
tests/branch_ops.rs
… would convey the same intent without tripping the heuristic.
This is one git mv plus zero code changes. The alternative
(embedding a manifest via a build.rs + embed-manifest) costs
a build dependency for every test target and is overkill given
the trivial rename.
Workaround for now
cargo test --lib — lib tests don't hit the integration binary.
Related
Problem
On Windows,
cargo test/cargo make checkfails to launch theintegration test binary built from
tests/add_remove_update.rs:The test code itself never runs — process creation fails before
the binary's
mainis entered, withERROR_ELEVATION_REQUIRED(0x2E4 / 740).
Cause
Windows' Installer Detection Technology heuristically
flags unmanifested 32/64-bit executables whose filenames contain
keywords like
install,setup,update,patch, etc. aslegacy installers and demands UAC elevation before launch.
Our test binary's filename is
add_remove_update-<hash>.exe— theupdatesubstring matchesthe heuristic. Rust test binaries don't embed a manifest with
<requestedExecutionLevel level=\"asInvoker\"/>by default, sothey're subject to the rule.
Sibling integration tests in the same
target/debug/deps/directory (e.g.
apply_basic-XXXX.exe,merge_section-XXXX.exe)run fine because none of their filenames trip the heuristic.
This is Windows-only — CI on Linux/macOS, and on a Windows runner
running with an unattended administrator session, never sees it.
Impact
cargo make check) is permanently brokenon developer Windows machines until they either rename the
file, embed a manifest, or disable installer detection in local
policy (the last isn't portable).
cargo test --libdoesn't notice; a developer who runs
cargo testdoes and hasto dig.
Proposed
Rename the test file to one that doesn't contain
install/setup/update/patchkeywords. The currentname ("add / remove / update") describes the worktree lifecycle
the test covers, so something like:
tests/worktree_lifecycle.rstests/branch_lifecycle.rstests/branch_ops.rs… would convey the same intent without tripping the heuristic.
This is one
git mvplus zero code changes. The alternative(embedding a manifest via a
build.rs+embed-manifest) costsa build dependency for every test target and is overkill given
the trivial rename.
Workaround for now
cargo test --lib— lib tests don't hit the integration binary.Related
hooks.post_create[0]) #107 (the PR's localcargo make checkis otherwise green; only this binary trips).Detection Technology.