Skip to content

Commit

Permalink
BundleProbeTest: Enable disabled tests
Browse files Browse the repository at this point in the history
A few of the bundle probe tests were failing on Linux-musl-x64-release.
This change adjusts the test to circumvent the failure.

Fixes dotnet#35755
  • Loading branch information
swaroop-sridhar committed May 13, 2020
1 parent c3d7041 commit 2048e3c
Showing 1 changed file with 10 additions and 11 deletions.
21 changes: 10 additions & 11 deletions src/installer/test/Assets/TestProjects/BundleProbeTester/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,17 @@ namespace BundleProbeTester
{
public static class Program
{
// The return type on BundleProbeDelegate is byte instead of bool because
// using non-blitable bool type caused a failure (incorrect value) on linux-musl-x64.
// The bundle-probe callback is only called from native code in the product
// Therefore the type on this test is adjusted to circumvent the failure.
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
public delegate bool BundleProbeDelegate([MarshalAs(UnmanagedType.LPWStr)] string path, IntPtr size, IntPtr offset);
public delegate byte BundleProbeDelegate([MarshalAs(UnmanagedType.LPWStr)] string path, IntPtr size, IntPtr offset);

unsafe static bool Probe(BundleProbeDelegate bundleProbe, string path, bool isExpected)
{
Int64 size, offset;
bool exists = bundleProbe(path, (IntPtr)(&offset), (IntPtr)(&size));
bool exists = bundleProbe(path, (IntPtr)(&offset), (IntPtr)(&size)) != 0;

switch (exists, isExpected)
{
Expand All @@ -39,8 +43,6 @@ unsafe static bool Probe(BundleProbeDelegate bundleProbe, string path, bool isEx
case (false, false):
return true;
}

return false; // dummy
}

public static int Main(string[] args)
Expand Down Expand Up @@ -72,13 +74,10 @@ public static int Main(string[] args)
bool success =
Probe(bundleProbeDelegate, "BundleProbeTester.dll", isExpected: true) &&
Probe(bundleProbeDelegate, "BundleProbeTester.runtimeconfig.json", isExpected: true) &&
Probe(bundleProbeDelegate, "System.Private.CoreLib.dll", isExpected: true);
// The following test is failing on Linux-musl-x64-release.
// The test is temporarily disabled to keep rolling builds green until the bug is fixed.
// https://github.com/dotnet/runtime/issues/35755
// Probe(bundleProbeDelegate, "hostpolicy.dll", isExpected: false) &&
// Probe(bundleProbeDelegate, "--", isExpected: false) &&
// Probe(bundleProbeDelegate, "", isExpected: false);
Probe(bundleProbeDelegate, "System.Private.CoreLib.dll", isExpected: true) &&
Probe(bundleProbeDelegate, "hostpolicy.dll", isExpected: false) &&
Probe(bundleProbeDelegate, "--", isExpected: false) &&
Probe(bundleProbeDelegate, "", isExpected: false);

if (!success)
{
Expand Down

0 comments on commit 2048e3c

Please sign in to comment.