Skip to content

Commit 926c95c

Browse files
committed
Functional tests: add --no-service mode for user-mode installs
Add --no-service flag to GVFS.FunctionalTests that: - Skips GVFSServiceProcess.InstallService()/UninstallService() - Auto-excludes tests marked [Category(Categories.RequiresService)] - Resolves PathToGVFS from %LocalAppData%\GVFS\Current\ when present Mark 3 service-dependent test classes with RequiresService category: - ServiceVerbTests (gvfs service verb commands) - ServiceTests (prjflt service manipulation) - UpgradeReminderTests (service start/stop + log inspection) All other tests (clone, mount, unmount, file operations, git commands) use gvfs.exe directly and work without a Windows service. Update CI: functional-tests.yaml passes --no-service when install_mode is 'user'. build.yaml adds functional_tests_usermode job. Assisted-by: Claude Opus 4.6 Signed-off-by: Tyrie Vella <tyrielv@gmail.com>
1 parent 29c595b commit 926c95c

10 files changed

Lines changed: 64 additions & 16 deletions

File tree

‎.github/workflows/build.yaml‎

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -340,10 +340,14 @@ jobs:
340340
with:
341341
skip: ${{ needs.validate.outputs.skip }}
342342

343-
# TODO: Add functional_tests_usermode job once the test harness
344-
# supports running without GVFS.Service (requires changes to
345-
# GVFS.FunctionalTests Settings.cs + GVFSServiceProcess.cs).
346-
# The install_mode input is already wired in functional-tests.yaml.
343+
functional_tests_usermode:
344+
name: Functional Tests (User-Mode)
345+
needs: [validate, build]
346+
uses: ./.github/workflows/functional-tests.yaml
347+
with:
348+
skip: ${{ needs.validate.outputs.skip }}
349+
install_mode: user
350+
output_prefix: UserMode
347351

348352
upgrade_tests:
349353
name: Upgrade Tests
@@ -355,7 +359,7 @@ jobs:
355359
result:
356360
runs-on: ubuntu-latest
357361
name: Build, Unit and Functional Tests Successful
358-
needs: [functional_tests, upgrade_tests]
362+
needs: [functional_tests, functional_tests_usermode, upgrade_tests]
359363

360364
steps:
361365
- name: Success! # for easier identification of successful runs in the Checks Required for Pull Requests

‎.github/workflows/functional-tests.yaml‎

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -229,9 +229,14 @@ jobs:
229229
shell: cmd
230230
timeout-minutes: 60
231231
run: |
232-
SET PATH=C:\Program Files\VFS for Git;%PATH%
233-
SET GIT_TRACE2_PERF=C:\temp\git-trace2.log
234-
ft\GVFS.FunctionalTests.exe /result:TestResult.xml --ci --slice=${{ matrix.nr }},10
232+
if "${{ inputs.install_mode }}" == "user" (
233+
SET GIT_TRACE2_PERF=C:\temp\git-trace2.log
234+
ft\GVFS.FunctionalTests.exe /result:TestResult.xml --ci --no-service --slice=${{ matrix.nr }},10
235+
) else (
236+
SET PATH=C:\Program Files\VFS for Git;%PATH%
237+
SET GIT_TRACE2_PERF=C:\temp\git-trace2.log
238+
ft\GVFS.FunctionalTests.exe /result:TestResult.xml --ci --slice=${{ matrix.nr }},10
239+
)
235240
236241
- name: Upload functional test results
237242
if: always() && steps.skip.outputs.result != 'true'

‎GVFS/GVFS.FunctionalTests/Categories.cs‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,6 @@ public static class Categories
66
public const string FastFetch = "FastFetch";
77
public const string GitCommands = "GitCommands";
88
public const string NeedsReactionInCI = "NeedsReactionInCI";
9+
public const string RequiresService = "RequiresService";
910
}
1011
}

‎GVFS/GVFS.FunctionalTests/GVFSTestConfig.cs‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ public static class GVFSTestConfig
1616

1717
public static bool ReplaceInboxProjFS { get; set; }
1818

19+
public static bool NoService { get; set; }
20+
1921
public static bool IsDevMode { get; set; }
2022

2123
public static string PathToGVFS

‎GVFS/GVFS.FunctionalTests/GlobalSetup.cs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ public void RunBeforeAnyTests()
1818
[OneTimeTearDown]
1919
public void RunAfterAllTests()
2020
{
21-
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
21+
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows) && !GVFSTestConfig.NoService)
2222
{
2323
string serviceLogFolder = Path.Combine(
2424
Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData),

‎GVFS/GVFS.FunctionalTests/Program.cs‎

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,12 @@ public static void Main(string[] args)
4848
GVFSTestConfig.ReplaceInboxProjFS = true;
4949
}
5050

51+
if (runner.HasCustomArg("--no-service"))
52+
{
53+
Console.WriteLine("Running without GVFS.Service (user-mode install)");
54+
GVFSTestConfig.NoService = true;
55+
}
56+
5157
GVFSTestConfig.LocalCacheRoot = runner.GetCustomArgWithParam("--shared-gvfs-cache-root");
5258

5359
HashSet<string> includeCategories = new HashSet<string>();
@@ -101,6 +107,11 @@ public static void Main(string[] args)
101107
excludeCategories.Add(Categories.NeedsReactionInCI);
102108
}
103109

110+
if (GVFSTestConfig.NoService)
111+
{
112+
excludeCategories.Add(Categories.RequiresService);
113+
}
114+
104115
GVFSTestConfig.FileSystemRunners = FileSystemRunners.FileSystemRunner.DefaultRunners;
105116
}
106117

@@ -151,11 +162,19 @@ private static void RunBeforeAnyTests()
151162
ProjFSFilterInstaller.ReplaceInboxProjFS();
152163
}
153164

154-
Console.WriteLine("[CI-DEBUG] Installing service...");
155-
Console.Out.Flush();
156-
GVFSServiceProcess.InstallService();
157-
Console.WriteLine("[CI-DEBUG] Service installed successfully");
158-
Console.Out.Flush();
165+
if (!GVFSTestConfig.NoService)
166+
{
167+
Console.WriteLine("[CI-DEBUG] Installing service...");
168+
Console.Out.Flush();
169+
GVFSServiceProcess.InstallService();
170+
Console.WriteLine("[CI-DEBUG] Service installed successfully");
171+
Console.Out.Flush();
172+
}
173+
else
174+
{
175+
Console.WriteLine("[CI-DEBUG] Skipping service install (--no-service)");
176+
Console.Out.Flush();
177+
}
159178

160179
string serviceProgramDataDir = GVFSPlatform.Instance.GetSecureDataRootForGVFSComponent(
161180
GVFSConstants.Service.ServiceName);

‎GVFS/GVFS.FunctionalTests/Settings.cs‎

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,22 @@ public static void Initialize()
6565
}
6666
else
6767
{
68-
PathToGVFS = @"C:\Program Files\VFS for Git\GVFS.exe";
69-
PathToGVFSService = @"C:\Program Files\VFS for Git\GVFS.Service.exe";
68+
// Check for user-mode install first, fall back to system install
69+
string userModeGvfs = Path.Combine(
70+
Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData),
71+
"GVFS", "Current", "gvfs.exe");
72+
73+
if (File.Exists(userModeGvfs))
74+
{
75+
string userModeDir = Path.GetDirectoryName(userModeGvfs);
76+
PathToGVFS = userModeGvfs;
77+
PathToGVFSService = Path.Combine(userModeDir, "GVFS.Service.exe");
78+
}
79+
else
80+
{
81+
PathToGVFS = @"C:\Program Files\VFS for Git\GVFS.exe";
82+
PathToGVFSService = @"C:\Program Files\VFS for Git\GVFS.Service.exe";
83+
}
7084
}
7185

7286
PathToGit = @"C:\Program Files\Git\cmd\git.exe";

‎GVFS/GVFS.FunctionalTests/Tests/EnlistmentPerFixture/GVFSUpgradeReminderTests.cs‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ namespace GVFS.FunctionalTests.Tests.EnlistmentPerFixture
1313
[TestFixture]
1414
[NonParallelizable]
1515
[Category(Categories.ExtraCoverage)]
16+
[Category(Categories.RequiresService)]
1617
public class UpgradeReminderTests : TestsWithEnlistmentPerFixture
1718
{
1819
private const string HighestAvailableVersionFileName = "HighestAvailableVersion";

‎GVFS/GVFS.FunctionalTests/Tests/MultiEnlistmentTests/ServiceVerbTests.cs‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ namespace GVFS.FunctionalTests.Tests.MultiEnlistmentTests
77
[TestFixture]
88
[NonParallelizable]
99
[Category(Categories.ExtraCoverage)]
10+
[Category(Categories.RequiresService)]
1011
public class ServiceVerbTests : TestsWithMultiEnlistment
1112
{
1213
private static readonly string[] EmptyRepoList = new string[] { };

‎GVFS/GVFS.FunctionalTests/Windows/Tests/ServiceTests.cs‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ namespace GVFS.FunctionalTests.Windows.Tests
1414
[TestFixture]
1515
[NonParallelizable]
1616
[Category(Categories.ExtraCoverage)]
17+
[Category(Categories.RequiresService)]
1718
public class ServiceTests : TestsWithEnlistmentPerFixture
1819
{
1920
private const string NativeLibPath = @"C:\Program Files\VFS for Git\ProjectedFSLib.dll";

0 commit comments

Comments
 (0)