Update tests

上级 3e78e83b
using System;
using System.IO;
using System.Reflection;
using System.Text.RegularExpressions;
using LibGit2Sharp.Core;
using LibGit2Sharp.Tests.TestHelpers;
......@@ -64,12 +65,13 @@ public void LoadFromSpecifiedPath(string architecture)
var testDir = Path.GetDirectoryName(typeof(GlobalSettingsFixture).Assembly.Location);
var testAppExe = Path.Combine(testDir, $"NativeLibraryLoadTestApp.{architecture}.exe");
var tempDir = Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString());
var platformDir = Path.Combine(tempDir, "plat");
var platformDir = Path.Combine(tempDir, "plat", architecture);
var libraryPath = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "lib", "win32", architecture);
try
{
Directory.CreateDirectory(Path.Combine(platformDir, architecture));
File.Copy(Path.Combine(GlobalSettings.NativeLibraryPath, architecture, nativeDllFileName), Path.Combine(platformDir, architecture, nativeDllFileName));
Directory.CreateDirectory(platformDir);
File.Copy(Path.Combine(libraryPath, nativeDllFileName), Path.Combine(platformDir, nativeDllFileName));
var (output, exitCode) = ProcessHelper.RunProcess(testAppExe, arguments: $@"{NativeDllName.Name} ""{platformDir}""", workingDirectory: tempDir);
......
......@@ -11,7 +11,7 @@ public class TestApp
private static extern IntPtr GetModuleHandle(string path);
[DllImport("kernel32")]
private static extern int GetModuleFileName(IntPtr handle, [Out]StringBuilder path, int size);
private static extern int GetModuleFileName(IntPtr handle, [Out] StringBuilder path, int size);
static int Main(string[] args)
{
......@@ -23,7 +23,7 @@ static int Main(string[] args)
var moduleName = args[0];
var loadFromDirectory = args[1];
var expectedPath = Path.Combine(loadFromDirectory, (IntPtr.Size == 4) ? "x86" : "x64", moduleName + ".dll");
var expectedPath = Path.Combine(loadFromDirectory, moduleName + ".dll");
GlobalSettings.NativeLibraryPath = loadFromDirectory;
var isValid = Repository.IsValid(Path.GetTempPath());
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册