Skip to content

Commit a3e55e2

Browse files
authored
Merge pull request #1256: Merge milestones/M153 to releases/shipped
- Includes Git 2.22 - Moves placeholder database into SQLite for better performance. - Fixes when libgit2 repos are acquired and disposed for better performance of checkout (where detected) and other operations that rely heavily on the read-object hook. - Adds additional logging for folder and file placeholder creation. - Other bug fixes for reliability
2 parents e730d46 + 9adf10c commit a3e55e2

297 files changed

Lines changed: 9264 additions & 2707 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.vsconfig

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"version": "1.0",
3+
"components": [
4+
"Microsoft.Component.MSBuild",
5+
"Microsoft.VisualStudio.Workload.NativeDesktop"
6+
"Microsoft.VisualStudio.Workload.ManagedDesktop",
7+
"Microsoft.VisualStudio.Workload.NetCoreTools",
8+
"Microsoft.Net.Core.Component.SDK.2.1",
9+
"Microsoft.VisualStudio.Component.VC.v141.x86.x64",
10+
"Microsoft.Net.Component.4.6.1.TargetingPack",
11+
"Microsoft.Net.Component.4.6.1.SDK",
12+
]
13+
}

AuthoringTests.md

Lines changed: 84 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2,39 +2,103 @@
22

33
## Functional Tests
44

5-
### 1. Running the functional tests
5+
#### Runnable functional test projects
66

7-
Our functional tests are in the `GVFS.FunctionalTests` project. They are built on NUnit 3, which is available as a set of NuGet packages.
7+
- `GVFS.FunctionalTests`
8+
- `GVFS.FunctionalTests.Windows`
89

9-
To run the functional tests:
10-
1. Open GVFS.sln in Visual Studio
11-
2. Build all, which will download the NUnit framework and runner
12-
3. You have three options for how to run the tests, all of which are equivalent.
13-
1. Run the `GVFS.FunctionalTests` project. Even better, set it as the default project and hit F5.
14-
2. Use the command line runner. After building, execute `Scripts\RunFunctionalTests.bat`
15-
3. If you want to use Visual Studio's Test Explorer, you need to install the NUnit 3 Test Adapter in VS | Tools | Extensions and Updates.
10+
`GVFS.FunctionalTests` is a .NET Core project and contains all cross-platform functional tests. `GVFS.FunctionalTests.Windows`, contains functional tests that require Windows. Additionally, `GVFS.FunctionalTests.Windows` includes all the `GVFS.FunctionalTests` allowing it to run both cross-platform and Windows-specific functional tests.
1611

17-
Running the `GVFS.FunctionalTests` project is probably the most convenient for developers. `RunFunctionalTests.bat` will be used on the build machines.
12+
#### Other functional test projects
13+
14+
*GVFS.NativeTests*
15+
16+
`GVFS.NativeTests` contains tests written in C++ that use the Windows API directly. These tests are called from the managed tests (see above) using PInvoke.
17+
18+
*GVFS.FunctionalTests.LockHolder*
19+
20+
The `LockHolder` is a small program that allows the functional tests to request and release the `GVFSLock`. `LockHolder` is useful for simulating different timing/race conditions.
21+
22+
## Running the Functional Tests
23+
24+
The functional tests are built on NUnit 3, which is available as a set of NuGet packages.
25+
26+
### Windows
27+
28+
1. Build VFS for Git:
29+
30+
**Option 1:** Open GVFS.sln in Visual Studio and build everything.
31+
32+
**Option 2:** Run `Scripts\BuildGVFSForWindows.bat` from the command line
33+
34+
2. Run the VFS4G installer that was built in step 2. This will ensure that ProjFS is properly installed/enabled on your machine, and that VFS4G will be able to find the correct version of the pre/post-command hooks. The installer will be placed in `BuildOutput\GVFS.Installer.Windows\bin\x64\<Debug or Release>`
35+
3. Run the tests **with elevation**. Elevation is required because the functional tests create and delete a test service.
36+
37+
**Option 1:** Run the `GVFS.FunctionalTests.Windows` project from inside Visual Studio launched as Administrator.
38+
39+
**Option 2:** Run `Scripts\RunFunctionalTests.bat` from CMD launched as Administrator.
40+
41+
#### Selecting Which Tests are Run
42+
43+
By default, the functional tests run a subset of tests as a quick smoke test for developers. There are three mutually exclusive arguments that can be passed to the functional tests to change this behavior:
44+
45+
- `--full-suite`: Run all configurations of all functional tests
46+
- `--extra-only`: Run only those tests marked as "ExtraCoverage" (i.e. the tests that are not run by default)
47+
- `--windows-only`: Run only the tests marked as being Windows specific
48+
49+
**NOTE** `Scripts\RunFunctionalTests.bat` already uses some of these arguments. If you run the tests using `RunFunctionalTests.bat` consider locally modifying the script rather than passing these flags as arguments to the script.
50+
51+
### Mac
52+
53+
1. Build VFS for Git: `Scripts/Mac/BuildGVFSForMac.sh`
54+
2. Run the tests: `Scripts/Mac/RunFunctionalTests.sh `
55+
56+
If you need the VS for Mac debugger attached for a functional test run:
57+
58+
1. Make sure you've built your latest changes
59+
2. Run `./ProjFS.Mac/Scripts/LoadPrjFSKext.sh`
60+
3. Open GVFS.sln in VS for Mac
61+
4. Run->Run With->Custom Configuration...
62+
5. Select "Start external program" and specify the published functional test binary (e.g. `/Users/<USERNAME>/Repos/VFSForGit/Publish/GVFS.FunctionalTests`)
63+
6. Specify any desired arguments (e.g. [a specific test](#Running-Specific-Tests) )
64+
7. Run Action -> "Debug - .Net Core Debugger"
65+
8. Click "Debug"
66+
67+
### Customizing the Functional Test Settings
1868

1969
The functional tests take a set of parameters that indicate what paths and URLs to work with. If you want to customize those settings, they
2070
can be found in [`GVFS.FunctionalTests\Settings.cs`](/GVFS/GVFS.FunctionalTests/Settings.cs).
2171

22-
### 2. Running Full Suite of Tests vs. Smoke Tests
2372

24-
By default, the VFS for Git functional tests run a subset of tests as a quick smoke test for developers. To run all tests, pass in the `--full-suite` flag.
73+
## Running Specific Tests
74+
75+
Specific tests can be run by adding the `--test=<comma separated list of tests>` command line argument to the functional test project/scripts.
76+
77+
Note that the test name must include the class and namespace and that `Debug` or `Release` must be specified when running the functional test scripts.
78+
79+
*Example*
80+
81+
Windows (Script):
82+
83+
`Scripts\RunFunctionalTests.bat Debug --test=GVFS.FunctionalTests.Tests.EnlistmentPerFixture.GitFilesTests.CreateFileTest`
84+
85+
Windows (Visual Studio):
86+
87+
1. Set `GVFS.FunctionalTests.Windows` as StartUp project
88+
2. Project Properties->Debug->Start options->Command line arguments (all on a single line): `--test=GVFS.FunctionalTests.Tests.EnlistmentPerFixture.GitFilesTests.CreateFileTest`
2589

26-
### 3. Running specific tests
90+
Mac:
2791

28-
Specific tests can be run by specifying `--test=<comma separated list of tests>` as the command line arguments to the functional test project.
92+
`Scripts/Mac/RunFunctionalTests.sh Debug --test=GVFS.FunctionalTests.Tests.EnlistmentPerFixture.GitFilesTests.CreateFileTest`
2993

30-
### 4. How to write a functional test
94+
## How to Write a Functional Test
3195

3296
Each piece of functionality that we add to VFS for Git should have corresponding functional tests that clone a repo, mount the filesystem, and use existing tools and filesystem
3397
APIs to interact with the virtual repo.
3498

3599
Since these are functional tests that can potentially modify the state of files on disk, you need to be careful to make sure each test can run in a clean
36100
environment. There are three base classes that you can derive from when writing your tests. It's also important to put your new class into the same namespace
37-
as the base class, because NUnit treats namespaces like test suites, and we have logic that keys off of that for deciding when to create enlistments.
101+
as the base class, because NUnit treats namespaces like test suites, and we have logic that keys off that for deciding when to create enlistments.
38102

39103
1. `TestsWithLongRunningEnlistment`
40104

@@ -49,11 +113,11 @@ as the base class, because NUnit treats namespaces like test suites, and we have
49113

50114
3. `TestsWithEnlistmentPerTestCase`
51115

52-
Derive from this class if you need a brand new enlistment per test case. This is the most reliable, but also most expensive option.
116+
Derive from this class if you need a new enlistment created for each test case. This is the most reliable, but also most expensive option.
53117

54-
### 5. Updating the remote test branch
118+
## Updating the Remote Test Branch
55119

56-
By default, `GVFS.FunctionalTests` clones `master`, checks out the branch "FunctionalTests/YYYYMMDD" (with the day the FunctionalTests branch was created),
57-
and then removes all remote tracking information. This is done to guarantee that remote changes to tip cannot break functional tests. If you need to update
120+
By default, the functional tests clone `master`, check out the branch "FunctionalTests/YYYYMMDD" (with the day the FunctionalTests branch was created),
121+
and then remove all remote tracking information. This is done to guarantee that remote changes to tip cannot break functional tests. If you need to update
58122
the functional tests to use a new FunctionalTests branch, you'll need to create a new "FunctionalTests/YYYYMMDD" branch and update the `Commitish` setting in `Settings.cs` to have this new branch name.
59123
Once you have verified your scenarios locally you can push the new FunctionalTests branch and then your changes.

GVFS.sln

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GVFS.Installer.Mac", "GVFS\
103103
{FAC6EFC5-A890-4CB2-8C80-6358E358C637} = {FAC6EFC5-A890-4CB2-8C80-6358E358C637}
104104
{374BF1E5-0B2D-4D4A-BD5E-4212299DEF09} = {374BF1E5-0B2D-4D4A-BD5E-4212299DEF09}
105105
{35CA4DFB-1320-4055-B8F6-F12E0F252FF0} = {35CA4DFB-1320-4055-B8F6-F12E0F252FF0}
106+
{AECEC217-2499-403D-B0BB-2962B9BE5970} = {AECEC217-2499-403D-B0BB-2962B9BE5970}
106107
EndProjectSection
107108
EndProject
108109
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GVFS.SignFiles", "GVFS\GVFS.SignFiles\GVFS.SignFiles.csproj", "{2F63B22B-EE26-4266-BF17-28A9146483A1}"
@@ -120,6 +121,7 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GVFS.SignFiles", "GVFS\GVFS
120121
{4CE404E7-D3FC-471C-993C-64615861EA63} = {4CE404E7-D3FC-471C-993C-64615861EA63}
121122
{24D161E9-D1F0-4299-BBD3-5D940BEDD535} = {24D161E9-D1F0-4299-BBD3-5D940BEDD535}
122123
{93B403FD-DAFB-46C5-9636-B122792A548A} = {93B403FD-DAFB-46C5-9636-B122792A548A}
124+
{AECEC217-2499-403D-B0BB-2962B9BE5970} = {AECEC217-2499-403D-B0BB-2962B9BE5970}
123125
EndProjectSection
124126
EndProject
125127
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "GVFS.VirtualFileSystemHook.Windows", "GVFS\GVFS.VirtualFileSystemHook\GVFS.VirtualFileSystemHook.Windows.vcxproj", "{2D23AB54-541F-4ABC-8DCA-08C199E97ABB}"
@@ -143,7 +145,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GVFS.Mac", "GVFS\GVFS\GVFS.
143145
EndProject
144146
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GVFS.Windows", "GVFS\GVFS\GVFS.Windows.csproj", "{32220664-594C-4425-B9A0-88E0BE2F3D2A}"
145147
ProjectSection(ProjectDependencies) = postProject
146-
{AECEC217-2499-403D-B0BB-2962B9BE5970} = {AECEC217-2499-403D-B0BB-2962B9BE5970}
147148
{2D23AB54-541F-4ABC-8DCA-08C199E97ABB} = {2D23AB54-541F-4ABC-8DCA-08C199E97ABB}
148149
{798DE293-6EDA-4DC4-9395-BE7A71C563E3} = {798DE293-6EDA-4DC4-9395-BE7A71C563E3}
149150
{5A6656D5-81C7-472C-9DC8-32D071CB2258} = {5A6656D5-81C7-472C-9DC8-32D071CB2258}
@@ -191,7 +192,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GVFS.Hooks.Mac", "GVFS\GVFS
191192
{A4984251-840E-4622-AD0C-66DFCE2B2574} = {A4984251-840E-4622-AD0C-66DFCE2B2574}
192193
EndProjectSection
193194
EndProject
194-
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GVFS.Upgrader", "GVFS\GVFS.Upgrader\GVFS.Upgrader.csproj", "{AECEC217-2499-403D-B0BB-2962B9BE5970}"
195+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GVFS.Upgrader", "GVFS\GVFS.Upgrader\GVFS.Upgrader.csproj", "{AECEC217-2499-403D-B0BB-2962B9BE5970}"
195196
EndProject
196197
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "GVFS.PostIndexChangedHook.Windows", "GVFS\GVFS.PostIndexChangedHook\GVFS.PostIndexChangedHook.Windows.vcxproj", "{24D161E9-D1F0-4299-BBD3-5D940BEDD535}"
197198
ProjectSection(ProjectDependencies) = postProject
@@ -263,9 +264,11 @@ Global
263264
{03769A07-F216-456B-886B-E07CAF6C5E81}.Debug.Mac|x64.ActiveCfg = Debug|x64
264265
{03769A07-F216-456B-886B-E07CAF6C5E81}.Debug.Mac|x64.Build.0 = Debug|x64
265266
{03769A07-F216-456B-886B-E07CAF6C5E81}.Debug.Windows|x64.ActiveCfg = Debug|x64
267+
{03769A07-F216-456B-886B-E07CAF6C5E81}.Debug.Windows|x64.Build.0 = Debug|x64
266268
{03769A07-F216-456B-886B-E07CAF6C5E81}.Release.Mac|x64.ActiveCfg = Release|x64
267269
{03769A07-F216-456B-886B-E07CAF6C5E81}.Release.Mac|x64.Build.0 = Release|x64
268270
{03769A07-F216-456B-886B-E07CAF6C5E81}.Release.Windows|x64.ActiveCfg = Release|x64
271+
{03769A07-F216-456B-886B-E07CAF6C5E81}.Release.Windows|x64.Build.0 = Release|x64
269272
{5A6656D5-81C7-472C-9DC8-32D071CB2258}.Debug.Mac|x64.ActiveCfg = Debug|x64
270273
{5A6656D5-81C7-472C-9DC8-32D071CB2258}.Debug.Windows|x64.ActiveCfg = Debug|x64
271274
{5A6656D5-81C7-472C-9DC8-32D071CB2258}.Debug.Windows|x64.Build.0 = Debug|x64
@@ -413,7 +416,7 @@ Global
413416
{FA273F69-5762-43D8-AEA1-B4F08090D624}.Debug.Windows|x64.ActiveCfg = Debug|x64
414417
{FA273F69-5762-43D8-AEA1-B4F08090D624}.Debug.Windows|x64.Build.0 = Debug|x64
415418
{FA273F69-5762-43D8-AEA1-B4F08090D624}.Release.Mac|x64.ActiveCfg = Release|x64
416-
{FA273F69-5762-43D8-AEA1-B4F08090D624}.Release.Mac|x64.Build.0 = Debug|x64
419+
{FA273F69-5762-43D8-AEA1-B4F08090D624}.Release.Mac|x64.Build.0 = Release|x64
417420
{FA273F69-5762-43D8-AEA1-B4F08090D624}.Release.Windows|x64.ActiveCfg = Release|x64
418421
{FA273F69-5762-43D8-AEA1-B4F08090D624}.Release.Windows|x64.Build.0 = Release|x64
419422
{4CC2A90D-D240-4382-B4BF-5E175515E492}.Debug.Mac|x64.ActiveCfg = Debug|x64
@@ -430,6 +433,8 @@ Global
430433
{AECEC217-2499-403D-B0BB-2962B9BE5970}.Release.Mac|x64.ActiveCfg = Release|x64
431434
{AECEC217-2499-403D-B0BB-2962B9BE5970}.Release.Windows|x64.ActiveCfg = Release|x64
432435
{AECEC217-2499-403D-B0BB-2962B9BE5970}.Release.Windows|x64.Build.0 = Release|x64
436+
{AECEC217-2499-403D-B0BB-2962B9BE5970}.Debug.Mac|x64.Build.0 = Debug|x64
437+
{AECEC217-2499-403D-B0BB-2962B9BE5970}.Release.Mac|x64.Build.0 = Release|x64
433438
{24D161E9-D1F0-4299-BBD3-5D940BEDD535}.Debug.Mac|x64.ActiveCfg = Debug|x64
434439
{24D161E9-D1F0-4299-BBD3-5D940BEDD535}.Debug.Windows|x64.ActiveCfg = Debug|x64
435440
{24D161E9-D1F0-4299-BBD3-5D940BEDD535}.Debug.Windows|x64.Build.0 = Debug|x64

GVFS/FastFetch/CheckoutStage.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ private void HandleAllFileDeleteOperations()
252252

253253
private void HandleAllFileAddOperations()
254254
{
255-
using (FastFetchLibGit2Repo repo = new FastFetchLibGit2Repo(this.tracer, this.enlistment.WorkingDirectoryRoot))
255+
using (FastFetchLibGit2Repo repo = new FastFetchLibGit2Repo(this.tracer, this.enlistment.WorkingDirectoryBackingRoot))
256256
{
257257
string availableBlob;
258258
while (this.AvailableBlobShas.TryTake(out availableBlob, Timeout.Infinite))

GVFS/FastFetch/FastFetch.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747

4848
<ItemGroup>
4949
<PackageReference Include="CommandLineParser" Version="2.1.1-beta" />
50-
<PackageReference Include="LibGit2Sharp.NativeBinaries" Version="1.0.165" />
50+
<PackageReference Include="LibGit2Sharp.NativeBinaries" Version="2.0.278" />
5151
<PackageReference Include="StyleCop.Analyzers" Version="1.0.2">
5252
<PrivateAssets>all</PrivateAssets>
5353
</PackageReference>

GVFS/FastFetch/GitEnlistment.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ public class GitEnlistment : Enlistment
88
{
99
private GitEnlistment(string repoRoot, string gitBinPath)
1010
: base(
11+
repoRoot,
1112
repoRoot,
1213
repoRoot,
1314
null,

GVFS/GVFS.Build/GVFS.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
<PropertyGroup Label="Parameters">
55
<GVFSVersion>0.2.173.2</GVFSVersion>
6-
<GitPackageVersion>2.20190312.1</GitPackageVersion>
6+
<GitPackageVersion>2.20190610.5</GitPackageVersion>
77
</PropertyGroup>
88

99
<PropertyGroup Label="DefaultSettings">

0 commit comments

Comments
 (0)