Skip to content

Commit 9a9a297

Browse files
committed
Update tests
1 parent 3e78e83 commit 9a9a297

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

Diff for: LibGit2Sharp.Tests/GlobalSettingsFixture.cs

+5-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
using System;
22
using System.IO;
3+
using System.Reflection;
34
using System.Text.RegularExpressions;
45
using LibGit2Sharp.Core;
56
using LibGit2Sharp.Tests.TestHelpers;
@@ -64,12 +65,13 @@ public void LoadFromSpecifiedPath(string architecture)
6465
var testDir = Path.GetDirectoryName(typeof(GlobalSettingsFixture).Assembly.Location);
6566
var testAppExe = Path.Combine(testDir, $"NativeLibraryLoadTestApp.{architecture}.exe");
6667
var tempDir = Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString());
67-
var platformDir = Path.Combine(tempDir, "plat");
68+
var platformDir = Path.Combine(tempDir, "plat", architecture);
69+
var libraryPath = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "lib", "win32", architecture);
6870

6971
try
7072
{
71-
Directory.CreateDirectory(Path.Combine(platformDir, architecture));
72-
File.Copy(Path.Combine(GlobalSettings.NativeLibraryPath, architecture, nativeDllFileName), Path.Combine(platformDir, architecture, nativeDllFileName));
73+
Directory.CreateDirectory(platformDir);
74+
File.Copy(Path.Combine(libraryPath, nativeDllFileName), Path.Combine(platformDir, nativeDllFileName));
7375

7476
var (output, exitCode) = ProcessHelper.RunProcess(testAppExe, arguments: $@"{NativeDllName.Name} ""{platformDir}""", workingDirectory: tempDir);
7577

Diff for: NativeLibraryLoadTestApp/TestApp.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ public class TestApp
1111
private static extern IntPtr GetModuleHandle(string path);
1212

1313
[DllImport("kernel32")]
14-
private static extern int GetModuleFileName(IntPtr handle, [Out]StringBuilder path, int size);
14+
private static extern int GetModuleFileName(IntPtr handle, [Out] StringBuilder path, int size);
1515

1616
static int Main(string[] args)
1717
{
@@ -23,7 +23,7 @@ static int Main(string[] args)
2323

2424
var moduleName = args[0];
2525
var loadFromDirectory = args[1];
26-
var expectedPath = Path.Combine(loadFromDirectory, (IntPtr.Size == 4) ? "x86" : "x64", moduleName + ".dll");
26+
var expectedPath = Path.Combine(loadFromDirectory, moduleName + ".dll");
2727

2828
GlobalSettings.NativeLibraryPath = loadFromDirectory;
2929
var isValid = Repository.IsValid(Path.GetTempPath());

0 commit comments

Comments
 (0)