mirror of https://github.com/winsw/winsw
Fix tests (#1003)
parent
73b2539440
commit
f8d2ae567c
|
@ -27,7 +27,7 @@ namespace WinSW.Tests
|
||||||
Assert.Equal(ServiceControllerStatus.Stopped, controller.Status);
|
Assert.Equal(ServiceControllerStatus.Stopped, controller.Status);
|
||||||
Assert.Equal(ServiceType.Win32OwnProcess, controller.ServiceType);
|
Assert.Equal(ServiceType.Win32OwnProcess, controller.ServiceType);
|
||||||
|
|
||||||
#if NETFRAMEWORK
|
#if NET
|
||||||
InterProcessCodeCoverageSession session = null;
|
InterProcessCodeCoverageSession session = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
Windows.Win32.System.Diagnostics.Debug.DebugCreate
|
|
@ -6,6 +6,7 @@ using System.Runtime.InteropServices;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using Microsoft.Diagnostics.Runtime;
|
using Microsoft.Diagnostics.Runtime;
|
||||||
using Microsoft.Diagnostics.Runtime.Interop;
|
using Microsoft.Diagnostics.Runtime.Interop;
|
||||||
|
using Windows.Win32;
|
||||||
using WinSW.Native;
|
using WinSW.Native;
|
||||||
using Xunit;
|
using Xunit;
|
||||||
|
|
||||||
|
@ -36,20 +37,19 @@ namespace WinSW.Tests.Util
|
||||||
Assert.True(processId >= 0);
|
Assert.True(processId >= 0);
|
||||||
|
|
||||||
var guid = new Guid("27fe5639-8407-4f47-8364-ee118fb08ac8");
|
var guid = new Guid("27fe5639-8407-4f47-8364-ee118fb08ac8");
|
||||||
int hr = Native.DebugCreate(guid, out object unknown);
|
PInvoke.DebugCreate(guid, out object unknown).ThrowOnFailure();
|
||||||
AssertEx.Succeeded(hr);
|
|
||||||
|
|
||||||
var client = (IDebugClient)unknown;
|
var client = (IDebugClient)unknown;
|
||||||
this.control = (IDebugControl)unknown;
|
this.control = (IDebugControl)unknown;
|
||||||
|
|
||||||
hr = client.AttachProcess(0, (uint)processId, DEBUG_ATTACH.DEFAULT);
|
int hr = client.AttachProcess(0, (uint)processId, DEBUG_ATTACH.DEFAULT);
|
||||||
AssertEx.Succeeded(hr);
|
AssertEx.Succeeded(hr);
|
||||||
|
|
||||||
hr = client.SetEventCallbacks(this);
|
hr = client.SetEventCallbacks(this);
|
||||||
AssertEx.Succeeded(hr);
|
AssertEx.Succeeded(hr);
|
||||||
|
|
||||||
var pointer = Marshal.GetIUnknownForObject(client);
|
var pointer = Marshal.GetIUnknownForObject(client);
|
||||||
Assert.Equal(1, Marshal.Release(pointer));
|
Assert.Equal(3, Marshal.Release(pointer));
|
||||||
|
|
||||||
target = DataTarget.CreateFromDbgEng(pointer);
|
target = DataTarget.CreateFromDbgEng(pointer);
|
||||||
|
|
||||||
|
@ -181,11 +181,5 @@ namespace WinSW.Tests.Util
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
throw new NotImplementedException();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static class Native
|
|
||||||
{
|
|
||||||
[DllImport("dbgeng.dll")]
|
|
||||||
internal static extern int DebugCreate(in Guid InterfaceId, [MarshalAs(UnmanagedType.IUnknown)] out object Interface);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,6 +13,10 @@
|
||||||
<PackageReference Include="Microsoft.Diagnostics.Runtime" Version="2.0.226801" />
|
<PackageReference Include="Microsoft.Diagnostics.Runtime" Version="2.0.226801" />
|
||||||
<PackageReference Include="Microsoft.Diagnostics.Runtime.Utilities" Version="2.0.0-rc.20303.3" />
|
<PackageReference Include="Microsoft.Diagnostics.Runtime.Utilities" Version="2.0.0-rc.20303.3" />
|
||||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.4.1" />
|
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.4.1" />
|
||||||
|
<PackageReference Include="Microsoft.Windows.CsWin32" Version="0.2.188-beta">
|
||||||
|
<PrivateAssets>all</PrivateAssets>
|
||||||
|
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
|
||||||
|
</PackageReference>
|
||||||
<PackageReference Include="xunit" Version="2.4.2" />
|
<PackageReference Include="xunit" Version="2.4.2" />
|
||||||
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.5">
|
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.5">
|
||||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||||
|
|
Loading…
Reference in New Issue