Skip to content

Commit

Permalink
Try test with getppid on all platforms
Browse files Browse the repository at this point in the history
  • Loading branch information
am11 committed Nov 17, 2022
1 parent 7a19e63 commit de8eced
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,14 @@

public static class MainProgramHandleTests
{
private static IntPtr s_handle;

static MainProgramHandleTests() => NativeLibrary.SetDllImportResolver(typeof(MainProgramHandleTests).Assembly,
(string libraryName, Assembly asm, DllImportSearchPath? dllImportSearchPath) =>
{
if (libraryName == "Self")
{
s_handle = NativeLibrary.GetMainProgramHandle();
Assert.NotEqual(IntPtr.Zero, s_handle);
return s_handle;
IntPtr handle = NativeLibrary.GetMainProgramHandle();
Assert.NotEqual(IntPtr.Zero, handle);
return handle;
}
return IntPtr.Zero;
Expand All @@ -30,7 +28,8 @@ public static int Main()
{
try
{
free(s_handle);
int parentPid = getppid();
Console.WriteLine("Parent PID is: {0}", parentPid);
}
catch (Exception e)
{
Expand All @@ -42,5 +41,5 @@ public static int Main()
}

[DllImport("Self")]
private static extern int free(IntPtr arg);
private static extern int getppid();
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
<PropertyGroup>
<OutputType>Exe</OutputType>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<CLRTestTargetUnsupported Condition="'$(TargetsWindows)' == 'true' or '$(RuntimeVariant)' == 'monointerpreter'">true</CLRTestTargetUnsupported>
</PropertyGroup>
<ItemGroup>
<Compile Include="MainProgramHandleTests.cs" />
Expand Down
3 changes: 0 additions & 3 deletions src/tests/issues.targets
Original file line number Diff line number Diff line change
Expand Up @@ -2606,9 +2606,6 @@
<ExcludeList Include = "$(XunitTestBinBase)/Interop/StructMarshalling/ReversePInvoke/MarshalSeqStruct/DelegatePInvoke/DelegatePInvokeTest/**">
<Issue>needs triage</Issue>
</ExcludeList>
<ExcludeList Include = "$(XunitTestBinBase)/Interop/NativeLibrary/MainProgramHandle/**">
<Issue>needs triage</Issue>
</ExcludeList>
<ExcludeList Include = "$(XunitTestBinBase)/JIT/Methodical/eh/basics/throwinfilter_il_d/**">
<Issue>https://github.com/dotnet/runtime/issues/47624</Issue>
</ExcludeList>
Expand Down

0 comments on commit de8eced

Please sign in to comment.