Skip to content

Commit

Permalink
Make host tests enable test-only behaviour for nethost first use
Browse files Browse the repository at this point in the history
  • Loading branch information
elinor-fung committed Aug 30, 2024
1 parent c9c3b79 commit ccdf005
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,6 @@ public void GetHostFxrPath_DotNetRootParameter(bool explicitLoad, bool useAssemb
}

[Theory]
[ActiveIssue("https://github.com/dotnet/runtime/issues/61131", TestPlatforms.OSX)]
[InlineData(true, false, true, false)]
[InlineData(true, false, true, true)]
[InlineData(true, false, false, false)]
Expand Down Expand Up @@ -183,7 +182,6 @@ public void GetHostFxrPath_HostFxrAlreadyLoaded()
}

[Theory]
[ActiveIssue("https://github.com/dotnet/runtime/issues/61131", TestPlatforms.OSX)]
[SkipOnPlatform(TestPlatforms.Windows, "This test targets the install_location config file which is only used on Linux and macOS.")]
[InlineData("{0}", false, true)]
[InlineData("{0}\n", false, true)]
Expand Down Expand Up @@ -249,7 +247,6 @@ public void GetHostFxrPath_InstallLocationFile(string value, bool shouldUseArchS
}

[Fact]
[ActiveIssue("https://github.com/dotnet/runtime/issues/61131", TestPlatforms.OSX)]
[SkipOnPlatform(TestPlatforms.Windows, "This test targets the install_location config file which is only used on Linux and macOS.")]
public void GetHostFxrPath_GlobalInstallation_HasNoDefaultInstallationPath()
{
Expand Down Expand Up @@ -280,7 +277,6 @@ public void GetHostFxrPath_GlobalInstallation_HasNoDefaultInstallationPath()
}

[Fact]
[ActiveIssue("https://github.com/dotnet/runtime/issues/61131", TestPlatforms.OSX)]
[SkipOnPlatform(TestPlatforms.Windows, "This test targets the install_location config file which is only used on Linux and macOS.")]
public void GetHostFxrPath_GlobalInstallation_ArchitectureSpecificPathIsPickedOverDefaultPath()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,12 @@ public SharedTestStateBase()
File.Copy(
Binaries.NetHost.FilePath,
NethostPath);

// Enable test-only behaviour for nethost. We always do this - even for tests that don't need the behaviour.
// On macOS with system integrity protection enabled, if a code-signed binary is loaded, modified (test-only
// behaviour rewrites part of the binary), and loaded again, the process will crash (Code Signature Invalid).
// We don't bother disabling it later, as we just delete the containing folder after tests run.
_ = TestOnlyProductBehavior.Enable(NethostPath);
}

public Command CreateNativeHostCommand(IEnumerable<string> args, string dotNetRoot)
Expand Down

0 comments on commit ccdf005

Please sign in to comment.