Skip to content

functional tests: add dev mode for running without admin#1916

Merged
tyrielv merged 1 commit intomicrosoft:masterfrom
tyrielv:tyrielv/dev-func-tests
Mar 18, 2026
Merged

functional tests: add dev mode for running without admin#1916
tyrielv merged 1 commit intomicrosoft:masterfrom
tyrielv:tyrielv/dev-func-tests

Conversation

@tyrielv
Copy link
Contributor

@tyrielv tyrielv commented Mar 18, 2026

Running functional tests today requires admin privileges (to install a Windows service via sc create) and a system-wide GVFS installation (from C:\Program Files). This makes the edit-build-test cycle heavyweight for developers.

This change adds an opt-in dev mode, activated via environment variable, that removes both requirements. When GVFS_FUNCTIONAL_TEST_DEV_MODE=1:

  • The test service runs as a console background process instead of a Windows service (new --console flag on GVFS.Service.exe)
  • Test binaries are resolved from the build output (GVFS.Payload) via GVFS_DEV_OUT_DIR, not C:\Program Files
  • Service data directories are redirected to user-writable temp paths via GVFS_COMMON_APPDATA_ROOT and GVFS_SECURE_DATA_ROOT env vars
  • ProjFS IsReady() no longer fails when FilterAttach returns ACCESS_DENIED — if ProjFS is already running, the filter is attached and non-elevated mounts can proceed

A new RunFunctionalTests-Dev.bat script sets all the env vars and runs tests from build output in one step.

The existing RunFunctionalTests.bat behavior, CI pipeline, and admin install flow are completely unchanged — all new code paths are gated behind environment variables that are not set by default.

Prerequisite: ProjFS must have been enabled on the machine at least once (i.e., GVFS was installed previously or the ProjFS optional feature was enabled).

@tyrielv tyrielv force-pushed the tyrielv/dev-func-tests branch from b75f5a7 to 8e39f3b Compare March 18, 2026 20:52
Running functional tests today requires admin privileges (to install a
Windows service via sc create) and a system-wide GVFS installation (from
C:\Program Files). This makes the edit-build-test cycle heavyweight for
developers.

This change adds an opt-in dev mode, activated via environment variable,
that removes both requirements. When GVFS_FUNCTIONAL_TEST_DEV_MODE=1:

- The test service runs as a console background process instead of a
  Windows service (new --console flag on GVFS.Service.exe)
- Test binaries are resolved from the build output (GVFS.Payload) via
  GVFS_DEV_OUT_DIR, not C:\Program Files
- Service data directories are redirected to user-writable temp paths
  via GVFS_COMMON_APPDATA_ROOT and GVFS_SECURE_DATA_ROOT env vars
- ProjFS IsReady() no longer fails when FilterAttach returns
  ACCESS_DENIED — if ProjFS is already running, the filter is attached
  and non-elevated mounts can proceed

A new RunFunctionalTests-Dev.bat script sets all the env vars and runs
tests from build output in one step.

The existing RunFunctionalTests.bat behavior, CI pipeline, and admin
install flow are completely unchanged — all new code paths are gated
behind environment variables that are not set by default.

Prerequisite: ProjFS must have been enabled on the machine at least once
(i.e., GVFS was installed previously or the ProjFS optional feature was
enabled).

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@tyrielv tyrielv force-pushed the tyrielv/dev-func-tests branch from 8e39f3b to 4e30816 Compare March 18, 2026 21:04
Copy link

@KeithIsSleeping KeithIsSleeping left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Clean, well-gated addition — all new code paths are behind environment variables that are unset by default, and existing CI/production behavior is completely untouched. The console mode service, build-output path resolution, and data directory redirection all work together nicely to remove the admin + system-install requirement for the edit-build-test cycle.

Reviewed the env var overrides in WindowsPlatform.Shared.cs (GVFS_SECURE_DATA_ROOT, GVFS_COMMON_APPDATA_ROOT) — since the production service runs as LOCAL SYSTEM and doesn't inherit user-level env vars, there's no privilege escalation concern. Setting system-level env vars requires admin (already game over). These only affect the user's own gvfs.exe process, which is the intended dev mode behavior.

One optional suggestion:

ProjFS ACCESS_DENIED check — The string-based check error.Contains(AccessDeniedResult.ToString()) in IsReady() relies on TryAttach formatting the HRESULT as "0x80070005" in the error message. If TryAttach ever changes its error format, this would silently break. Consider having TryAttach return the HRESULT as a structured value (e.g., an out uint parameter) for a more robust check. Not a blocker — the current approach works and the preconditions (IsServiceRunning + IsNativeLibInstalled) narrow the window significantly.

@tyrielv tyrielv enabled auto-merge March 18, 2026 23:00
@tyrielv tyrielv merged commit 0000e6e into microsoft:master Mar 18, 2026
49 checks passed
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.

3 participants