Skip to content

Commit

Permalink
PR feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
akoeplinger committed May 18, 2021
1 parent 723bfee commit ee0520a
Show file tree
Hide file tree
Showing 12 changed files with 39 additions and 206 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,44 +21,29 @@ public MultipleHives(SharedTestState sharedState)
}

[Fact]
[PlatformSpecific(TestPlatforms.Windows)] // Multiple hives are only supported on Windows.
public void FrameworkHiveSelection_GlobalHiveWithBetterMatch()
{
if (!OperatingSystem.IsWindows())
{
// Multiple hives are only supported on Windows.
return;
}

RunTest(
runtimeConfig => runtimeConfig
.WithFramework(MicrosoftNETCoreApp, "5.0.0"))
.ShouldHaveResolvedFramework(MicrosoftNETCoreApp, "5.1.2");
}

[Fact]
[PlatformSpecific(TestPlatforms.Windows)] // Multiple hives are only supported on Windows.
public void FrameworkHiveSelection_MainHiveWithBetterMatch()
{
if (!OperatingSystem.IsWindows())
{
// Multiple hives are only supported on Windows.
return;
}

RunTest(
runtimeConfig => runtimeConfig
.WithFramework(MicrosoftNETCoreApp, "6.0.0"))
.ShouldHaveResolvedFramework(MicrosoftNETCoreApp, "6.1.2");
}

[Fact]
[PlatformSpecific(TestPlatforms.Windows)] // Multiple hives are only supported on Windows.
public void FrameworkHiveSelection_CurrentDirectoryIsIgnored()
{
if (!OperatingSystem.IsWindows())
{
// Multiple hives are only supported on Windows.
return;
}

RunTest(
SharedState.DotNetMainHive,
SharedState.FrameworkReferenceApp,
Expand Down
35 changes: 5 additions & 30 deletions src/installer/tests/HostActivation.Tests/MultilevelSDKLookup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -89,14 +89,9 @@ public void Dispose()
}

[Fact]
[PlatformSpecific(TestPlatforms.Windows)] // Multi-level lookup is only supported on Windows.
public void SdkMultilevelLookup_Global_Json_Single_Digit_Patch_Rollup()
{
if (!OperatingSystem.IsWindows())
{
// Multi-level lookup is only supported on Windows.
return;
}

// Set specified SDK version = 9999.3.4-global-dummy
SetGlobalJsonVersion("SingleDigit-global.json");

Expand Down Expand Up @@ -264,14 +259,9 @@ public void SdkMultilevelLookup_Global_Json_Single_Digit_Patch_Rollup()
}

[Fact]
[PlatformSpecific(TestPlatforms.Windows)] // Multi-level lookup is only supported on Windows.
public void SdkMultilevelLookup_Global_Json_Two_Part_Patch_Rollup()
{
if (!OperatingSystem.IsWindows())
{
// Multi-level lookup is only supported on Windows.
return;
}

// Set specified SDK version = 9999.3.304-global-dummy
SetGlobalJsonVersion("TwoPart-global.json");

Expand Down Expand Up @@ -444,14 +434,9 @@ public void SdkMultilevelLookup_Global_Json_Two_Part_Patch_Rollup()
}

[Fact]
[PlatformSpecific(TestPlatforms.Windows)] // Multi-level lookup is only supported on Windows.
public void SdkMultilevelLookup_Precedential_Order()
{
if (!OperatingSystem.IsWindows())
{
// Multi-level lookup is only supported on Windows.
return;
}

WriteEmptyGlobalJson();

// Add SDK versions
Expand Down Expand Up @@ -498,6 +483,7 @@ public void SdkMultilevelLookup_Precedential_Order()
}

[Fact]
[PlatformSpecific(TestPlatforms.Windows)] // Multi-level lookup is only supported on Windows.
public void SdkMultilevelLookup_RegistryAccess()
{
// The purpose of this test is to verify that the product uses correct code to access
Expand All @@ -511,12 +497,6 @@ public void SdkMultilevelLookup_RegistryAccess()
// different registry key, inside the HKEY_CURRENT_USER hive which is writable without admin.
// Note that the test creates a unique key (based on PID) for every run, to avoid collisions between parallel running tests.

if (!OperatingSystem.IsWindows())
{
// Multi-level lookup is only supported on Windows.
return;
}

WriteEmptyGlobalJson();

using (var registeredInstallLocationOverride = new RegisteredInstallLocationOverride(DotNet.GreatestVersionHostFxrFilePath))
Expand Down Expand Up @@ -547,14 +527,9 @@ public void SdkMultilevelLookup_RegistryAccess()
}

[Fact]
[PlatformSpecific(TestPlatforms.Windows)] // Multi-level lookup is only supported on Windows.
public void SdkMultilevelLookup_Must_Pick_The_Highest_Semantic_Version()
{
if (!OperatingSystem.IsWindows())
{
// Multi-level lookup is only supported on Windows.
return;
}

WriteEmptyGlobalJson();

// Add SDK versions
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,14 +129,9 @@ public void Dispose()
}

[Fact]
[PlatformSpecific(TestPlatforms.Windows)] // Multi-level lookup is only supported on Windows.
public void SharedMultilevelFxLookup_Must_Verify_Folders_in_the_Correct_Order()
{
if (!OperatingSystem.IsWindows())
{
// Multi-level lookup is only supported on Windows.
return;
}

var fixture = SharedFxLookupPortableAppFixture
.Copy();

Expand Down Expand Up @@ -246,14 +241,9 @@ public void SharedMultilevelFxLookup_Must_Verify_Folders_in_the_Correct_Order()
}

[Fact]
[PlatformSpecific(TestPlatforms.Windows)] // Multi-level lookup is only supported on Windows.
public void SharedMultilevelFxLookup_Must_Not_Roll_Forward_If_Framework_Version_Is_Specified_Through_Argument()
{
if (!OperatingSystem.IsWindows())
{
// Multi-level lookup is only supported on Windows.
return;
}

var fixture = SharedFxLookupPortableAppFixture
.Copy();

Expand Down
21 changes: 3 additions & 18 deletions src/installer/tests/HostActivation.Tests/NativeHostApis.cs
Original file line number Diff line number Diff line change
Expand Up @@ -128,14 +128,9 @@ public SdkResolutionFixture(SharedTestState state)
}

[Fact]
[PlatformSpecific(TestPlatforms.Windows)] // Multi-level lookup is only supported on Windows.
public void Hostfxr_get_available_sdks_with_multilevel_lookup()
{
if (!OperatingSystem.IsWindows())
{
// multilevel lookup is not supported on non-Windows
return;
}

var f = new SdkResolutionFixture(sharedTestState);

// With multi-level lookup (windows only): get local and global sdks sorted by ascending version,
Expand Down Expand Up @@ -322,14 +317,9 @@ public void Hostfxr_get_dotnet_environment_info_dotnet_root_only()
}

[Fact]
[PlatformSpecific(TestPlatforms.Windows)] // Multi-level lookup is only supported on Windows.
public void Hostfxr_get_dotnet_environment_info_with_multilevel_lookup_with_dotnet_root()
{
if (!OperatingSystem.IsWindows())
{
// Only Windows supports multi-level lookup.
return;
}

var f = new SdkResolutionFixture(sharedTestState);
string expectedSdkVersions = string.Join(';', new[]
{
Expand Down Expand Up @@ -406,14 +396,9 @@ public void Hostfxr_get_dotnet_environment_info_with_multilevel_lookup_with_dotn
}

[Fact]
[PlatformSpecific(TestPlatforms.Windows)] // Multi-level lookup is only supported on Windows.
public void Hostfxr_get_dotnet_environment_info_with_multilevel_lookup_only()
{
if (!OperatingSystem.IsWindows())
{
// Only Windows supports multi-level lookup.
return;
}

var f = new SdkResolutionFixture(sharedTestState);
string expectedSdkVersions = string.Join(';', new[]
{
Expand Down
28 changes: 4 additions & 24 deletions src/installer/tests/HostActivation.Tests/NativeHosting/Comhost.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,12 @@ public Comhost(SharedTestState sharedTestState)
}

[Theory]
[PlatformSpecific(TestPlatforms.Windows)] // COM activation is only supported on Windows
[InlineData(1, true)]
[InlineData(10, true)]
[InlineData(10, false)]
public void ActivateClass(int count, bool synchronous)
{
if (!OperatingSystem.IsWindows())
{
// COM activation is only supported on Windows
return;
}

string [] args = {
"comhost",
synchronous ? "synchronous" : "concurrent",
Expand All @@ -54,14 +49,9 @@ public void ActivateClass(int count, bool synchronous)
}

[Fact]
[PlatformSpecific(TestPlatforms.Windows)] // COM activation is only supported on Windows
public void ActivateClass_IgnoreAppLocalHostFxr()
{
if (!OperatingSystem.IsWindows())
{
// COM activation is only supported on Windows
return;
}

using (var fixture = sharedState.ComLibraryFixture.Copy())
{
File.WriteAllText(Path.Combine(fixture.TestProject.BuiltApp.Location, "hostfxr.dll"), string.Empty);
Expand All @@ -87,14 +77,9 @@ public void ActivateClass_IgnoreAppLocalHostFxr()
}

[Fact]
[PlatformSpecific(TestPlatforms.Windows)] // COM activation is only supported on Windows
public void ActivateClass_ValidateIErrorInfoResult()
{
if (!OperatingSystem.IsWindows())
{
// COM activation is only supported on Windows
return;
}

using (var fixture = sharedState.ComLibraryFixture.Copy())
{
string missingRuntimeConfig = Path.Combine(fixture.TestProject.BuiltApp.Location,
Expand Down Expand Up @@ -122,14 +107,9 @@ public void ActivateClass_ValidateIErrorInfoResult()
}

[Fact]
[PlatformSpecific(TestPlatforms.Windows)] // COM activation is only supported on Windows
public void LoadTypeLibraries()
{
if (!OperatingSystem.IsWindows())
{
// COM activation is only supported on Windows
return;
}

using (var fixture = sharedState.ComLibraryFixture.Copy())
{
var comHost = Path.Combine(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,9 @@ public ComhostSideBySide(SharedTestState sharedTestState)
}

[Fact]
[PlatformSpecific(TestPlatforms.Windows)] // COM activation is only supported on Windows
public void ActivateClass()
{
if (!OperatingSystem.IsWindows())
{
// COM activation is only supported on Windows
return;
}

string [] args = {
"activation",
sharedState.ClsidString
Expand All @@ -47,14 +42,9 @@ public void ActivateClass()
}

[Fact]
[PlatformSpecific(TestPlatforms.Windows)] // COM activation is only supported on Windows
public void LocateEmbeddedTlb()
{
if (!OperatingSystem.IsWindows())
{
// COM activation is only supported on Windows
return;
}

string [] args = {
"typelib_lookup",
sharedState.TypeLibId
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,7 @@ public void GetHostFxrPath_HostFxrAlreadyLoaded()
}

[Theory]
[SkipOnPlatform(TestPlatforms.Windows, "This test targets the install_location config file which is only used on Linux and macOS.")]
[InlineData("{0}", true)]
[InlineData("{0}\n", true)]
[InlineData("{0}\nSome other text", true)]
Expand All @@ -189,12 +190,6 @@ public void GetHostFxrPath_HostFxrAlreadyLoaded()
[InlineData("{0} ", false)]
public void GetHostFxrPath_InstallLocationFile(string value, bool shouldPass)
{
if (OperatingSystem.IsWindows())
{
// This test targets the install_location config file which is only used on Linux and macOS.
return;
}

string installLocation = Path.Combine(sharedState.ValidInstallRoot, "dotnet");

using (var registeredInstallLocationOverride = new RegisteredInstallLocationOverride(sharedState.NethostPath))
Expand Down
20 changes: 3 additions & 17 deletions src/installer/tests/HostActivation.Tests/PortableAppActivation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -456,16 +456,11 @@ public void AppHost_CLI_FrameworkDependent_MissingRuntimeFramework_ErrorReported
}

[Theory]
[PlatformSpecific(TestPlatforms.Windows)] // GUI app host is only supported on Windows.
[InlineData(true)]
[InlineData(false)]
public void AppHost_GUI_FrameworkDependent_MissingRuntimeFramework_ErrorReportedInDialog(bool missingHostfxr)
{
if (!OperatingSystem.IsWindows())
{
// GUI app host is only supported on Windows.
return;
}

var fixture = sharedTestState.PortableAppFixture_Built
.Copy();

Expand Down Expand Up @@ -521,13 +516,9 @@ public void AppHost_GUI_FrameworkDependent_MissingRuntimeFramework_ErrorReported
}

[Fact]
[PlatformSpecific(TestPlatforms.Windows)] // GUI app host is only supported on Windows.
public void AppHost_GUI_NoCustomErrorWriter_FrameworkMissing_ErrorReportedInDialog()
{
if (!OperatingSystem.IsWindows())
{
return;
}

var fixture = sharedTestState.PortableAppFixture_Built
.Copy();

Expand Down Expand Up @@ -564,14 +555,9 @@ public void AppHost_GUI_NoCustomErrorWriter_FrameworkMissing_ErrorReportedInDial
}

[Fact]
[PlatformSpecific(TestPlatforms.Windows)] // GUI app host is only supported on Windows.
public void AppHost_GUI_FrameworkDependent_DisabledGUIErrors_DialogNotShown()
{
if (!OperatingSystem.IsWindows())
{
// GUI app host is only supported on Windows.
return;
}

var fixture = sharedTestState.PortableAppFixture_Built
.Copy();

Expand Down
Loading

0 comments on commit ee0520a

Please sign in to comment.