Skip to content

Commit

Permalink
Register/Unregister for offline I/O in functional tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jeschu1 authored and pmj committed Aug 5, 2019
1 parent 8ecfa36 commit 06f173a
Showing 1 changed file with 27 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using System;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;

namespace GVFS.FunctionalTests.Tests.EnlistmentPerTestCase
Expand All @@ -12,6 +13,26 @@ namespace GVFS.FunctionalTests.Tests.EnlistmentPerTestCase
[Category(Categories.ExtraCoverage)]
public class RepairTests : TestsWithEnlistmentPerTestCase
{
private const string PrjFSLibPath = "libPrjFSLib.dylib";

[OneTimeSetUp]
public void TurnOfflineIOOn()
{
if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
{
RegisterForOfflineIO();
}
}

[OneTimeTearDown]
public void TurnOfflineIOOff()
{
if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
{
UnregisterForOfflineIO();
}
}

[TestCase]
public void NoFixesNeeded()
{
Expand Down Expand Up @@ -154,6 +175,12 @@ public void FixesCorruptGitConfig()
this.Enlistment.MountGVFS();
}

[DllImport(PrjFSLibPath, EntryPoint = "PrjFS_RegisterForOfflineIO")]
private static extern uint RegisterForOfflineIO();

[DllImport(PrjFSLibPath, EntryPoint = "PrjFS_UnregisterForOfflineIO")]
private static extern uint UnregisterForOfflineIO();

private void CreateCorruptIndexAndRename(string indexPath, Action<FileStream, FileStream> corruptionAction)
{
string tempIndexPath = indexPath + ".lock";
Expand Down

0 comments on commit 06f173a

Please sign in to comment.