diff --git a/src/installer/Directory.Build.props b/src/installer/Directory.Build.props
index 2f7d4509559b79..abbe660a544c63 100644
--- a/src/installer/Directory.Build.props
+++ b/src/installer/Directory.Build.props
@@ -13,5 +13,12 @@
The NuGet fallback folder can/will contain packages we are building in this repo, and we
want to ensure we use the correct packages. -->
true
+ true
+
+
+
+
+ true
+ false
diff --git a/src/installer/Directory.Build.targets b/src/installer/Directory.Build.targets
index 61e65f141cedab..e18a6616b8ad36 100644
--- a/src/installer/Directory.Build.targets
+++ b/src/installer/Directory.Build.targets
@@ -1,5 +1,7 @@
+
+
$(InstallerName)
@@ -23,8 +25,6 @@
-->
-
-
diff --git a/src/installer/pkg/sfx/Directory.Build.props b/src/installer/pkg/sfx/Directory.Build.props
index d94eaac42dbd2f..04c7177930cd61 100644
--- a/src/installer/pkg/sfx/Directory.Build.props
+++ b/src/installer/pkg/sfx/Directory.Build.props
@@ -1,6 +1,7 @@
true
+ true
diff --git a/src/installer/pkg/sfx/Microsoft.NETCore.App/Microsoft.NETCore.App.Runtime.props b/src/installer/pkg/sfx/Microsoft.NETCore.App/Microsoft.NETCore.App.Runtime.props
index f64d11dfae3551..db017617784bac 100644
--- a/src/installer/pkg/sfx/Microsoft.NETCore.App/Microsoft.NETCore.App.Runtime.props
+++ b/src/installer/pkg/sfx/Microsoft.NETCore.App/Microsoft.NETCore.App.Runtime.props
@@ -86,7 +86,6 @@
-
diff --git a/src/installer/tests/AppHost.Bundle.Tests/AppHost.Bundle.Tests.csproj b/src/installer/tests/AppHost.Bundle.Tests/AppHost.Bundle.Tests.csproj
index 13a9b59f64feb7..51433527076fd0 100644
--- a/src/installer/tests/AppHost.Bundle.Tests/AppHost.Bundle.Tests.csproj
+++ b/src/installer/tests/AppHost.Bundle.Tests/AppHost.Bundle.Tests.csproj
@@ -2,6 +2,8 @@
Apphost Bundle Tests
+ Exe
+ $(TargetRid)
$(TestInfraTargetFramework)
AppHost.Bundle.Tests
true
@@ -9,7 +11,8 @@
ahb
- $(NoWarn);NU1511
+ $(NoWarn);NU1511;xUnit1004
+ XUnitV3
diff --git a/src/installer/tests/AppHost.Bundle.Tests/AppLaunch.cs b/src/installer/tests/AppHost.Bundle.Tests/AppLaunch.cs
index 67179e1577a625..121d390fe09b7b 100644
--- a/src/installer/tests/AppHost.Bundle.Tests/AppLaunch.cs
+++ b/src/installer/tests/AppHost.Bundle.Tests/AppLaunch.cs
@@ -27,7 +27,7 @@ private void RunTheApp(string path, bool selfContained)
Command.Create(path)
.CaptureStdErr()
.CaptureStdOut()
- .DotNetRoot(selfContained ? null : TestContext.BuiltDotNet.BinPath)
+ .DotNetRoot(selfContained ? null : HostTestContext.BuiltDotNet.BinPath)
.Execute()
.Should().Pass()
.And.HaveStdOutContaining("Hello World!");
@@ -75,9 +75,9 @@ private void RunApp(bool selfContained)
if (OperatingSystem.IsWindows())
{
// StandaloneApp sets FileVersion to NETCoreApp version. On Windows, this should be copied to singlefilehost resources.
- string expectedVersion = TestContext.MicrosoftNETCoreAppVersion.Contains('-')
- ? TestContext.MicrosoftNETCoreAppVersion[..TestContext.MicrosoftNETCoreAppVersion.IndexOf('-')]
- : TestContext.MicrosoftNETCoreAppVersion;
+ string expectedVersion = HostTestContext.MicrosoftNETCoreAppVersion.Contains('-')
+ ? HostTestContext.MicrosoftNETCoreAppVersion[..HostTestContext.MicrosoftNETCoreAppVersion.IndexOf('-')]
+ : HostTestContext.MicrosoftNETCoreAppVersion;
Assert.Equal(expectedVersion, System.Diagnostics.FileVersionInfo.GetVersionInfo(singleFile).FileVersion);
}
}
@@ -103,14 +103,17 @@ private void NonAsciiCharacterSelfContainedApp()
if (OperatingSystem.IsWindows())
{
// StandaloneApp sets FileVersion to NETCoreApp version. On Windows, this should be copied to singlefilehost resources.
- string expectedVersion = TestContext.MicrosoftNETCoreAppVersion.Contains('-')
- ? TestContext.MicrosoftNETCoreAppVersion[..TestContext.MicrosoftNETCoreAppVersion.IndexOf('-')]
- : TestContext.MicrosoftNETCoreAppVersion;
+ string expectedVersion = HostTestContext.MicrosoftNETCoreAppVersion.Contains('-')
+ ? HostTestContext.MicrosoftNETCoreAppVersion[..HostTestContext.MicrosoftNETCoreAppVersion.IndexOf('-')]
+ : HostTestContext.MicrosoftNETCoreAppVersion;
Assert.Equal(expectedVersion, System.Diagnostics.FileVersionInfo.GetVersionInfo(singleFile).FileVersion);
}
}
- [ConditionalTheory(typeof(Binaries.CetCompat), nameof(Binaries.CetCompat.IsSupported))]
+ [Theory(
+ SkipType = typeof(Binaries.CetCompat),
+ SkipUnless = nameof(Binaries.CetCompat.IsSupported),
+ Skip = "CET is not supported on this platform")]
[InlineData(true)]
[InlineData(false)]
public void DisableCetCompat(bool selfContained)
@@ -124,12 +127,12 @@ public void DisableCetCompat(bool selfContained)
Command.Create(singleFile)
.CaptureStdErr()
.CaptureStdOut()
- .DotNetRoot(TestContext.BuiltDotNet.BinPath, TestContext.BuildArchitecture)
+ .DotNetRoot(HostTestContext.BuiltDotNet.BinPath, HostTestContext.BuildArchitecture)
.MultilevelLookup(false)
.Execute()
.Should().Pass()
.And.HaveStdOutContaining("Hello World")
- .And.HaveStdOutContaining(TestContext.MicrosoftNETCoreAppVersion);
+ .And.HaveStdOutContaining(HostTestContext.MicrosoftNETCoreAppVersion);
}
[Theory]
@@ -158,7 +161,7 @@ public void FrameworkDependent_NoBundleEntryPoint()
using (var dotnetWithMockHostFxr = TestArtifact.Create("mockhostfxrFrameworkMissingFailure"))
{
- var dotnet = new DotNetBuilder(dotnetWithMockHostFxr.Location, TestContext.BuiltDotNet.BinPath, null)
+ var dotnet = new DotNetBuilder(dotnetWithMockHostFxr.Location, HostTestContext.BuiltDotNet.BinPath, null)
.RemoveHostFxr()
.AddMockHostFxr(new Version(2, 2, 0))
.Build();
@@ -177,7 +180,7 @@ public void FrameworkDependent_NoBundleEntryPoint()
}
[Fact]
- [PlatformSpecific(TestPlatforms.Windows)] // GUI app host is only supported on Windows.
+ [PlatformSpecific(TestPlatforms.Windows)]
public void FrameworkDependent_GUI_DownlevelHostFxr_ErrorDialog()
{
var singleFile = sharedTestState.FrameworkDependentApp.Bundle();
@@ -188,14 +191,14 @@ public void FrameworkDependent_GUI_DownlevelHostFxr_ErrorDialog()
{
string expectedErrorCode = Constants.ErrorCode.BundleExtractionFailure.ToString("x");
- var dotnet = new DotNetBuilder(dotnetWithMockHostFxr.Location, TestContext.BuiltDotNet.BinPath, null)
+ var dotnet = new DotNetBuilder(dotnetWithMockHostFxr.Location, HostTestContext.BuiltDotNet.BinPath, null)
.RemoveHostFxr()
.AddMockHostFxr(new Version(5, 0, 0))
.Build();
Command command = Command.Create(singleFile)
.EnableTracingAndCaptureOutputs()
- .DotNetRoot(dotnet.BinPath, TestContext.BuildArchitecture)
+ .DotNetRoot(dotnet.BinPath, HostTestContext.BuildArchitecture)
.Start();
WindowsUtils.WaitForPopupFromProcess(command.Process);
diff --git a/src/installer/tests/AppHost.Bundle.Tests/BundledAppWithSubDirs.cs b/src/installer/tests/AppHost.Bundle.Tests/BundledAppWithSubDirs.cs
index 05381dc87d440e..9150d1e7885394 100644
--- a/src/installer/tests/AppHost.Bundle.Tests/BundledAppWithSubDirs.cs
+++ b/src/installer/tests/AppHost.Bundle.Tests/BundledAppWithSubDirs.cs
@@ -24,7 +24,7 @@ private FluentAssertions.AndConstraint RunTheApp(string
{
CommandResult result = Command.Create(path)
.EnableTracingAndCaptureOutputs()
- .DotNetRoot(selfContained ? null : TestContext.BuiltDotNet.BinPath)
+ .DotNetRoot(selfContained ? null : HostTestContext.BuiltDotNet.BinPath)
.MultilevelLookup(false)
.Execute();
if (deleteApp)
@@ -142,8 +142,7 @@ public void FrameworkDependent_Targeting50(BundleOptions options)
}
}
- [Fact]
- [ActiveIssue("https://github.com/dotnet/runtime/issues/54234")]
+ [Fact(Skip = "https://github.com/dotnet/runtime/issues/54234")]
// NOTE: when enabling this test take a look at commented code marked by "ACTIVE ISSUE:" in SharedTestState
public void SelfContained_R2R_Composite()
{
diff --git a/src/installer/tests/AppHost.Bundle.Tests/NativeLibraries.cs b/src/installer/tests/AppHost.Bundle.Tests/NativeLibraries.cs
index 627c3e15da0b8b..f3ef14d0260826 100644
--- a/src/installer/tests/AppHost.Bundle.Tests/NativeLibraries.cs
+++ b/src/installer/tests/AppHost.Bundle.Tests/NativeLibraries.cs
@@ -38,7 +38,7 @@ private void PInvoke(bool selfContained, bool bundleNative)
Command.Create(app, "load_native_library_pinvoke")
.CaptureStdErr()
.CaptureStdOut()
- .DotNetRoot(selfContained ? null : TestContext.BuiltDotNet.BinPath)
+ .DotNetRoot(selfContained ? null : HostTestContext.BuiltDotNet.BinPath)
// Specify an extraction root that will get cleaned up by the test app artifact
.EnvironmentVariable(Constants.BundleExtractBase.EnvironmentVariable, extractionRoot)
.Execute()
@@ -66,7 +66,7 @@ private void TryLoad(bool selfContained, bool bundleNative)
Command.Create(app, "load_native_library_api")
.CaptureStdErr()
.CaptureStdOut()
- .DotNetRoot(selfContained ? null : TestContext.BuiltDotNet.BinPath)
+ .DotNetRoot(selfContained ? null : HostTestContext.BuiltDotNet.BinPath)
// Specify an extraction root that will get cleaned up by the test app artifact
.EnvironmentVariable(Constants.BundleExtractBase.EnvironmentVariable, extractionRoot)
.Execute()
diff --git a/src/installer/tests/Assets/Projects/Directory.Build.targets b/src/installer/tests/Assets/Projects/Directory.Build.targets
index a1523bc1e38ea0..de9c2450f0f963 100644
--- a/src/installer/tests/Assets/Projects/Directory.Build.targets
+++ b/src/installer/tests/Assets/Projects/Directory.Build.targets
@@ -1,6 +1,4 @@
-
-
diff --git a/src/installer/tests/Directory.Build.props b/src/installer/tests/Directory.Build.props
index e56691554aaae4..f0c55d9d571149 100644
--- a/src/installer/tests/Directory.Build.props
+++ b/src/installer/tests/Directory.Build.props
@@ -4,12 +4,11 @@
$(ArtifactsDir)tests\host\$(TargetOS).$(TargetArchitecture).$(Configuration)\
$(NetCoreAppToolCurrent)
- category!=failing
- --filter $(TestCaseFilter) -v detailed
+ /[category!=failing]
+ --filter-query $(TestCaseFilter)
- $(TestRunnerAdditionalArguments) --blame-crash-dump-type full
- $(TestRunnerAdditionalArguments) --blame-hang-timeout 5m --blame-hang-dump-type full
- true
+ $(TestRunnerAdditionalArguments) --crashdump
+ $(TestRunnerAdditionalArguments) --hangdump --hangdump-timeout 5m --hangdump-type full
false
diff --git a/src/installer/tests/Directory.Build.targets b/src/installer/tests/Directory.Build.targets
index 098f499376ffed..e4218ebb7b53f4 100644
--- a/src/installer/tests/Directory.Build.targets
+++ b/src/installer/tests/Directory.Build.targets
@@ -92,6 +92,11 @@
$(TestCaseFilter)
+
+
+
+
+
diff --git a/src/installer/tests/HostActivation.Tests/Breadcrumbs.cs b/src/installer/tests/HostActivation.Tests/Breadcrumbs.cs
index 4997a574ad983c..df8451274823fe 100644
--- a/src/installer/tests/HostActivation.Tests/Breadcrumbs.cs
+++ b/src/installer/tests/HostActivation.Tests/Breadcrumbs.cs
@@ -22,7 +22,7 @@ public Breadcrumbs(SharedTestState fixture)
[Fact]
public void BreadcrumbThreadFinishes()
{
- TestContext.BuiltDotNet.Exec(sharedTestState.App.AppDll)
+ HostTestContext.BuiltDotNet.Exec(sharedTestState.App.AppDll)
.EnvironmentVariable(Constants.Breadcrumbs.EnvironmentVariable, sharedTestState.BreadcrumbLocation)
.EnableTracingAndCaptureOutputs()
.Execute()
@@ -34,7 +34,7 @@ public void BreadcrumbThreadFinishes()
[Fact]
public void UnhandledException_BreadcrumbThreadDoesNotFinish()
{
- TestContext.BuiltDotNet.Exec(sharedTestState.App.AppDll, "throw_exception")
+ HostTestContext.BuiltDotNet.Exec(sharedTestState.App.AppDll, "throw_exception")
.EnvironmentVariable(Constants.Breadcrumbs.EnvironmentVariable, sharedTestState.BreadcrumbLocation)
.EnableTracingAndCaptureOutputs()
.DisableDumps() // Expected to throw an exception
diff --git a/src/installer/tests/HostActivation.Tests/DependencyResolution/AdditionalProbingPath.cs b/src/installer/tests/HostActivation.Tests/DependencyResolution/AdditionalProbingPath.cs
index 4914f5b7b95a4d..e4732fc5726bf8 100644
--- a/src/installer/tests/HostActivation.Tests/DependencyResolution/AdditionalProbingPath.cs
+++ b/src/installer/tests/HostActivation.Tests/DependencyResolution/AdditionalProbingPath.cs
@@ -111,24 +111,24 @@ public class SharedTestState : SharedTestStateBase
public SharedTestState()
{
DotNetWithNetCoreApp = DotNet("WithNetCoreApp")
- .AddMicrosoftNETCoreAppFrameworkMockCoreClr(TestContext.MicrosoftNETCoreAppVersion)
+ .AddMicrosoftNETCoreAppFrameworkMockCoreClr(HostTestContext.MicrosoftNETCoreAppVersion)
.Build();
- string nativeDependencyRelPath = $"{TestContext.BuildRID}/{Binaries.GetSharedLibraryFileNameForCurrentPlatform("native")}";
- FrameworkReferenceApp = CreateFrameworkReferenceApp(Constants.MicrosoftNETCoreApp, TestContext.MicrosoftNETCoreAppVersion, b => b
+ string nativeDependencyRelPath = $"{HostTestContext.BuildRID}/{Binaries.GetSharedLibraryFileNameForCurrentPlatform("native")}";
+ FrameworkReferenceApp = CreateFrameworkReferenceApp(Constants.MicrosoftNETCoreApp, HostTestContext.MicrosoftNETCoreAppVersion, b => b
.WithProject(DependencyName, DependencyVersion, p => p
.WithAssemblyGroup(null, g => g
.WithAsset($"{DependencyName}.dll", f => f.NotOnDisk()))
- .WithNativeLibraryGroup(TestContext.BuildRID, g => g
+ .WithNativeLibraryGroup(HostTestContext.BuildRID, g => g
.WithAsset(nativeDependencyRelPath, f => f.NotOnDisk()))));
RuntimeConfig.FromFile(FrameworkReferenceApp.RuntimeConfigJson)
- .WithTfm(TestContext.Tfm)
+ .WithTfm(HostTestContext.Tfm)
.Save();
AdditionalProbingPath = Path.Combine(Location, "probe");
(DependencyPath, NativeDependencyDirectory) = AddDependencies(AdditionalProbingPath);
- AdditionalProbingPath_ArchTfm = Path.Combine(AdditionalProbingPath, TestContext.BuildArchitecture, TestContext.Tfm);
+ AdditionalProbingPath_ArchTfm = Path.Combine(AdditionalProbingPath, HostTestContext.BuildArchitecture, HostTestContext.Tfm);
(DependencyPath_ArchTfm, NativeDependencyDirectory_ArchTfm) = AddDependencies(AdditionalProbingPath_ArchTfm);
(string, string) AddDependencies(string probeDir)
diff --git a/src/installer/tests/HostActivation.Tests/DependencyResolution/DepsFile.cs b/src/installer/tests/HostActivation.Tests/DependencyResolution/DepsFile.cs
index 69bd09bb93063a..cf4eff1807b17b 100644
--- a/src/installer/tests/HostActivation.Tests/DependencyResolution/DepsFile.cs
+++ b/src/installer/tests/HostActivation.Tests/DependencyResolution/DepsFile.cs
@@ -92,10 +92,10 @@ public class SharedTestState : SharedTestStateBase
public SharedTestState()
{
DotNetWithNetCoreApp = DotNet("WithNetCoreApp")
- .AddMicrosoftNETCoreAppFrameworkMockCoreClr(TestContext.MicrosoftNETCoreAppVersion)
+ .AddMicrosoftNETCoreAppFrameworkMockCoreClr(HostTestContext.MicrosoftNETCoreAppVersion)
.Build();
- FrameworkReferenceApp = CreateFrameworkReferenceApp(Constants.MicrosoftNETCoreApp, TestContext.MicrosoftNETCoreAppVersion, b => b
+ FrameworkReferenceApp = CreateFrameworkReferenceApp(Constants.MicrosoftNETCoreApp, HostTestContext.MicrosoftNETCoreAppVersion, b => b
.WithProject(DependencyName, "1.0.0", p => p
.WithAssemblyGroup(null, g => g.WithAsset($"{DependencyName}.dll"))));
diff --git a/src/installer/tests/HostActivation.Tests/DependencyResolution/LocalPath.cs b/src/installer/tests/HostActivation.Tests/DependencyResolution/LocalPath.cs
index bad9c83eacede9..3bd1dcb7e53c80 100644
--- a/src/installer/tests/HostActivation.Tests/DependencyResolution/LocalPath.cs
+++ b/src/installer/tests/HostActivation.Tests/DependencyResolution/LocalPath.cs
@@ -66,8 +66,8 @@ private void RuntimeAssemblies(bool isSelfContained, bool useLocalPath)
{
// Add RID-specific assembly
(string ridPath, string localRidPath) = GetPaths(libraryType, true);
- b.WithRuntimeLibrary(libraryType, $"{library}-{TestContext.BuildRID}", "1.0.0", p => p
- .WithAssemblyGroup(TestContext.BuildRID, g => g
+ b.WithRuntimeLibrary(libraryType, $"{library}-{HostTestContext.BuildRID}", "1.0.0", p => p
+ .WithAssemblyGroup(HostTestContext.BuildRID, g => g
.WithAsset(ridPath, useLocalPath ? f => f.WithLocalPath(localRidPath) : null)));
}
}
@@ -114,7 +114,7 @@ private void RuntimeAssemblies(bool isSelfContained, bool useLocalPath)
static (string Path, string LocalPath) GetPaths(RuntimeLibraryType libraryType, bool useRid)
{
string library = $"Test{libraryType}";
- string path = useRid ? $"lib/{TestContext.BuildRID}/{library}-{TestContext.BuildRID}.dll" : $"lib/{library}.dll";
+ string path = useRid ? $"lib/{HostTestContext.BuildRID}/{library}-{HostTestContext.BuildRID}.dll" : $"lib/{library}.dll";
return (path, $"{libraryType}/{path}");
}
}
@@ -137,9 +137,9 @@ private void NativeLibraries(bool isSelfContained, bool useLocalPath)
{
// Add RID-specific native library
(string ridPath, string localRidPath) = GetPaths(libraryType, true);
- b.WithRuntimeLibrary(libraryType, $"{library}-{TestContext.BuildRID}", "1.0.0", p => p
- .WithNativeLibraryGroup(TestContext.BuildRID, g => g
- .WithAsset($"{ridPath}/{library}-{TestContext.BuildRID}.native", useLocalPath ? f => f.WithLocalPath($"{localRidPath}/{library}-{TestContext.BuildRID}.native") : null)));
+ b.WithRuntimeLibrary(libraryType, $"{library}-{HostTestContext.BuildRID}", "1.0.0", p => p
+ .WithNativeLibraryGroup(HostTestContext.BuildRID, g => g
+ .WithAsset($"{ridPath}/{library}-{HostTestContext.BuildRID}.native", useLocalPath ? f => f.WithLocalPath($"{localRidPath}/{library}-{HostTestContext.BuildRID}.native") : null)));
}
}
@@ -184,7 +184,7 @@ private void NativeLibraries(bool isSelfContained, bool useLocalPath)
static (string Path, string LocalPath) GetPaths(NetCoreAppBuilder.RuntimeLibraryType libraryType, bool useRid)
{
- string path = useRid ? $"native/{TestContext.BuildRID}" : "native";
+ string path = useRid ? $"native/{HostTestContext.BuildRID}" : "native";
return (path, $"{libraryType}/{path}");
}
}
@@ -245,7 +245,7 @@ private static TestApp CreateApp(bool isSelfContained, Action
}
else
{
- app.PopulateFrameworkDependent(Constants.MicrosoftNETCoreApp, TestContext.MicrosoftNETCoreAppVersion, customizer);
+ app.PopulateFrameworkDependent(Constants.MicrosoftNETCoreApp, HostTestContext.MicrosoftNETCoreAppVersion, customizer);
}
return app;
}
@@ -257,7 +257,7 @@ public class SharedTestState : SharedTestStateBase
public SharedTestState()
{
DotNetWithNetCoreApp = DotNet("WithNetCoreApp")
- .AddMicrosoftNETCoreAppFrameworkMockCoreClr(TestContext.MicrosoftNETCoreAppVersion)
+ .AddMicrosoftNETCoreAppFrameworkMockCoreClr(HostTestContext.MicrosoftNETCoreAppVersion)
.Build();
}
}
diff --git a/src/installer/tests/HostActivation.Tests/DependencyResolution/PerAssemblyVersionResolutionMultipleFrameworks.cs b/src/installer/tests/HostActivation.Tests/DependencyResolution/PerAssemblyVersionResolutionMultipleFrameworks.cs
index 9367927ffb5588..2e158aa8559763 100644
--- a/src/installer/tests/HostActivation.Tests/DependencyResolution/PerAssemblyVersionResolutionMultipleFrameworks.cs
+++ b/src/installer/tests/HostActivation.Tests/DependencyResolution/PerAssemblyVersionResolutionMultipleFrameworks.cs
@@ -105,7 +105,7 @@ protected override void CustomizeDotNetWithNetCoreApp(DotNetBuilder builder)
HighWare,
"1.1.1",
runtimeConfig => runtimeConfig.WithFramework(Constants.MicrosoftNETCoreApp, "4.0.0"),
- path => NetCoreAppBuilder.ForNETCoreApp(HighWare, TestContext.BuildRID)
+ path => NetCoreAppBuilder.ForNETCoreApp(HighWare, HostTestContext.BuildRID)
.WithProject(HighWare, "1.1.1", p => p
.WithAssemblyGroup(null, g => g
.WithAsset(TestAssemblyWithNoVersions + ".dll")
diff --git a/src/installer/tests/HostActivation.Tests/DependencyResolution/RidAssetResolution.cs b/src/installer/tests/HostActivation.Tests/DependencyResolution/RidAssetResolution.cs
index 3305b9e1d30908..23217d0b5069d4 100644
--- a/src/installer/tests/HostActivation.Tests/DependencyResolution/RidAssetResolution.cs
+++ b/src/installer/tests/HostActivation.Tests/DependencyResolution/RidAssetResolution.cs
@@ -94,8 +94,8 @@ protected TestApp UpdateAppConfigForTest(TestApp app, TestSetup setup, bool copy
// The fallback RID is a compile-time define for the host. On Windows, it is always win10 and on
// other platforms, it matches the build RID (non-portable for source-builds, portable otherwise)
private static string FallbackRid = OperatingSystem.IsWindows()
- ? $"win10-{TestContext.BuildArchitecture}"
- : TestContext.BuildRID;
+ ? $"win10-{HostTestContext.BuildArchitecture}"
+ : HostTestContext.BuildRID;
protected const string UnknownRid = "unknown-rid";
@@ -332,15 +332,15 @@ public void MostSpecificRidAssemblySelected_RidGraph(string rid, string expected
}
// The build RID from the test context should match the build RID of the host under test
- private static string CurrentRid = TestContext.BuildRID;
+ private static string CurrentRid = HostTestContext.BuildRID;
private static string CurrentRidAsset = $"{CurrentRid}/{CurrentRid}Asset.dll";
// Strip the - from the RID to get the OS
- private static string CurrentOS = CurrentRid[..^(TestContext.BuildArchitecture.Length + 1)];
+ private static string CurrentOS = CurrentRid[..^(HostTestContext.BuildArchitecture.Length + 1)];
private static string CurrentOSAsset = $"{CurrentOS}/{CurrentOS}Asset.dll";
// Append a different architecture - arm64 if current architecture is x64, otherwise x64
- private static string DifferentArch = $"{CurrentOS}-{(TestContext.BuildArchitecture == "x64" ? "arm64" : "x64")}";
+ private static string DifferentArch = $"{CurrentOS}-{(HostTestContext.BuildArchitecture == "x64" ? "arm64" : "x64")}";
private static string DifferentArchAsset = $"{DifferentArch}/{DifferentArch}Asset.dll";
[Theory]
@@ -603,7 +603,7 @@ public void MostSpecificRidAssemblySelectedPerTypeMultipleAssets(bool hasRuntime
protected static void UseFallbacksFromBuiltDotNet(NetCoreAppBuilder builder)
{
IReadOnlyList fallbacks;
- string depsJson = Path.Combine(TestContext.BuiltDotNet.GreatestVersionSharedFxPath, $"{Constants.MicrosoftNETCoreApp}.deps.json");
+ string depsJson = Path.Combine(HostTestContext.BuiltDotNet.GreatestVersionSharedFxPath, $"{Constants.MicrosoftNETCoreApp}.deps.json");
using (FileStream fileStream = File.OpenRead(depsJson))
using (DependencyContextJsonReader reader = new DependencyContextJsonReader())
{
diff --git a/src/installer/tests/HostActivation.Tests/DependencyResolution/SharedTestStateBase.cs b/src/installer/tests/HostActivation.Tests/DependencyResolution/SharedTestStateBase.cs
index 7fc6019e9e91fc..ba6fa3613cbd99 100644
--- a/src/installer/tests/HostActivation.Tests/DependencyResolution/SharedTestStateBase.cs
+++ b/src/installer/tests/HostActivation.Tests/DependencyResolution/SharedTestStateBase.cs
@@ -22,7 +22,7 @@ public SharedTestStateBase()
public DotNetBuilder DotNet(string name)
{
- return new DotNetBuilder(_baseDirectory.Location, TestContext.BuiltDotNet.BinPath, name);
+ return new DotNetBuilder(_baseDirectory.Location, HostTestContext.BuiltDotNet.BinPath, name);
}
public TestApp CreateFrameworkReferenceApp(string fxName, string fxVersion, Action customizer = null)
diff --git a/src/installer/tests/HostActivation.Tests/DotnetArgValidation.cs b/src/installer/tests/HostActivation.Tests/DotnetArgValidation.cs
index 18ce6bbf5716fd..d1a7b81bbdccce 100644
--- a/src/installer/tests/HostActivation.Tests/DotnetArgValidation.cs
+++ b/src/installer/tests/HostActivation.Tests/DotnetArgValidation.cs
@@ -22,7 +22,7 @@ public DotnetArgValidation(DotnetArgValidation.SharedTestState sharedState)
public void MuxerExec_MissingAppAssembly_Fails()
{
string assemblyName = Path.Combine(GetNonexistentAndUnnormalizedPath(), "foo.dll");
- TestContext.BuiltDotNet.Exec("exec", assemblyName)
+ HostTestContext.BuiltDotNet.Exec("exec", assemblyName)
.CaptureStdOut()
.CaptureStdErr()
.Execute()
@@ -34,7 +34,7 @@ public void MuxerExec_MissingAppAssembly_Fails()
public void MuxerExec_MissingAppAssembly_BadExtension_Fails()
{
string assemblyName = Path.Combine(GetNonexistentAndUnnormalizedPath(), "foo.xzy");
- TestContext.BuiltDotNet.Exec("exec", assemblyName)
+ HostTestContext.BuiltDotNet.Exec("exec", assemblyName)
.CaptureStdOut()
.CaptureStdErr()
.Execute()
@@ -46,10 +46,10 @@ public void MuxerExec_MissingAppAssembly_BadExtension_Fails()
public void MuxerExec_BadExtension_Fails()
{
// Get a valid file name, but not exe or dll
- string fxDir = TestContext.BuiltDotNet.GreatestVersionSharedFxPath;
+ string fxDir = HostTestContext.BuiltDotNet.GreatestVersionSharedFxPath;
string assemblyName = Path.Combine(fxDir, "Microsoft.NETCore.App.deps.json");
- TestContext.BuiltDotNet.Exec("exec", assemblyName)
+ HostTestContext.BuiltDotNet.Exec("exec", assemblyName)
.CaptureStdOut()
.CaptureStdErr()
.Execute()
@@ -60,7 +60,7 @@ public void MuxerExec_BadExtension_Fails()
[Fact]
public void MissingArgumentValue_Fails()
{
- TestContext.BuiltDotNet.Exec("--fx-version")
+ HostTestContext.BuiltDotNet.Exec("--fx-version")
.CaptureStdOut()
.CaptureStdErr()
.Execute()
@@ -72,7 +72,7 @@ public void MissingArgumentValue_Fails()
public void InvalidFileOrCommand_NoSDK_ListsPossibleIssues()
{
string fileName = "NonExistent";
- TestContext.BuiltDotNet.Exec(fileName)
+ HostTestContext.BuiltDotNet.Exec(fileName)
.WorkingDirectory(sharedTestState.BaseDirectory.Location)
.CaptureStdOut()
.CaptureStdErr()
@@ -85,7 +85,7 @@ public void InvalidFileOrCommand_NoSDK_ListsPossibleIssues()
// Return a non-existent path that contains a mix of / and \
private string GetNonexistentAndUnnormalizedPath()
{
- return Path.Combine(TestContext.BuiltDotNet.BinPath, @"x\y/");
+ return Path.Combine(HostTestContext.BuiltDotNet.BinPath, @"x\y/");
}
public class SharedTestState : IDisposable
diff --git a/src/installer/tests/HostActivation.Tests/FrameworkDependentAppLaunch.cs b/src/installer/tests/HostActivation.Tests/FrameworkDependentAppLaunch.cs
index e818c74a6e5973..f721ffc00916e2 100644
--- a/src/installer/tests/HostActivation.Tests/FrameworkDependentAppLaunch.cs
+++ b/src/installer/tests/HostActivation.Tests/FrameworkDependentAppLaunch.cs
@@ -26,7 +26,7 @@ public FrameworkDependentAppLaunch(SharedTestState fixture)
[Fact]
public void Muxer_Default()
{
- var dotnet = TestContext.BuiltDotNet;
+ var dotnet = HostTestContext.BuiltDotNet;
var appDll = sharedTestState.App.AppDll;
dotnet.Exec(appDll)
@@ -55,7 +55,7 @@ public void Muxer_AssemblyWithDifferentFileExtension_Fails()
File.Copy(appDll, appOtherExt, true);
File.Delete(appDll);
- TestContext.BuiltDotNet.Exec(appOtherExt)
+ HostTestContext.BuiltDotNet.Exec(appOtherExt)
.CaptureStdErr()
.Execute()
.Should().Fail()
@@ -117,7 +117,7 @@ public void Muxer_AssemblyWithExeExtension()
fileStream.SetLength(fileStream.Position);
}
- TestContext.BuiltDotNet.Exec(appExe)
+ HostTestContext.BuiltDotNet.Exec(appExe)
.CaptureStdOut()
.CaptureStdErr()
.Execute()
@@ -141,7 +141,7 @@ public void Muxer_NonAssemblyWithExeExtension()
}
// If the app being run is not actually a managed assembly, it should come through as a load failure.
- TestContext.BuiltDotNet.Exec(appExe)
+ HostTestContext.BuiltDotNet.Exec(appExe)
.CaptureStdOut()
.CaptureStdErr()
.DisableDumps() // Expected to throw an exception
@@ -154,7 +154,7 @@ public void Muxer_NonAssemblyWithExeExtension()
public void Muxer_AltDirectorySeparatorChar()
{
var appDll = sharedTestState.App.AppDll.Replace(Path.DirectorySeparatorChar, Path.AltDirectorySeparatorChar);
- TestContext.BuiltDotNet.Exec(appDll)
+ HostTestContext.BuiltDotNet.Exec(appDll)
.CaptureStdErr()
.CaptureStdOut()
.Execute()
@@ -173,7 +173,7 @@ public void Muxer_SpecificRuntimeConfig()
var runtimeConfig = Path.Combine(subdirectory, Path.GetFileName(app.RuntimeConfigJson));
File.Move(app.RuntimeConfigJson, runtimeConfig, overwrite: true);
- TestContext.BuiltDotNet.Exec("exec", "--runtimeconfig", runtimeConfig, app.AppDll)
+ HostTestContext.BuiltDotNet.Exec("exec", "--runtimeconfig", runtimeConfig, app.AppDll)
.CaptureStdErr()
.CaptureStdOut()
.Execute()
@@ -191,12 +191,12 @@ public void AppHost()
Command.Create(appExe)
.CaptureStdErr()
.CaptureStdOut()
- .DotNetRoot(TestContext.BuiltDotNet.BinPath, TestContext.BuildArchitecture)
+ .DotNetRoot(HostTestContext.BuiltDotNet.BinPath, HostTestContext.BuildArchitecture)
.MultilevelLookup(false)
.Execute()
.Should().Pass()
.And.HaveStdOutContaining("Hello World")
- .And.HaveStdOutContaining(TestContext.MicrosoftNETCoreAppVersion);
+ .And.HaveStdOutContaining(HostTestContext.MicrosoftNETCoreAppVersion);
}
[ConditionalFact(typeof(Binaries.CetCompat), nameof(Binaries.CetCompat.IsSupported))]
@@ -209,12 +209,12 @@ public void AppHost_DisableCetCompat()
Command.Create(app.AppExe)
.CaptureStdErr()
.CaptureStdOut()
- .DotNetRoot(TestContext.BuiltDotNet.BinPath, TestContext.BuildArchitecture)
+ .DotNetRoot(HostTestContext.BuiltDotNet.BinPath, HostTestContext.BuildArchitecture)
.MultilevelLookup(false)
.Execute()
.Should().Pass()
.And.HaveStdOutContaining("Hello World")
- .And.HaveStdOutContaining(TestContext.MicrosoftNETCoreAppVersion);
+ .And.HaveStdOutContaining(HostTestContext.MicrosoftNETCoreAppVersion);
}
[Fact]
@@ -223,25 +223,25 @@ public void AppHost_DotNetRoot_DevicePath()
{
string appExe = sharedTestState.App.AppExe;
- string dotnetPath = $@"\\?\{TestContext.BuiltDotNet.BinPath}";
+ string dotnetPath = $@"\\?\{HostTestContext.BuiltDotNet.BinPath}";
Command.Create(appExe)
.CaptureStdErr()
.CaptureStdOut()
- .DotNetRoot(dotnetPath, TestContext.BuildArchitecture)
+ .DotNetRoot(dotnetPath, HostTestContext.BuildArchitecture)
.Execute()
.Should().Pass()
.And.HaveStdOutContaining("Hello World")
- .And.HaveStdOutContaining(TestContext.MicrosoftNETCoreAppVersion);
+ .And.HaveStdOutContaining(HostTestContext.MicrosoftNETCoreAppVersion);
- dotnetPath = $@"\\.\{TestContext.BuiltDotNet.BinPath}";
+ dotnetPath = $@"\\.\{HostTestContext.BuiltDotNet.BinPath}";
Command.Create(appExe)
.CaptureStdErr()
.CaptureStdOut()
- .DotNetRoot(dotnetPath, TestContext.BuildArchitecture)
+ .DotNetRoot(dotnetPath, HostTestContext.BuildArchitecture)
.Execute()
.Should().Pass()
.And.HaveStdOutContaining("Hello World")
- .And.HaveStdOutContaining(TestContext.MicrosoftNETCoreAppVersion);
+ .And.HaveStdOutContaining(HostTestContext.MicrosoftNETCoreAppVersion);
}
[Fact]
@@ -263,7 +263,7 @@ public void RuntimeConfig_FilePath_Breaks_MAX_PATH_Threshold()
File.Copy(file, Path.Combine(newDir, Path.GetFileName(file)), true);
Command.Create(appExe)
- .DotNetRoot(TestContext.BuiltDotNet.BinPath)
+ .DotNetRoot(HostTestContext.BuiltDotNet.BinPath)
.EnableTracingAndCaptureOutputs()
.MultilevelLookup(false)
.Execute()
@@ -274,7 +274,7 @@ public void RuntimeConfig_FilePath_Breaks_MAX_PATH_Threshold()
[Fact]
public void ComputedTPA_NoTrailingPathSeparator()
{
- TestContext.BuiltDotNet.Exec(sharedTestState.App.AppDll)
+ HostTestContext.BuiltDotNet.Exec(sharedTestState.App.AppDll)
.EnableTracingAndCaptureOutputs()
.Execute()
.Should().Pass()
@@ -290,11 +290,11 @@ public void MissingRuntimeConfig_Fails(bool useAppHost)
if (useAppHost)
{
command = Command.Create(sharedTestState.MockApp.AppExe)
- .DotNetRoot(TestContext.BuiltDotNet.BinPath, TestContext.BuildArchitecture);
+ .DotNetRoot(HostTestContext.BuiltDotNet.BinPath, HostTestContext.BuildArchitecture);
}
else
{
- command = TestContext.BuiltDotNet.Exec(sharedTestState.MockApp.AppDll);
+ command = HostTestContext.BuiltDotNet.Exec(sharedTestState.MockApp.AppDll);
}
command.EnableTracingAndCaptureOutputs()
@@ -318,11 +318,11 @@ public void MissingFrameworkInRuntimeConfig_Fails(bool useAppHost)
if (useAppHost)
{
command = Command.Create(app.AppExe)
- .DotNetRoot(TestContext.BuiltDotNet.BinPath, TestContext.BuildArchitecture);
+ .DotNetRoot(HostTestContext.BuiltDotNet.BinPath, HostTestContext.BuildArchitecture);
}
else
{
- command = TestContext.BuiltDotNet.Exec(app.AppDll);
+ command = HostTestContext.BuiltDotNet.Exec(app.AppDll);
}
command.EnableTracingAndCaptureOutputs()
@@ -339,13 +339,13 @@ public void MissingFrameworkName()
TestApp app = sharedTestState.MockApp.Copy();
// Create a runtimeconfig.json with a framework that has no name property
- var framework = new RuntimeConfig.Framework(null, TestContext.MicrosoftNETCoreAppVersion);
+ var framework = new RuntimeConfig.Framework(null, HostTestContext.MicrosoftNETCoreAppVersion);
new RuntimeConfig(app.RuntimeConfigJson)
.WithFramework(framework)
.Save();
Command.Create(app.AppExe)
- .DotNetRoot(TestContext.BuiltDotNet.BinPath)
+ .DotNetRoot(HostTestContext.BuiltDotNet.BinPath)
.EnableTracingAndCaptureOutputs()
.Execute()
.Should().Fail()
@@ -364,7 +364,7 @@ public void MissingFrameworkVersion()
.Save();
Command.Create(app.AppExe)
- .DotNetRoot(TestContext.BuiltDotNet.BinPath)
+ .DotNetRoot(HostTestContext.BuiltDotNet.BinPath)
.EnableTracingAndCaptureOutputs()
.Execute()
.Should().Fail()
@@ -385,18 +385,18 @@ public void AppHost_CLI_MissingRuntimeFramework_ErrorReportedInStdErr(bool missi
if (missingHostfxr)
{
expectedErrorCode = Constants.ErrorCode.CoreHostLibMissingFailure;
- expectedStdErr = $"&apphost_version={TestContext.MicrosoftNETCoreAppVersion}";
+ expectedStdErr = $"&apphost_version={HostTestContext.MicrosoftNETCoreAppVersion}";
expectedUrlQuery = "missing_runtime=true&";
}
else
{
- new DotNetBuilder(invalidDotNet.Location, TestContext.BuiltDotNet.BinPath, null)
+ new DotNetBuilder(invalidDotNet.Location, HostTestContext.BuiltDotNet.BinPath, null)
.Build();
expectedErrorCode = Constants.ErrorCode.FrameworkMissingFailure;
expectedStdErr = $"Framework: '{Constants.MicrosoftNETCoreApp}', " +
- $"version '{TestContext.MicrosoftNETCoreAppVersion}' ({TestContext.BuildArchitecture})";
- expectedUrlQuery = $"framework={Constants.MicrosoftNETCoreApp}&framework_version={TestContext.MicrosoftNETCoreAppVersion}";
+ $"version '{HostTestContext.MicrosoftNETCoreAppVersion}' ({HostTestContext.BuildArchitecture})";
+ expectedUrlQuery = $"framework={Constants.MicrosoftNETCoreApp}&framework_version={HostTestContext.MicrosoftNETCoreAppVersion}";
}
CommandResult result = Command.Create(sharedTestState.App.AppExe)
@@ -407,7 +407,7 @@ public void AppHost_CLI_MissingRuntimeFramework_ErrorReportedInStdErr(bool missi
result.Should().Fail()
.And.HaveStdErrContaining($"https://aka.ms/dotnet-core-applaunch?{expectedUrlQuery}")
- .And.HaveStdErrContaining($"&rid={TestContext.BuildRID}")
+ .And.HaveStdErrContaining($"&rid={HostTestContext.BuildRID}")
.And.HaveStdErrContaining(expectedStdErr)
.And.ExitWith(expectedErrorCode);
}
@@ -425,11 +425,11 @@ public void AppHost_GUI_MissingRuntimeFramework_ErrorReportedInDialog()
{
string expectedErrorCode;
string expectedUrlQuery;
- new DotNetBuilder(invalidDotNet.Location, TestContext.BuiltDotNet.BinPath, null)
+ new DotNetBuilder(invalidDotNet.Location, HostTestContext.BuiltDotNet.BinPath, null)
.Build();
expectedErrorCode = Constants.ErrorCode.FrameworkMissingFailure.ToString("x");
- expectedUrlQuery = $"framework={Constants.MicrosoftNETCoreApp}&framework_version={TestContext.MicrosoftNETCoreAppVersion}";
+ expectedUrlQuery = $"framework={Constants.MicrosoftNETCoreApp}&framework_version={HostTestContext.MicrosoftNETCoreAppVersion}";
Command command = Command.Create(appExe)
.EnableTracingAndCaptureOutputs()
.DotNetRoot(invalidDotNet.Location)
@@ -439,13 +439,13 @@ public void AppHost_GUI_MissingRuntimeFramework_ErrorReportedInDialog()
WindowsUtils.WaitForPopupFromProcess(command.Process);
command.Process.Kill();
- string expectedMissingFramework = $"'{Constants.MicrosoftNETCoreApp}', version '{TestContext.MicrosoftNETCoreAppVersion}' ({TestContext.BuildArchitecture})";
+ string expectedMissingFramework = $"'{Constants.MicrosoftNETCoreApp}', version '{HostTestContext.MicrosoftNETCoreAppVersion}' ({HostTestContext.BuildArchitecture})";
var result = command.WaitForExit()
.Should().Fail()
.And.HaveStdErrContaining($"Showing error dialog for application: '{Path.GetFileName(appExe)}' - error code: 0x{expectedErrorCode}")
.And.HaveStdErrContaining($"url: 'https://aka.ms/dotnet-core-applaunch?{expectedUrlQuery}")
.And.HaveStdErrContaining("&gui=true")
- .And.HaveStdErrContaining($"&rid={TestContext.BuildRID}")
+ .And.HaveStdErrContaining($"&rid={HostTestContext.BuildRID}")
.And.HaveStdErrMatching($"details: (?>.|\\s)*{System.Text.RegularExpressions.Regex.Escape(expectedMissingFramework)}");
}
}
@@ -475,7 +475,7 @@ public void AppHost_GUI_MissingRuntime_ErrorReportedInDialog()
.And.HaveStdErrContaining($"Showing error dialog for application: '{Path.GetFileName(appExe)}' - error code: 0x{expectedErrorCode}")
.And.HaveStdErrContaining($"url: 'https://aka.ms/dotnet-core-applaunch?missing_runtime=true")
.And.HaveStdErrContaining("gui=true")
- .And.HaveStdErrContaining($"&apphost_version={TestContext.MicrosoftNETCoreAppVersion}");
+ .And.HaveStdErrContaining($"&apphost_version={HostTestContext.MicrosoftNETCoreAppVersion}");
}
}
@@ -490,14 +490,14 @@ public void AppHost_GUI_NoCustomErrorWriter_FrameworkMissing_ErrorReportedInDial
// The mockhostfxrFrameworkMissingFailure folder name is used by mock hostfxr to return the appropriate error code
using (var dotnetWithMockHostFxr = TestArtifact.Create("mockhostfxrFrameworkMissingFailure"))
{
- var dotnet = new DotNetBuilder(dotnetWithMockHostFxr.Location, TestContext.BuiltDotNet.BinPath, null)
+ var dotnet = new DotNetBuilder(dotnetWithMockHostFxr.Location, HostTestContext.BuiltDotNet.BinPath, null)
.RemoveHostFxr()
.AddMockHostFxr(new Version(2, 2, 0))
.Build();
Command command = Command.Create(appExe)
.EnableTracingAndCaptureOutputs()
- .DotNetRoot(dotnet.BinPath, TestContext.BuildArchitecture)
+ .DotNetRoot(dotnet.BinPath, HostTestContext.BuildArchitecture)
.MultilevelLookup(false)
.Start();
diff --git a/src/installer/tests/HostActivation.Tests/FrameworkResolution/FrameworkResolution.cs b/src/installer/tests/HostActivation.Tests/FrameworkResolution/FrameworkResolution.cs
index b5e993a100a31d..4a6178479c2852 100644
--- a/src/installer/tests/HostActivation.Tests/FrameworkResolution/FrameworkResolution.cs
+++ b/src/installer/tests/HostActivation.Tests/FrameworkResolution/FrameworkResolution.cs
@@ -74,7 +74,7 @@ public void FrameworkResolutionError_ListOtherArchitectures()
string arch = otherArchs[i];
// Create a .NET install with Microsoft.NETCoreApp at the registered location
- var dotnet = new DotNetBuilder(otherArchArtifact.Location, TestContext.BuiltDotNet.BinPath, arch)
+ var dotnet = new DotNetBuilder(otherArchArtifact.Location, HostTestContext.BuiltDotNet.BinPath, arch)
.AddMicrosoftNETCoreAppFrameworkMockHostPolicy(requestedVersion)
.Build();
installLocations[i] = (arch, dotnet.BinPath);
@@ -93,7 +93,7 @@ public void FrameworkResolutionError_ListOtherArchitectures()
// Error message should list framework found for other architectures
foreach ((string arch, string path) in installLocations)
{
- if (arch == TestContext.BuildArchitecture)
+ if (arch == HostTestContext.BuildArchitecture)
continue;
string expectedPath = System.Text.RegularExpressions.Regex.Escape(Path.Combine(path, "shared", MicrosoftNETCoreApp));
@@ -139,7 +139,7 @@ public void DisabledVersions(string requestedVersion, string disabledVersions, s
{value} at [{SharedState.InstalledDotNet.SharedFxPath}]
Disabled via {Constants.DisableRuntimeVersions.EnvironmentVariable} environment variable
""");
-
+
}
}
}
diff --git a/src/installer/tests/HostActivation.Tests/FrameworkResolution/FrameworkResolutionBase.cs b/src/installer/tests/HostActivation.Tests/FrameworkResolution/FrameworkResolutionBase.cs
index 7670ffa18e784a..27f932f4a3f4c3 100644
--- a/src/installer/tests/HostActivation.Tests/FrameworkResolution/FrameworkResolutionBase.cs
+++ b/src/installer/tests/HostActivation.Tests/FrameworkResolution/FrameworkResolutionBase.cs
@@ -97,7 +97,7 @@ public SharedTestStateBase()
public DotNetBuilder DotNet(string name)
{
- return new DotNetBuilder(_baseDirArtifact.Location, TestContext.BuiltDotNet.BinPath, name);
+ return new DotNetBuilder(_baseDirArtifact.Location, HostTestContext.BuiltDotNet.BinPath, name);
}
public TestApp CreateFrameworkReferenceApp()
diff --git a/src/installer/tests/HostActivation.Tests/FrameworkResolution/IncludedFrameworksSettings.cs b/src/installer/tests/HostActivation.Tests/FrameworkResolution/IncludedFrameworksSettings.cs
index a46105cb933c10..fd31ff4090621c 100644
--- a/src/installer/tests/HostActivation.Tests/FrameworkResolution/IncludedFrameworksSettings.cs
+++ b/src/installer/tests/HostActivation.Tests/FrameworkResolution/IncludedFrameworksSettings.cs
@@ -48,7 +48,7 @@ public void SelfContainedCanHaveIncludedFrameworks()
[Fact]
public void MissingName()
{
- var framework = new RuntimeConfig.Framework(null, TestContext.MicrosoftNETCoreAppVersion);
+ var framework = new RuntimeConfig.Framework(null, HostTestContext.MicrosoftNETCoreAppVersion);
RunSelfContainedTest(
new TestSettings()
.WithRuntimeConfigCustomizer(runtimeConfig => runtimeConfig
diff --git a/src/installer/tests/HostActivation.Tests/FrameworkResolution/MultilevelLookup.cs b/src/installer/tests/HostActivation.Tests/FrameworkResolution/MultilevelLookup.cs
index 6933b5a2fc0458..b1fb135e67b62a 100644
--- a/src/installer/tests/HostActivation.Tests/FrameworkResolution/MultilevelLookup.cs
+++ b/src/installer/tests/HostActivation.Tests/FrameworkResolution/MultilevelLookup.cs
@@ -13,8 +13,6 @@
namespace Microsoft.DotNet.CoreSetup.Test.HostActivation.FrameworkResolution
{
- // Multi-level lookup was only supported on Windows.
- [PlatformSpecific(TestPlatforms.Windows)]
public class MultilevelLookup :
FrameworkResolutionBase,
IClassFixture
@@ -23,6 +21,8 @@ public class MultilevelLookup :
public MultilevelLookup(SharedTestState sharedState)
{
+ Assert.SkipUnless(OperatingSystem.IsWindows(), "Multi-level lookup is only supported on Windows");
+
SharedState = sharedState;
}
diff --git a/src/installer/tests/HostActivation.Tests/HostActivation.Tests.csproj b/src/installer/tests/HostActivation.Tests/HostActivation.Tests.csproj
index b4e00bca436f63..6202c71150c9f6 100644
--- a/src/installer/tests/HostActivation.Tests/HostActivation.Tests.csproj
+++ b/src/installer/tests/HostActivation.Tests/HostActivation.Tests.csproj
@@ -1,7 +1,9 @@
+ Exe
$(TestInfraTargetFramework)
+ $(TargetRid)
HostActivation.Tests
true
@@ -9,6 +11,7 @@
$(NoWarn);NU1511
+ XUnitV3
diff --git a/src/installer/tests/HostActivation.Tests/HostCommands.cs b/src/installer/tests/HostActivation.Tests/HostCommands.cs
index 5e5d03ba7f2282..5c684a9129f4a8 100644
--- a/src/installer/tests/HostActivation.Tests/HostCommands.cs
+++ b/src/installer/tests/HostActivation.Tests/HostCommands.cs
@@ -41,9 +41,9 @@ public void Info()
.Should().Pass()
.And.HaveStdOutContaining(expectedSdksOutput)
.And.HaveStdOutContaining(expectedRuntimesOutput)
- .And.HaveStdOutMatching($@"Architecture:\s*{TestContext.BuildArchitecture}")
+ .And.HaveStdOutMatching($@"Architecture:\s*{HostTestContext.BuildArchitecture}")
// If an SDK exists, we rely on it to print the RID. The host should not print it again.
- .And.NotHaveStdOutMatching($@"RID:\s*{TestContext.BuildRID}");
+ .And.NotHaveStdOutMatching($@"RID:\s*{HostTestContext.BuildRID}");
}
[Fact]
@@ -57,23 +57,23 @@ No SDKs were found
string expectedRuntimesOutput =
$"""
.NET runtimes installed:
- {GetListRuntimesOutput(TestContext.BuiltDotNet.BinPath, [TestContext.MicrosoftNETCoreAppVersion], " ")}
+ {GetListRuntimesOutput(HostTestContext.BuiltDotNet.BinPath, [HostTestContext.MicrosoftNETCoreAppVersion], " ")}
""";
- TestContext.BuiltDotNet.Exec("--info")
+ HostTestContext.BuiltDotNet.Exec("--info")
.CaptureStdOut()
.Execute()
.Should().Pass()
.And.HaveStdOutContaining(expectedSdksOutput)
.And.HaveStdOutContaining(expectedRuntimesOutput)
- .And.HaveStdOutMatching($@"Architecture:\s*{TestContext.BuildArchitecture}")
- .And.HaveStdOutMatching($@"RID:\s*{TestContext.BuildRID}");
+ .And.HaveStdOutMatching($@"Architecture:\s*{HostTestContext.BuildArchitecture}")
+ .And.HaveStdOutMatching($@"RID:\s*{HostTestContext.BuildRID}");
}
[Fact]
public void Info_Utf8Path()
{
string installLocation = Encoding.UTF8.GetString("utf8-龯蝌灋齅ㄥ䶱"u8);
- DotNetCli dotnet = new DotNetBuilder(SharedState.Artifact.Location, TestContext.BuiltDotNet.BinPath, installLocation)
+ DotNetCli dotnet = new DotNetBuilder(SharedState.Artifact.Location, HostTestContext.BuiltDotNet.BinPath, installLocation)
.Build();
dotnet.Exec("--info")
@@ -87,7 +87,7 @@ public void Info_Utf8Path()
[Fact]
public void Info_ListEnvironment()
{
- var command = TestContext.BuiltDotNet.Exec("--info")
+ var command = HostTestContext.BuiltDotNet.Exec("--info")
.CaptureStdOut();
// Add DOTNET_ROOT environment variables
@@ -159,7 +159,7 @@ public void Info_ListEnvironment()
public void Info_ListEnvironment_LegacyPrefixDetection()
{
string comPlusEnvVar = "COMPlus_ReadyToRun";
- TestContext.BuiltDotNet.Exec("--info")
+ HostTestContext.BuiltDotNet.Exec("--info")
.EnvironmentVariable(comPlusEnvVar, "0")
.CaptureStdOut()
.Execute()
@@ -175,7 +175,7 @@ public void Info_GlobalJson_InvalidJson()
using (TestArtifact workingDir = TestArtifact.Create(nameof(Info_GlobalJson_InvalidJson)))
{
string globalJsonPath = GlobalJson.Write(workingDir.Location, "{ \"sdk\": { }");
- TestContext.BuiltDotNet.Exec("--info")
+ HostTestContext.BuiltDotNet.Exec("--info")
.WorkingDirectory(workingDir.Location)
.CaptureStdOut().CaptureStdErr()
.Execute()
@@ -196,7 +196,7 @@ public void Info_GlobalJson_InvalidData(string version)
using (TestArtifact workingDir = TestArtifact.Create(nameof(Info_GlobalJson_InvalidData)))
{
string globalJsonPath = GlobalJson.CreateWithVersion(workingDir.Location, version);
- TestContext.BuiltDotNet.Exec("--info")
+ HostTestContext.BuiltDotNet.Exec("--info")
.WorkingDirectory(workingDir.Location)
.CaptureStdOut().CaptureStdErr()
.Execute()
@@ -216,7 +216,7 @@ public void Info_GlobalJson_NonExistentFeatureBand(string version)
using (TestArtifact workingDir = TestArtifact.Create(nameof(Info_GlobalJson_NonExistentFeatureBand)))
{
string globalJsonPath = GlobalJson.CreateWithVersion(workingDir.Location, version);
- var result = TestContext.BuiltDotNet.Exec("--info")
+ var result = HostTestContext.BuiltDotNet.Exec("--info")
.WorkingDirectory(workingDir.Location)
.CaptureStdOut().CaptureStdErr()
.Execute()
@@ -289,7 +289,7 @@ public void ListRuntimes_OtherArchitecture(bool useRegisteredLocation)
public void ListRuntimes_OtherArchitecture_NoInstalls()
{
// Non-host architecture - arm64 if current architecture is x64, otherwise x64
- string arch = TestContext.BuildArchitecture == "x64" ? "arm64" : "x64";
+ string arch = HostTestContext.BuildArchitecture == "x64" ? "arm64" : "x64";
using (var registeredInstallLocationOverride = new RegisteredInstallLocationOverride(SharedState.DotNet.GreatestVersionHostFxrFilePath))
{
// Register a location that should have no runtimes installed
@@ -306,7 +306,7 @@ public void ListRuntimes_OtherArchitecture_NoInstalls()
[Fact]
public void ListRuntimes_UnknownArchitecture()
{
- TestContext.BuiltDotNet.Exec("--list-runtimes", "--arch", "invalid")
+ HostTestContext.BuiltDotNet.Exec("--list-runtimes", "--arch", "invalid")
.CaptureStdOut()
.Execute()
.Should().Fail()
@@ -358,7 +358,7 @@ public void ListSdks_OtherArchitecture(bool useRegisteredLocation)
public void ListSdks_OtherArchitecture_NoInstalls()
{
// Non-host architecture - arm64 if current architecture is x64, otherwise x64
- string arch = TestContext.BuildArchitecture == "x64" ? "arm64" : "x64";
+ string arch = HostTestContext.BuildArchitecture == "x64" ? "arm64" : "x64";
using (var registeredInstallLocationOverride = new RegisteredInstallLocationOverride(SharedState.DotNet.GreatestVersionHostFxrFilePath))
{
// Register a location that should have no SDKs installed
@@ -375,7 +375,7 @@ public void ListSdks_OtherArchitecture_NoInstalls()
[Fact]
public void ListSdks_UnknownArchitecture()
{
- TestContext.BuiltDotNet.Exec("--list-sdks", "--arch", "invalid")
+ HostTestContext.BuiltDotNet.Exec("--list-sdks", "--arch", "invalid")
.CaptureStdOut()
.Execute()
.Should().Fail()
@@ -409,7 +409,7 @@ public SharedTestState()
{
Artifact = TestArtifact.Create(nameof(HostCommands));
- var builder = new DotNetBuilder(Artifact.Location, TestContext.BuiltDotNet.BinPath, "exe");
+ var builder = new DotNetBuilder(Artifact.Location, HostTestContext.BuiltDotNet.BinPath, "exe");
foreach (string version in InstalledVersions)
{
builder.AddMicrosoftNETCoreAppFrameworkMockHostPolicy(version);
@@ -419,7 +419,7 @@ public SharedTestState()
DotNet = builder.Build();
// Add runtimes and SDKs for other architectures
- string[] otherArchs = new[] { "arm64", "x64", "x86" }.Where(a => a != TestContext.BuildArchitecture).ToArray();
+ string[] otherArchs = new[] { "arm64", "x64", "x86" }.Where(a => a != HostTestContext.BuildArchitecture).ToArray();
OtherArchInstallLocations = new (string, string)[otherArchs.Length];
for (int i = 0; i < otherArchs.Length; i++)
{
diff --git a/src/installer/tests/HostActivation.Tests/HostVersionCompatibility.cs b/src/installer/tests/HostActivation.Tests/HostVersionCompatibility.cs
index 37a9a4b24e2168..693d456de0fea5 100644
--- a/src/installer/tests/HostActivation.Tests/HostVersionCompatibility.cs
+++ b/src/installer/tests/HostActivation.Tests/HostVersionCompatibility.cs
@@ -30,8 +30,8 @@ private void LatestHost_OldRuntime_BackwardsCompatible(TestApp previousVersionAp
string appExe = app.AppExe;
RuntimeConfig appConfig = RuntimeConfig.FromFile(app.RuntimeConfigJson);
- Assert.NotEqual(appConfig.Tfm, TestContext.Tfm);
- Assert.NotEqual(appConfig.GetIncludedFramework(Constants.MicrosoftNETCoreApp).Version, TestContext.MicrosoftNETCoreAppVersion);
+ Assert.NotEqual(appConfig.Tfm, HostTestContext.Tfm);
+ Assert.NotEqual(appConfig.GetIncludedFramework(Constants.MicrosoftNETCoreApp).Version, HostTestContext.MicrosoftNETCoreAppVersion);
// Use the newer apphost
// This emulates the case when:
@@ -43,7 +43,7 @@ private void LatestHost_OldRuntime_BackwardsCompatible(TestApp previousVersionAp
.Execute()
.Should().Pass()
.And.HaveStdOutContaining("Hello World")
- .And.HaveStdErrContaining($"--- Invoked apphost [version: {TestContext.MicrosoftNETCoreAppVersion}");
+ .And.HaveStdErrContaining($"--- Invoked apphost [version: {HostTestContext.MicrosoftNETCoreAppVersion}");
// Use the newer apphost and hostFxr
// This emulates the case when:
@@ -55,7 +55,7 @@ private void LatestHost_OldRuntime_BackwardsCompatible(TestApp previousVersionAp
.Execute()
.Should().Pass()
.And.HaveStdOutContaining("Hello World")
- .And.HaveStdErrContaining($"--- Invoked apphost [version: {TestContext.MicrosoftNETCoreAppVersion}");
+ .And.HaveStdErrContaining($"--- Invoked apphost [version: {HostTestContext.MicrosoftNETCoreAppVersion}");
}
[Fact]
@@ -71,8 +71,8 @@ private void OldHost_LatestRuntime_ForwardCompatible(TestApp previousVersionApp)
RuntimeConfig previousAppConfig = RuntimeConfig.FromFile(previousVersionApp.RuntimeConfigJson);
string previousVersion = previousAppConfig.GetIncludedFramework(Constants.MicrosoftNETCoreApp).Version;
- Assert.NotEqual(TestContext.Tfm, previousAppConfig.Tfm);
- Assert.NotEqual(TestContext.MicrosoftNETCoreAppVersion, previousVersion);
+ Assert.NotEqual(HostTestContext.Tfm, previousAppConfig.Tfm);
+ Assert.NotEqual(HostTestContext.MicrosoftNETCoreAppVersion, previousVersion);
// Use the older apphost
// This emulates the case when:
diff --git a/src/installer/tests/HostActivation.Tests/InstallLocation.cs b/src/installer/tests/HostActivation.Tests/InstallLocation.cs
index e85e8043177d01..8d71c05aec56ae 100644
--- a/src/installer/tests/HostActivation.Tests/InstallLocation.cs
+++ b/src/installer/tests/HostActivation.Tests/InstallLocation.cs
@@ -25,39 +25,39 @@ public InstallLocation(SharedTestState fixture)
[Fact]
public void EnvironmentVariable_CurrentArchitectureIsUsedIfEnvVarSet()
{
- var arch = TestContext.BuildArchitecture.ToUpper();
+ var arch = HostTestContext.BuildArchitecture.ToUpper();
Command.Create(sharedTestState.App.AppExe)
.EnableTracingAndCaptureOutputs()
- .DotNetRoot(TestContext.BuiltDotNet.BinPath, arch)
+ .DotNetRoot(HostTestContext.BuiltDotNet.BinPath, arch)
.Execute()
.Should().Pass()
- .And.HaveUsedDotNetRootInstallLocation(TestContext.BuiltDotNet.BinPath, TestContext.BuildRID, arch);
+ .And.HaveUsedDotNetRootInstallLocation(HostTestContext.BuiltDotNet.BinPath, HostTestContext.BuildRID, arch);
}
[Fact]
public void EnvironmentVariable_IfNoArchSpecificEnvVarIsFoundDotnetRootIsUsed()
{
- var arch = TestContext.BuildArchitecture.ToUpper();
+ var arch = HostTestContext.BuildArchitecture.ToUpper();
Command.Create(sharedTestState.App.AppExe)
.EnableTracingAndCaptureOutputs()
- .DotNetRoot(TestContext.BuiltDotNet.BinPath)
+ .DotNetRoot(HostTestContext.BuiltDotNet.BinPath)
.Execute()
.Should().Pass()
- .And.HaveUsedDotNetRootInstallLocation(TestContext.BuiltDotNet.BinPath, TestContext.BuildRID);
+ .And.HaveUsedDotNetRootInstallLocation(HostTestContext.BuiltDotNet.BinPath, HostTestContext.BuildRID);
}
[Fact]
public void EnvironmentVariable_ArchSpecificDotnetRootIsUsedOverDotnetRoot()
{
- var arch = TestContext.BuildArchitecture.ToUpper();
- var dotnet = TestContext.BuiltDotNet.BinPath;
+ var arch = HostTestContext.BuildArchitecture.ToUpper();
+ var dotnet = HostTestContext.BuiltDotNet.BinPath;
Command.Create(sharedTestState.App.AppExe)
.EnableTracingAndCaptureOutputs()
.DotNetRoot("non_existent_path")
.DotNetRoot(dotnet, arch)
.Execute()
.Should().Pass()
- .And.HaveUsedDotNetRootInstallLocation(dotnet, TestContext.BuildRID, arch)
+ .And.HaveUsedDotNetRootInstallLocation(dotnet, HostTestContext.BuildRID, arch)
.And.NotHaveStdErrContaining("Using environment variable DOTNET_ROOT=");
}
@@ -66,8 +66,8 @@ public void EnvironmentVariable_DotNetRootIsUsedOverInstallLocationIfSet()
{
var app = sharedTestState.TestBehaviourEnabledApp;
var appExe = app.AppExe;
- var arch = TestContext.BuildArchitecture.ToUpper();
- var dotnet = TestContext.BuiltDotNet.BinPath;
+ var arch = HostTestContext.BuildArchitecture.ToUpper();
+ var dotnet = HostTestContext.BuiltDotNet.BinPath;
using (var registeredInstallLocationOverride = new RegisteredInstallLocationOverride(appExe))
{
@@ -79,7 +79,7 @@ public void EnvironmentVariable_DotNetRootIsUsedOverInstallLocationIfSet()
.DotNetRoot(dotnet, arch)
.Execute()
.Should().Pass()
- .And.HaveUsedDotNetRootInstallLocation(dotnet, TestContext.BuildRID, arch)
+ .And.HaveUsedDotNetRootInstallLocation(dotnet, HostTestContext.BuildRID, arch)
.And.NotHaveStdErrContaining("Using global install location");
}
}
@@ -94,12 +94,12 @@ public void EnvironmentVariable_DotnetRootPathDoesNotExist()
.MultilevelLookup(false)
.EnvironmentVariable(
Constants.TestOnlyEnvironmentVariables.GloballyRegisteredPath,
- TestContext.BuiltDotNet.BinPath)
+ HostTestContext.BuiltDotNet.BinPath)
.Execute()
.Should().Pass()
.And.HaveStdErrContaining("Did not find [DOTNET_ROOT] directory [non_existent_path]")
// If DOTNET_ROOT points to a folder that does not exist, we fall back to the global install path.
- .And.HaveUsedGlobalInstallLocation(TestContext.BuiltDotNet.BinPath)
+ .And.HaveUsedGlobalInstallLocation(HostTestContext.BuiltDotNet.BinPath)
.And.HaveStdOutContaining("Hello World");
}
@@ -113,10 +113,10 @@ public void EnvironmentVariable_DotnetRootPathExistsButHasNoHost()
.MultilevelLookup(false)
.EnvironmentVariable(
Constants.TestOnlyEnvironmentVariables.GloballyRegisteredPath,
- TestContext.BuiltDotNet.BinPath)
+ HostTestContext.BuiltDotNet.BinPath)
.Execute()
.Should().Fail()
- .And.HaveUsedDotNetRootInstallLocation(app.Location, TestContext.BuildRID)
+ .And.HaveUsedDotNetRootInstallLocation(app.Location, HostTestContext.BuildRID)
// If DOTNET_ROOT points to a folder that exists we assume that there's a dotnet installation in it
.And.HaveStdErrContaining($"The required library {Binaries.HostFxr.FileName} could not be found.");
}
@@ -132,11 +132,11 @@ public void DefaultInstallLocation()
Command.Create(app.AppExe)
.EnableTracingAndCaptureOutputs()
.ApplyRegisteredInstallLocationOverride(registeredInstallLocationOverride)
- .EnvironmentVariable(Constants.TestOnlyEnvironmentVariables.DefaultInstallPath, TestContext.BuiltDotNet.BinPath)
+ .EnvironmentVariable(Constants.TestOnlyEnvironmentVariables.DefaultInstallPath, HostTestContext.BuiltDotNet.BinPath)
.DotNetRoot(null)
.Execute()
.Should().Pass()
- .And.HaveUsedGlobalInstallLocation(TestContext.BuiltDotNet.BinPath);
+ .And.HaveUsedGlobalInstallLocation(HostTestContext.BuiltDotNet.BinPath);
}
}
@@ -147,7 +147,7 @@ public void RegisteredInstallLocation()
using (var registeredInstallLocationOverride = new RegisteredInstallLocationOverride(app.AppExe))
{
registeredInstallLocationOverride.SetInstallLocation(
- (TestContext.BuildArchitecture, TestContext.BuiltDotNet.BinPath));
+ (HostTestContext.BuildArchitecture, HostTestContext.BuiltDotNet.BinPath));
Command.Create(app.AppExe)
.EnableTracingAndCaptureOutputs()
@@ -155,8 +155,8 @@ public void RegisteredInstallLocation()
.DotNetRoot(null)
.Execute()
.Should().Pass()
- .And.HaveUsedRegisteredInstallLocation(TestContext.BuiltDotNet.BinPath)
- .And.HaveUsedGlobalInstallLocation(TestContext.BuiltDotNet.BinPath);
+ .And.HaveUsedRegisteredInstallLocation(HostTestContext.BuiltDotNet.BinPath)
+ .And.HaveUsedGlobalInstallLocation(HostTestContext.BuiltDotNet.BinPath);
}
}
@@ -166,7 +166,7 @@ public void RegisteredInstallLocation_ArchSpecificLocationIsPickedFirst()
var app = sharedTestState.TestBehaviourEnabledApp;
var arch1 = "someArch";
var path1 = "x/y/z";
- var arch2 = TestContext.BuildArchitecture;
+ var arch2 = HostTestContext.BuildArchitecture;
var path2 = "a/b/c";
using (var registeredInstallLocationOverride = new RegisteredInstallLocationOverride(app.AppExe))
@@ -248,7 +248,7 @@ public void RegisteredInstallLocation_DotNetInfo_ListOtherArchitectures()
{
using (var testArtifact = TestArtifact.Create("listOtherArchs"))
{
- var dotnet = new DotNetBuilder(testArtifact.Location, TestContext.BuiltDotNet.BinPath, "exe").Build();
+ var dotnet = new DotNetBuilder(testArtifact.Location, HostTestContext.BuiltDotNet.BinPath, "exe").Build();
using (var registeredInstallLocationOverride = new RegisteredInstallLocationOverride(dotnet.GreatestVersionHostFxrFilePath))
{
var installLocations = new (string, string)[] {
@@ -276,7 +276,7 @@ public void RegisteredInstallLocation_DotNetInfo_ListOtherArchitectures()
pathOverride = System.Text.RegularExpressions.Regex.Escape(pathOverride);
foreach ((string arch, string path) in installLocations)
{
- if (arch == TestContext.BuildArchitecture)
+ if (arch == HostTestContext.BuildArchitecture)
continue;
result.Should()
@@ -315,13 +315,13 @@ public void NotFound()
.And.HaveStdErrContaining(
$"""
Environment variable:
- DOTNET_ROOT_{TestContext.BuildArchitecture.ToUpper()} =
+ DOTNET_ROOT_{HostTestContext.BuildArchitecture.ToUpper()} =
DOTNET_ROOT =
""")
.And.HaveStdErrMatching(
$"""
Registered location:
- {System.Text.RegularExpressions.Regex.Escape(registeredLocationOverride)}.*{TestContext.BuildArchitecture}.* =
+ {System.Text.RegularExpressions.Regex.Escape(registeredLocationOverride)}.*{HostTestContext.BuildArchitecture}.* =
""")
.And.HaveStdErrContaining(
$"""
@@ -360,7 +360,7 @@ public void SearchOptions(SearchLocation searchLocation)
CommandResult result;
using (var installOverride = new RegisteredInstallLocationOverride(app.AppExe))
{
- installOverride.SetInstallLocation([(TestContext.BuildArchitecture, globalLocation)]);
+ installOverride.SetInstallLocation([(HostTestContext.BuildArchitecture, globalLocation)]);
result = Command.Create(app.AppExe)
.EnableTracingAndCaptureOutputs()
.ApplyRegisteredInstallLocationOverride(installOverride)
@@ -377,7 +377,7 @@ public void SearchOptions(SearchLocation searchLocation)
result.Should().HaveUsedAppRelativeInstallLocation(appRelativeLocation);
break;
case SearchLocation.EnvironmentVariable:
- result.Should().HaveUsedDotNetRootInstallLocation(envLocation, TestContext.BuildRID);
+ result.Should().HaveUsedDotNetRootInstallLocation(envLocation, HostTestContext.BuildRID);
break;
case SearchLocation.Global:
result.Should().HaveUsedGlobalInstallLocation(globalLocation);
@@ -463,7 +463,7 @@ public void SearchOptions_Precedence(SearchLocation expectedResult)
CommandResult result;
using (var installOverride = new RegisteredInstallLocationOverride(app.AppExe))
{
- installOverride.SetInstallLocation([(TestContext.BuildArchitecture, globalLocation)]);
+ installOverride.SetInstallLocation([(HostTestContext.BuildArchitecture, globalLocation)]);
result = Command.Create(app.AppExe)
.EnableTracingAndCaptureOutputs()
.ApplyRegisteredInstallLocationOverride(installOverride)
@@ -480,7 +480,7 @@ public void SearchOptions_Precedence(SearchLocation expectedResult)
result.Should().HaveUsedAppRelativeInstallLocation(appRelativeLocation);
break;
case SearchLocation.EnvironmentVariable:
- result.Should().HaveUsedDotNetRootInstallLocation(envLocation, TestContext.BuildRID);
+ result.Should().HaveUsedDotNetRootInstallLocation(envLocation, HostTestContext.BuildRID);
break;
case SearchLocation.Global:
result.Should().HaveUsedGlobalInstallLocation(globalLocation);
diff --git a/src/installer/tests/HostActivation.Tests/NativeHostApis.cs b/src/installer/tests/HostActivation.Tests/NativeHostApis.cs
index a7b4d553781dc8..804d7eaa5c91b0 100644
--- a/src/installer/tests/HostActivation.Tests/NativeHostApis.cs
+++ b/src/installer/tests/HostActivation.Tests/NativeHostApis.cs
@@ -109,7 +109,7 @@ public void Hostfxr_get_available_sdks()
string expectedList = string.Join(';', f.LocalSdkPaths);
string api = ApiNames.hostfxr_get_available_sdks;
- TestContext.BuiltDotNet.Exec(sharedTestState.HostApiInvokerApp.AppDll, api, f.ExeDir)
+ HostTestContext.BuiltDotNet.Exec(sharedTestState.HostApiInvokerApp.AppDll, api, f.ExeDir)
.EnableTracingAndCaptureOutputs()
.Execute()
.Should().Pass()
@@ -130,7 +130,7 @@ public void Hostfxr_resolve_sdk2_NoGlobalJson()
});
string api = ApiNames.hostfxr_resolve_sdk2;
- TestContext.BuiltDotNet.Exec(sharedTestState.HostApiInvokerApp.AppDll, api, f.ExeDir, NoGlobalJson, "0")
+ HostTestContext.BuiltDotNet.Exec(sharedTestState.HostApiInvokerApp.AppDll, api, f.ExeDir, NoGlobalJson, "0")
.EnableTracingAndCaptureOutputs()
.Execute()
.Should().Pass()
@@ -151,7 +151,7 @@ public void Hostfxr_resolve_sdk2_NoGlobalJson_DisallowPrerelease()
});
string api = ApiNames.hostfxr_resolve_sdk2;
- TestContext.BuiltDotNet.Exec(sharedTestState.HostApiInvokerApp.AppDll, api, f.ExeDir, NoGlobalJson, "disallow_prerelease")
+ HostTestContext.BuiltDotNet.Exec(sharedTestState.HostApiInvokerApp.AppDll, api, f.ExeDir, NoGlobalJson, "disallow_prerelease")
.EnableTracingAndCaptureOutputs()
.Execute()
.Should().Pass()
@@ -180,7 +180,7 @@ public void Hostfxr_resolve_sdk2_GlobalJson_DisallowPrerelease()
});
string api = ApiNames.hostfxr_resolve_sdk2;
- TestContext.BuiltDotNet.Exec(sharedTestState.HostApiInvokerApp.AppDll, api, f.ExeDir, workingDir.Location, "disallow_prerelease")
+ HostTestContext.BuiltDotNet.Exec(sharedTestState.HostApiInvokerApp.AppDll, api, f.ExeDir, workingDir.Location, "disallow_prerelease")
.EnableTracingAndCaptureOutputs()
.Execute()
.Should().Pass()
@@ -211,7 +211,7 @@ public void Hostfxr_resolve_sdk2_GlobalJson_Paths()
});
string api = ApiNames.hostfxr_resolve_sdk2;
- TestContext.BuiltDotNet.Exec(sharedTestState.HostApiInvokerApp.AppDll, api, f.ExeDir, workingDir.Location, "0")
+ HostTestContext.BuiltDotNet.Exec(sharedTestState.HostApiInvokerApp.AppDll, api, f.ExeDir, workingDir.Location, "0")
.EnableTracingAndCaptureOutputs()
.Execute()
.Should().Pass()
@@ -237,7 +237,7 @@ public void Hostfxr_resolve_sdk2_GlobalJson_InvalidJson()
});
string api = ApiNames.hostfxr_resolve_sdk2;
- TestContext.BuiltDotNet.Exec(sharedTestState.HostApiInvokerApp.AppDll, api, f.ExeDir, workingDir.Location, "0")
+ HostTestContext.BuiltDotNet.Exec(sharedTestState.HostApiInvokerApp.AppDll, api, f.ExeDir, workingDir.Location, "0")
.EnableTracingAndCaptureOutputs()
.Execute()
.Should().Pass()
@@ -264,7 +264,7 @@ public void Hostfxr_resolve_sdk2_GlobalJson_InvalidData()
});
string api = ApiNames.hostfxr_resolve_sdk2;
- TestContext.BuiltDotNet.Exec(sharedTestState.HostApiInvokerApp.AppDll, api, f.ExeDir, workingDir.Location, "0")
+ HostTestContext.BuiltDotNet.Exec(sharedTestState.HostApiInvokerApp.AppDll, api, f.ExeDir, workingDir.Location, "0")
.EnableTracingAndCaptureOutputs()
.Execute()
.Should().Pass()
@@ -292,7 +292,7 @@ public void Hostfxr_resolve_sdk2_GlobalJson_InvalidDataNoFallback()
});
string api = ApiNames.hostfxr_resolve_sdk2;
- TestContext.BuiltDotNet.Exec(sharedTestState.HostApiInvokerApp.AppDll, api, f.ExeDir, workingDir.Location, "0")
+ HostTestContext.BuiltDotNet.Exec(sharedTestState.HostApiInvokerApp.AppDll, api, f.ExeDir, workingDir.Location, "0")
.EnableTracingAndCaptureOutputs()
.Execute()
.Should().Pass()
@@ -304,7 +304,7 @@ public void Hostfxr_resolve_sdk2_GlobalJson_InvalidDataNoFallback()
[Fact]
public void Hostfxr_corehost_set_error_writer_test()
{
- TestContext.BuiltDotNet.Exec(sharedTestState.HostApiInvokerApp.AppDll, "Test_hostfxr_set_error_writer")
+ HostTestContext.BuiltDotNet.Exec(sharedTestState.HostApiInvokerApp.AppDll, "Test_hostfxr_set_error_writer")
.EnableTracingAndCaptureOutputs()
.Execute()
.Should().Pass();
@@ -323,7 +323,7 @@ public void Hostfxr_get_dotnet_environment_info_dotnet_root_only()
string expectedFrameworkPaths = string.Join(';', frameworks.Select(fw => Path.Combine(f.LocalFrameworksDir, fw.Name)));
string api = ApiNames.hostfxr_get_dotnet_environment_info;
- TestContext.BuiltDotNet.Exec(sharedTestState.HostApiInvokerApp.AppDll, api, f.ExeDir)
+ HostTestContext.BuiltDotNet.Exec(sharedTestState.HostApiInvokerApp.AppDll, api, f.ExeDir)
.EnableTracingAndCaptureOutputs()
.Execute()
.Should().Pass()
@@ -352,7 +352,7 @@ public void Hostfxr_get_dotnet_environment_info_DisabledVersions()
string expectedFrameworkPaths = string.Join(';', frameworks.Select(fw => Path.Combine(f.LocalFrameworksDir, fw.Name)));
string api = ApiNames.hostfxr_get_dotnet_environment_info;
- var result = TestContext.BuiltDotNet.Exec(sharedTestState.HostApiInvokerApp.AppDll, api, f.ExeDir)
+ var result = HostTestContext.BuiltDotNet.Exec(sharedTestState.HostApiInvokerApp.AppDll, api, f.ExeDir)
.EnableTracingAndCaptureOutputs()
.EnvironmentVariable(Constants.DisableRuntimeVersions.EnvironmentVariable, string.Join(';', disabledVersions))
.Execute();
@@ -373,7 +373,7 @@ public void Hostfxr_get_dotnet_environment_info_DisabledVersions()
public void Hostfxr_get_dotnet_environment_info_global_install_path()
{
string api = ApiNames.hostfxr_get_dotnet_environment_info;
- TestContext.BuiltDotNet.Exec(sharedTestState.HostApiInvokerApp.AppDll, api)
+ HostTestContext.BuiltDotNet.Exec(sharedTestState.HostApiInvokerApp.AppDll, api)
.EnableTracingAndCaptureOutputs()
.Execute()
.Should().Pass()
@@ -384,7 +384,7 @@ public void Hostfxr_get_dotnet_environment_info_global_install_path()
public void Hostfxr_get_dotnet_environment_info_result_is_nullptr_fails()
{
string api = ApiNames.hostfxr_get_dotnet_environment_info;
- TestContext.BuiltDotNet.Exec(sharedTestState.HostApiInvokerApp.AppDll, api, "test_invalid_result_ptr")
+ HostTestContext.BuiltDotNet.Exec(sharedTestState.HostApiInvokerApp.AppDll, api, "test_invalid_result_ptr")
.EnableTracingAndCaptureOutputs()
.Execute()
.Should().Pass()
@@ -396,7 +396,7 @@ public void Hostfxr_get_dotnet_environment_info_result_is_nullptr_fails()
public void Hostfxr_get_dotnet_environment_info_reserved_is_not_nullptr_fails()
{
string api = ApiNames.hostfxr_get_dotnet_environment_info;
- TestContext.BuiltDotNet.Exec(sharedTestState.HostApiInvokerApp.AppDll, api, "test_invalid_reserved_ptr")
+ HostTestContext.BuiltDotNet.Exec(sharedTestState.HostApiInvokerApp.AppDll, api, "test_invalid_reserved_ptr")
.EnableTracingAndCaptureOutputs()
.Execute()
.Should().Pass()
@@ -420,12 +420,12 @@ public void Hostfxr_resolve_frameworks_for_runtime_config(bool isMissing, bool w
.WithFramework(requested.Name, requested.Version)
.Save(withUtf8Bom);
- var builder = new DotNetBuilder(artifact.Location, TestContext.BuiltDotNet.BinPath, "dotnet");
+ var builder = new DotNetBuilder(artifact.Location, HostTestContext.BuiltDotNet.BinPath, "dotnet");
if (!isMissing)
builder.AddFramework(requested.Name, requested.Version, c => { });
DotNetCli dotnet = builder.Build();
- var result = TestContext.BuiltDotNet.Exec(sharedTestState.HostApiInvokerApp.AppDll, api, configPath, dotnet.BinPath)
+ var result = HostTestContext.BuiltDotNet.Exec(sharedTestState.HostApiInvokerApp.AppDll, api, configPath, dotnet.BinPath)
.CaptureStdOut()
.CaptureStdErr()
.Execute();
@@ -459,7 +459,7 @@ public void Hostfxr_resolve_frameworks_for_runtime_config_SelfContained()
config.Save();
- var result = TestContext.BuiltDotNet.Exec(sharedTestState.HostApiInvokerApp.AppDll, api, configPath)
+ var result = HostTestContext.BuiltDotNet.Exec(sharedTestState.HostApiInvokerApp.AppDll, api, configPath)
.CaptureStdOut()
.CaptureStdErr()
.Execute();
@@ -527,11 +527,11 @@ Constants.RollForwardSetting.Major or Constants.RollForwardSetting.LatestMajor
};
string actualVersion = version.ToString(3);
- DotNetCli dotnet = new DotNetBuilder(artifact.Location, TestContext.BuiltDotNet.BinPath, "dotnet")
+ DotNetCli dotnet = new DotNetBuilder(artifact.Location, HostTestContext.BuiltDotNet.BinPath, "dotnet")
.AddFramework(requested.Name, actualVersion, c => { })
.Build();
- var result = TestContext.BuiltDotNet.Exec(sharedTestState.HostApiInvokerApp.AppDll, api, configPath, dotnet.BinPath)
+ var result = HostTestContext.BuiltDotNet.Exec(sharedTestState.HostApiInvokerApp.AppDll, api, configPath, dotnet.BinPath)
.CaptureStdOut()
.CaptureStdErr()
.Execute();
@@ -561,16 +561,16 @@ public void Hostfxr_resolve_frameworks_for_runtime_config_NoDotnetRoot(bool isMi
if (isMissing)
{
// Request a higher major framework version than the one available relative to the running hostfxr
- Version existingVersion = Version.Parse(TestContext.MicrosoftNETCoreAppVersion.Contains('-')
- ? TestContext.MicrosoftNETCoreAppVersion[..TestContext.MicrosoftNETCoreAppVersion.IndexOf('-')]
- : TestContext.MicrosoftNETCoreAppVersion);
+ Version existingVersion = Version.Parse(HostTestContext.MicrosoftNETCoreAppVersion.Contains('-')
+ ? HostTestContext.MicrosoftNETCoreAppVersion[..HostTestContext.MicrosoftNETCoreAppVersion.IndexOf('-')]
+ : HostTestContext.MicrosoftNETCoreAppVersion);
Version newerVersion = new Version(existingVersion.Major + 1, existingVersion.Minor, existingVersion.Build);
requestedVersion = newerVersion.ToString(3);
}
else
{
// Request the framework version that is available relative to the running hostfxr
- requestedVersion = TestContext.MicrosoftNETCoreAppVersion;
+ requestedVersion = HostTestContext.MicrosoftNETCoreAppVersion;
}
(string Name, string Version) requested = (Constants.MicrosoftNETCoreApp, requestedVersion);
@@ -582,7 +582,7 @@ public void Hostfxr_resolve_frameworks_for_runtime_config_NoDotnetRoot(bool isMi
.Save();
// API should use the running hostfxr when dotnet root is not specified
- var result = TestContext.BuiltDotNet.Exec(sharedTestState.HostApiInvokerApp.AppDll, api, configPath)
+ var result = HostTestContext.BuiltDotNet.Exec(sharedTestState.HostApiInvokerApp.AppDll, api, configPath)
.CaptureStdOut()
.CaptureStdErr()
.Execute();
@@ -595,7 +595,7 @@ public void Hostfxr_resolve_frameworks_for_runtime_config_NoDotnetRoot(bool isMi
}
else
{
- result.Should().ReturnResolvedFramework(requested.Name, requested.Version, GetFrameworkPath(requested.Name, requested.Version, TestContext.BuiltDotNet.BinPath));
+ result.Should().ReturnResolvedFramework(requested.Name, requested.Version, GetFrameworkPath(requested.Name, requested.Version, HostTestContext.BuiltDotNet.BinPath));
}
}
}
@@ -620,7 +620,7 @@ public void Hostfxr_resolve_frameworks_for_runtime_config_MultipleFrameworks(boo
config.Save();
- var builder = new DotNetBuilder(artifact.Location, TestContext.BuiltDotNet.BinPath, "dotnet");
+ var builder = new DotNetBuilder(artifact.Location, HostTestContext.BuiltDotNet.BinPath, "dotnet");
foreach (var framework in expectedFrameworks)
{
builder.AddFramework(framework.Name, framework.Version, c => { });
@@ -628,7 +628,7 @@ public void Hostfxr_resolve_frameworks_for_runtime_config_MultipleFrameworks(boo
DotNetCli dotnet = builder.Build();
- var result = TestContext.BuiltDotNet.Exec(sharedTestState.HostApiInvokerApp.AppDll, api, configPath, dotnet.BinPath)
+ var result = HostTestContext.BuiltDotNet.Exec(sharedTestState.HostApiInvokerApp.AppDll, api, configPath, dotnet.BinPath)
.CaptureStdOut()
.CaptureStdErr()
.Execute();
@@ -668,12 +668,12 @@ public void Hostfxr_resolve_frameworks_for_runtime_config_IncompatibleFrameworks
config.Save();
var expectedFramework = requested[0];
- DotNetCli dotnet = new DotNetBuilder(artifact.Location, TestContext.BuiltDotNet.BinPath, "dotnet")
+ DotNetCli dotnet = new DotNetBuilder(artifact.Location, HostTestContext.BuiltDotNet.BinPath, "dotnet")
.AddFramework(expectedFramework.Name, expectedFramework.Version,
c => c.WithFramework(incompatibleHigher.Name, incompatibleHigher.Version))
.Build();
- TestContext.BuiltDotNet.Exec(sharedTestState.HostApiInvokerApp.AppDll, api, configPath, dotnet.BinPath)
+ HostTestContext.BuiltDotNet.Exec(sharedTestState.HostApiInvokerApp.AppDll, api, configPath, dotnet.BinPath)
.CaptureStdOut()
.CaptureStdErr()
.Execute()
@@ -698,14 +698,14 @@ public void Hostfxr_resolve_frameworks_for_runtime_config_InvalidConfig()
.WithFramework(requested.Name, requested.Version)
.Save();
- DotNetCli dotnet = new DotNetBuilder(artifact.Location, TestContext.BuiltDotNet.BinPath, "dotnet")
+ DotNetCli dotnet = new DotNetBuilder(artifact.Location, HostTestContext.BuiltDotNet.BinPath, "dotnet")
.AddFramework(requested.Name, requested.Version, c => { })
.Build();
string frameworkPath = Path.Combine(dotnet.BinPath, "shared", requested.Name, requested.Version);
File.WriteAllText(Path.Combine(frameworkPath, $"{requested.Name}.runtimeconfig.json"), "{}");
- TestContext.BuiltDotNet.Exec(sharedTestState.HostApiInvokerApp.AppDll, api, configPath, dotnet.BinPath)
+ HostTestContext.BuiltDotNet.Exec(sharedTestState.HostApiInvokerApp.AppDll, api, configPath, dotnet.BinPath)
.CaptureStdOut()
.CaptureStdErr()
.Execute()
@@ -738,7 +738,7 @@ public void Hostfxr_resolve_frameworks_for_runtime_config_MissingVersion(bool se
config.Save();
- TestContext.BuiltDotNet.Exec(sharedTestState.HostApiInvokerApp.AppDll, api, configPath, TestContext.BuiltDotNet.BinPath)
+ HostTestContext.BuiltDotNet.Exec(sharedTestState.HostApiInvokerApp.AppDll, api, configPath, HostTestContext.BuiltDotNet.BinPath)
.CaptureStdOut()
.CaptureStdErr()
.Execute()
@@ -751,7 +751,7 @@ public void Hostfxr_resolve_frameworks_for_runtime_config_MissingVersion(bool se
[Fact]
public void Hostpolicy_corehost_set_error_writer_test()
{
- TestContext.BuiltDotNet.Exec(sharedTestState.HostApiInvokerApp.AppDll, "Test_corehost_set_error_writer")
+ HostTestContext.BuiltDotNet.Exec(sharedTestState.HostApiInvokerApp.AppDll, "Test_corehost_set_error_writer")
.EnableTracingAndCaptureOutputs()
.Execute()
.Should().Pass();
@@ -761,12 +761,12 @@ public void Hostpolicy_corehost_set_error_writer_test()
public void HostRuntimeContract_get_runtime_property()
{
TestApp app = sharedTestState.HostApiInvokerApp;
- TestContext.BuiltDotNet.Exec(app.AppDll, "host_runtime_contract.get_runtime_property", "APP_CONTEXT_BASE_DIRECTORY", "RUNTIME_IDENTIFIER", "DOES_NOT_EXIST", "ENTRY_ASSEMBLY_NAME")
+ HostTestContext.BuiltDotNet.Exec(app.AppDll, "host_runtime_contract.get_runtime_property", "APP_CONTEXT_BASE_DIRECTORY", "RUNTIME_IDENTIFIER", "DOES_NOT_EXIST", "ENTRY_ASSEMBLY_NAME")
.EnableTracingAndCaptureOutputs()
.Execute()
.Should().Pass()
.And.HaveStdOutContaining($"APP_CONTEXT_BASE_DIRECTORY = {Path.GetDirectoryName(app.AppDll)}")
- .And.HaveStdOutContaining($"RUNTIME_IDENTIFIER = {TestContext.BuildRID}")
+ .And.HaveStdOutContaining($"RUNTIME_IDENTIFIER = {HostTestContext.BuildRID}")
.And.HaveStdOutContaining($"DOES_NOT_EXIST = ")
.And.HaveStdOutContaining($"ENTRY_ASSEMBLY_NAME = {app.AssemblyName}");
}
@@ -774,7 +774,7 @@ public void HostRuntimeContract_get_runtime_property()
[Fact]
public void HostRuntimeContract_bundle_probe()
{
- TestContext.BuiltDotNet.Exec(sharedTestState.HostApiInvokerApp.AppDll, "host_runtime_contract.bundle_probe", "APP_CONTEXT_BASE_DIRECTORY", "RUNTIME_IDENTIFIER", "DOES_NOT_EXIST", "ENTRY_ASSEMBLY_NAME")
+ HostTestContext.BuiltDotNet.Exec(sharedTestState.HostApiInvokerApp.AppDll, "host_runtime_contract.bundle_probe", "APP_CONTEXT_BASE_DIRECTORY", "RUNTIME_IDENTIFIER", "DOES_NOT_EXIST", "ENTRY_ASSEMBLY_NAME")
.EnableTracingAndCaptureOutputs()
.Execute()
.Should().Pass()
@@ -797,7 +797,7 @@ public SharedTestState()
// On non-Windows, we can't just P/Invoke to already loaded hostfxr, so provide the app with
// paths to hostfxr so that it can handle resolving the library.
RuntimeConfig.FromFile(HostApiInvokerApp.RuntimeConfigJson)
- .WithProperty("HOSTFXR_PATH", TestContext.BuiltDotNet.GreatestVersionHostFxrFilePath)
+ .WithProperty("HOSTFXR_PATH", HostTestContext.BuiltDotNet.GreatestVersionHostFxrFilePath)
.Save();
SdkAndFrameworkFixture = new SdkAndFrameworkFixture();
diff --git a/src/installer/tests/HostActivation.Tests/NativeHosting/ApplicationExecution.cs b/src/installer/tests/HostActivation.Tests/NativeHosting/ApplicationExecution.cs
index a91cd009aa20c0..028958ca357814 100644
--- a/src/installer/tests/HostActivation.Tests/NativeHosting/ApplicationExecution.cs
+++ b/src/installer/tests/HostActivation.Tests/NativeHosting/ApplicationExecution.cs
@@ -69,8 +69,8 @@ public class SharedTestState : SharedTestStateBase
public SharedTestState()
{
- DotNetRoot = TestContext.BuiltDotNet.BinPath;
- HostFxrPath = TestContext.BuiltDotNet.GreatestVersionHostFxrFilePath;
+ DotNetRoot = HostTestContext.BuiltDotNet.BinPath;
+ HostFxrPath = HostTestContext.BuiltDotNet.GreatestVersionHostFxrFilePath;
App = TestApp.CreateFromBuiltAssets("HelloWorld");
}
diff --git a/src/installer/tests/HostActivation.Tests/NativeHosting/Comhost.cs b/src/installer/tests/HostActivation.Tests/NativeHosting/Comhost.cs
index f16e4e1d0e8e7a..d50c33260ea818 100644
--- a/src/installer/tests/HostActivation.Tests/NativeHosting/Comhost.cs
+++ b/src/installer/tests/HostActivation.Tests/NativeHosting/Comhost.cs
@@ -12,13 +12,14 @@
namespace Microsoft.DotNet.CoreSetup.Test.HostActivation.NativeHosting
{
- [PlatformSpecific(TestPlatforms.Windows)] // COM activation is only supported on Windows
public class Comhost : IClassFixture
{
private readonly SharedTestState sharedState;
public Comhost(SharedTestState sharedTestState)
{
+ Assert.SkipUnless(OperatingSystem.IsWindows(), "COM activation is only supported on Windows");
+
sharedState = sharedTestState;
}
@@ -35,7 +36,7 @@ public void ActivateClass(int count, bool synchronous)
sharedState.ComHostPath,
sharedState.ClsidString
};
- CommandResult result = sharedState.CreateNativeHostCommand(args, TestContext.BuiltDotNet.BinPath)
+ CommandResult result = sharedState.CreateNativeHostCommand(args, HostTestContext.BuiltDotNet.BinPath)
.Execute();
result.Should().Pass()
@@ -68,7 +69,7 @@ public void ActivateClass_ContextConfig(bool inDefaultContext)
comHost,
sharedState.ClsidString
};
- CommandResult result = sharedState.CreateNativeHostCommand(args, TestContext.BuiltDotNet.BinPath)
+ CommandResult result = sharedState.CreateNativeHostCommand(args, HostTestContext.BuiltDotNet.BinPath)
.Execute();
result.Should().Pass()
@@ -101,7 +102,7 @@ public void ActivateClass_IgnoreAppLocalHostFxr()
comHostWithAppLocalFxr,
sharedState.ClsidString
};
- CommandResult result = sharedState.CreateNativeHostCommand(args, TestContext.BuiltDotNet.BinPath)
+ CommandResult result = sharedState.CreateNativeHostCommand(args, HostTestContext.BuiltDotNet.BinPath)
.Execute();
result.Should().Pass()
@@ -128,15 +129,15 @@ public void ActivateClass_IgnoreWorkingDirectory()
sharedState.ComHostPath,
sharedState.ClsidString
};
- sharedState.CreateNativeHostCommand(args, TestContext.BuiltDotNet.BinPath)
+ sharedState.CreateNativeHostCommand(args, HostTestContext.BuiltDotNet.BinPath)
.WorkingDirectory(cwd.Location)
.Execute()
.Should().Pass()
.And.HaveStdOutContaining("New instance of Server created")
.And.HaveStdOutContaining($"Activation of {sharedState.ClsidString} succeeded.")
- .And.ResolveHostFxr(TestContext.BuiltDotNet)
- .And.ResolveHostPolicy(TestContext.BuiltDotNet)
- .And.ResolveCoreClr(TestContext.BuiltDotNet);
+ .And.ResolveHostFxr(HostTestContext.BuiltDotNet)
+ .And.ResolveHostPolicy(HostTestContext.BuiltDotNet)
+ .And.ResolveCoreClr(HostTestContext.BuiltDotNet);
}
}
@@ -155,7 +156,7 @@ public void ActivateClass_ValidateIErrorInfoResult()
comHost,
sharedState.ClsidString
};
- CommandResult result = sharedState.CreateNativeHostCommand(args, TestContext.BuiltDotNet.BinPath)
+ CommandResult result = sharedState.CreateNativeHostCommand(args, HostTestContext.BuiltDotNet.BinPath)
.Execute();
result.Should().Pass()
@@ -173,7 +174,7 @@ public void LoadTypeLibraries()
sharedState.ComHostPath,
sharedState.ClsidString
};
- CommandResult result = sharedState.CreateNativeHostCommand(args, TestContext.BuiltDotNet.BinPath)
+ CommandResult result = sharedState.CreateNativeHostCommand(args, HostTestContext.BuiltDotNet.BinPath)
.Execute();
result.Should().Pass()
diff --git a/src/installer/tests/HostActivation.Tests/NativeHosting/ComhostSideBySide.cs b/src/installer/tests/HostActivation.Tests/NativeHosting/ComhostSideBySide.cs
index e6c70d5bbff0cf..92fcf314add651 100644
--- a/src/installer/tests/HostActivation.Tests/NativeHosting/ComhostSideBySide.cs
+++ b/src/installer/tests/HostActivation.Tests/NativeHosting/ComhostSideBySide.cs
@@ -11,13 +11,14 @@
namespace Microsoft.DotNet.CoreSetup.Test.HostActivation.NativeHosting
{
- [PlatformSpecific(TestPlatforms.Windows)] // COM activation is only supported on Windows
public class ComhostSideBySide : IClassFixture
{
private readonly SharedTestState sharedState;
public ComhostSideBySide(SharedTestState sharedTestState)
{
+ Assert.SkipUnless(OperatingSystem.IsWindows(), "COM activation is only supported on Windows");
+
sharedState = sharedTestState;
}
@@ -31,7 +32,7 @@ public void ActivateClass()
CommandResult result = Command.Create(sharedState.ComSxsPath, args)
.EnableTracingAndCaptureOutputs()
- .DotNetRoot(TestContext.BuiltDotNet.BinPath)
+ .DotNetRoot(HostTestContext.BuiltDotNet.BinPath)
.MultilevelLookup(false)
.Execute();
@@ -49,7 +50,7 @@ public void LocateEmbeddedTlb()
CommandResult result = Command.Create(sharedState.ComSxsPath, args)
.EnableTracingAndCaptureOutputs()
- .DotNetRoot(TestContext.BuiltDotNet.BinPath)
+ .DotNetRoot(HostTestContext.BuiltDotNet.BinPath)
.MultilevelLookup(false)
.Execute();
@@ -69,7 +70,7 @@ public void ManagedHost(bool selfContained)
TestApp app = selfContained ? sharedState.ManagedHost_SelfContained : sharedState.ManagedHost_FrameworkDependent;
CommandResult result = Command.Create(app.AppExe, args)
.EnableTracingAndCaptureOutputs()
- .DotNetRoot(TestContext.BuiltDotNet.BinPath)
+ .DotNetRoot(HostTestContext.BuiltDotNet.BinPath)
.MultilevelLookup(false)
.Execute();
diff --git a/src/installer/tests/HostActivation.Tests/NativeHosting/GetFunctionPointer.cs b/src/installer/tests/HostActivation.Tests/NativeHosting/GetFunctionPointer.cs
index 98eadc0b0769c3..8982e39fda6ef9 100644
--- a/src/installer/tests/HostActivation.Tests/NativeHosting/GetFunctionPointer.cs
+++ b/src/installer/tests/HostActivation.Tests/NativeHosting/GetFunctionPointer.cs
@@ -230,8 +230,8 @@ public class SharedTestState : SharedTestStateBase
public SharedTestState()
{
- DotNetRoot = TestContext.BuiltDotNet.BinPath;
- HostFxrPath = TestContext.BuiltDotNet.GreatestVersionHostFxrFilePath;
+ DotNetRoot = HostTestContext.BuiltDotNet.BinPath;
+ HostFxrPath = HostTestContext.BuiltDotNet.GreatestVersionHostFxrFilePath;
App = TestApp.CreateFromBuiltAssets("AppWithCustomEntryPoints");
Component = TestApp.CreateFromBuiltAssets("Component");
diff --git a/src/installer/tests/HostActivation.Tests/NativeHosting/GetNativeSearchDirectories.cs b/src/installer/tests/HostActivation.Tests/NativeHosting/GetNativeSearchDirectories.cs
index d382ff9244bd59..c4c047002d1e09 100644
--- a/src/installer/tests/HostActivation.Tests/NativeHosting/GetNativeSearchDirectories.cs
+++ b/src/installer/tests/HostActivation.Tests/NativeHosting/GetNativeSearchDirectories.cs
@@ -160,7 +160,7 @@ public class SharedTestState : SharedTestStateBase
public SharedTestState()
{
- DotNet = new DotNetBuilder(BaseDirectory, TestContext.BuiltDotNet.BinPath, "mockRuntime")
+ DotNet = new DotNetBuilder(BaseDirectory, HostTestContext.BuiltDotNet.BinPath, "mockRuntime")
.AddMicrosoftNETCoreAppFrameworkMockCoreClr(NetCoreAppVersion)
.Build();
diff --git a/src/installer/tests/HostActivation.Tests/NativeHosting/HostContext.FrameworkCompatibilityTestData.cs b/src/installer/tests/HostActivation.Tests/NativeHosting/HostContext.FrameworkCompatibilityTestData.cs
index caa2b8bd9da193..a23c52f5c5a85b 100644
--- a/src/installer/tests/HostActivation.Tests/NativeHosting/HostContext.FrameworkCompatibilityTestData.cs
+++ b/src/installer/tests/HostActivation.Tests/NativeHosting/HostContext.FrameworkCompatibilityTestData.cs
@@ -4,7 +4,7 @@
using System;
using System.Collections.Generic;
using Xunit;
-using Xunit.Abstractions;
+using Xunit.Sdk;
namespace Microsoft.DotNet.CoreSetup.Test.HostActivation.NativeHosting
{
diff --git a/src/installer/tests/HostActivation.Tests/NativeHosting/HostContext.PropertyCompatibilityTestData.cs b/src/installer/tests/HostActivation.Tests/NativeHosting/HostContext.PropertyCompatibilityTestData.cs
index 6028068c57ab10..6bc4c11753b4d0 100644
--- a/src/installer/tests/HostActivation.Tests/NativeHosting/HostContext.PropertyCompatibilityTestData.cs
+++ b/src/installer/tests/HostActivation.Tests/NativeHosting/HostContext.PropertyCompatibilityTestData.cs
@@ -4,7 +4,7 @@
using System;
using System.Collections.Generic;
using Xunit;
-using Xunit.Abstractions;
+using Xunit.Sdk;
namespace Microsoft.DotNet.CoreSetup.Test.HostActivation.NativeHosting
{
diff --git a/src/installer/tests/HostActivation.Tests/NativeHosting/HostContext.cs b/src/installer/tests/HostActivation.Tests/NativeHosting/HostContext.cs
index d1c87d8ade4064..20cf5f2b749dfb 100644
--- a/src/installer/tests/HostActivation.Tests/NativeHosting/HostContext.cs
+++ b/src/installer/tests/HostActivation.Tests/NativeHosting/HostContext.cs
@@ -327,10 +327,10 @@ public void RunApp_GetDelegate(string scenario, string checkProperties)
}
[Theory]
- [MemberData(nameof(GetFrameworkCompatibilityTestData), parameters: Scenario.ConfigMultiple)]
- [MemberData(nameof(GetFrameworkCompatibilityTestData), parameters: Scenario.Mixed)]
- [MemberData(nameof(GetFrameworkCompatibilityTestData), parameters: Scenario.NonContextMixedAppHost)]
- [MemberData(nameof(GetFrameworkCompatibilityTestData), parameters: Scenario.NonContextMixedDotnet)]
+ [MemberData(nameof(GetFrameworkCompatibilityTestData), Scenario.ConfigMultiple)]
+ [MemberData(nameof(GetFrameworkCompatibilityTestData), Scenario.Mixed)]
+ [MemberData(nameof(GetFrameworkCompatibilityTestData), Scenario.NonContextMixedAppHost)]
+ [MemberData(nameof(GetFrameworkCompatibilityTestData), Scenario.NonContextMixedDotnet)]
public void CompatibilityCheck_Frameworks(string scenario, FrameworkCompatibilityTestData testData)
{
if (scenario != Scenario.ConfigMultiple && scenario != Scenario.Mixed && scenario != Scenario.NonContextMixedAppHost && scenario != Scenario.NonContextMixedDotnet)
@@ -433,14 +433,14 @@ public void CompatibilityCheck_Frameworks(string scenario, FrameworkCompatibilit
}
[Theory]
- [MemberData(nameof(GetPropertyCompatibilityTestData), parameters: new object[] { Scenario.ConfigMultiple, false })]
- [MemberData(nameof(GetPropertyCompatibilityTestData), parameters: new object[] { Scenario.ConfigMultiple, true })]
- [MemberData(nameof(GetPropertyCompatibilityTestData), parameters: new object[] { Scenario.Mixed, false })]
- [MemberData(nameof(GetPropertyCompatibilityTestData), parameters: new object[] { Scenario.Mixed, true })]
- [MemberData(nameof(GetPropertyCompatibilityTestData), parameters: new object[] { Scenario.NonContextMixedAppHost, false })]
- [MemberData(nameof(GetPropertyCompatibilityTestData), parameters: new object[] { Scenario.NonContextMixedAppHost, true })]
- [MemberData(nameof(GetPropertyCompatibilityTestData), parameters: new object[] { Scenario.NonContextMixedDotnet, false })]
- [MemberData(nameof(GetPropertyCompatibilityTestData), parameters: new object[] { Scenario.NonContextMixedDotnet, true })]
+ [MemberData(nameof(GetPropertyCompatibilityTestData), arguments: new object[] { Scenario.ConfigMultiple, false })]
+ [MemberData(nameof(GetPropertyCompatibilityTestData), arguments: new object[] { Scenario.ConfigMultiple, true })]
+ [MemberData(nameof(GetPropertyCompatibilityTestData), arguments: new object[] { Scenario.Mixed, false })]
+ [MemberData(nameof(GetPropertyCompatibilityTestData), arguments: new object[] { Scenario.Mixed, true })]
+ [MemberData(nameof(GetPropertyCompatibilityTestData), arguments: new object[] { Scenario.NonContextMixedAppHost, false })]
+ [MemberData(nameof(GetPropertyCompatibilityTestData), arguments: new object[] { Scenario.NonContextMixedAppHost, true })]
+ [MemberData(nameof(GetPropertyCompatibilityTestData), arguments: new object[] { Scenario.NonContextMixedDotnet, false })]
+ [MemberData(nameof(GetPropertyCompatibilityTestData), arguments: new object[] { Scenario.NonContextMixedDotnet, true })]
public void CompatibilityCheck_Properties(string scenario, bool hasMultipleProperties, PropertyTestData[] properties)
{
if (scenario != Scenario.ConfigMultiple && scenario != Scenario.Mixed && scenario != Scenario.NonContextMixedAppHost && scenario != Scenario.NonContextMixedDotnet)
@@ -683,7 +683,7 @@ public class SharedTestState : SharedTestStateBase
public SharedTestState()
{
- var dotNet = new DotNetBuilder(BaseDirectory, TestContext.BuiltDotNet.BinPath, "mockRuntime")
+ var dotNet = new DotNetBuilder(BaseDirectory, HostTestContext.BuiltDotNet.BinPath, "mockRuntime")
.AddMicrosoftNETCoreAppFrameworkMockCoreClr(NetCoreAppVersion)
.Build();
DotNetRoot = dotNet.BinPath;
diff --git a/src/installer/tests/HostActivation.Tests/NativeHosting/Ijwhost.cs b/src/installer/tests/HostActivation.Tests/NativeHosting/Ijwhost.cs
index dc8deb024e0fab..44b8693d53c457 100644
--- a/src/installer/tests/HostActivation.Tests/NativeHosting/Ijwhost.cs
+++ b/src/installer/tests/HostActivation.Tests/NativeHosting/Ijwhost.cs
@@ -1,6 +1,7 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
+using System;
using System.IO;
using Microsoft.DotNet.Cli.Build.Framework;
@@ -8,13 +9,14 @@
namespace Microsoft.DotNet.CoreSetup.Test.HostActivation.NativeHosting
{
- [PlatformSpecific(TestPlatforms.Windows)] // IJW is only supported on Windows
public class Ijwhost : IClassFixture
{
private readonly SharedTestState sharedState;
public Ijwhost(SharedTestState sharedTestState)
{
+ Assert.SkipUnless(OperatingSystem.IsWindows(), "IJW is only supported on Windows");
+
sharedState = sharedTestState;
}
@@ -37,7 +39,7 @@ public void LoadLibrary(bool no_runtimeconfig)
File.Delete(app.RuntimeConfigJson);
}
- CommandResult result = sharedState.CreateNativeHostCommand(args, TestContext.BuiltDotNet.BinPath)
+ CommandResult result = sharedState.CreateNativeHostCommand(args, HostTestContext.BuiltDotNet.BinPath)
.Execute();
if (no_runtimeconfig)
@@ -72,7 +74,7 @@ public void LoadLibrary_ContextConfig(bool load_isolated)
.WithProperty("System.Runtime.InteropServices.CppCLI.LoadComponentInIsolatedContext", load_isolated.ToString())
.Save();
- CommandResult result = sharedState.CreateNativeHostCommand(args, TestContext.BuiltDotNet.BinPath)
+ CommandResult result = sharedState.CreateNativeHostCommand(args, HostTestContext.BuiltDotNet.BinPath)
.Execute();
result.Should().Pass()
@@ -104,15 +106,15 @@ public void LoadLibrary_IgnoreWorkingDirectory()
sharedState.IjwApp.AppDll,
"NativeEntryPoint"
};
- sharedState.CreateNativeHostCommand(args, TestContext.BuiltDotNet.BinPath)
+ sharedState.CreateNativeHostCommand(args, HostTestContext.BuiltDotNet.BinPath)
.WorkingDirectory(cwd.Location)
.Execute()
.Should().Pass()
.And.HaveStdOutContaining("[C++/CLI] NativeEntryPoint: calling managed class")
.And.HaveStdOutContaining("[C++/CLI] ManagedClass: AssemblyLoadContext = \"Default\" System.Runtime.Loader.DefaultAssemblyLoadContext")
- .And.ResolveHostFxr(TestContext.BuiltDotNet)
- .And.ResolveHostPolicy(TestContext.BuiltDotNet)
- .And.ResolveCoreClr(TestContext.BuiltDotNet);
+ .And.ResolveHostFxr(HostTestContext.BuiltDotNet)
+ .And.ResolveHostPolicy(HostTestContext.BuiltDotNet)
+ .And.ResolveCoreClr(HostTestContext.BuiltDotNet);
}
}
@@ -128,13 +130,13 @@ public void LoadLibraryWithoutRuntimeConfigButActiveRuntime()
"ijwhost",
app.AppDll,
"NativeEntryPoint",
- TestContext.BuiltDotNet.GreatestVersionHostFxrFilePath, // optional 4th and 5th arguments that tell nativehost to start the runtime before loading the C++/CLI library
+ HostTestContext.BuiltDotNet.GreatestVersionHostFxrFilePath, // optional 4th and 5th arguments that tell nativehost to start the runtime before loading the C++/CLI library
startupConfigPath
};
File.Move(app.RuntimeConfigJson, startupConfigPath);
- CommandResult result = sharedState.CreateNativeHostCommand(args, TestContext.BuiltDotNet.BinPath)
+ CommandResult result = sharedState.CreateNativeHostCommand(args, HostTestContext.BuiltDotNet.BinPath)
.Execute();
result.Should().Pass()
@@ -156,7 +158,7 @@ public void ManagedHost(bool selfContained)
TestApp app = selfContained ? sharedState.ManagedHost_SelfContained : sharedState.ManagedHost_FrameworkDependent;
CommandResult result = Command.Create(app.AppExe, args)
.EnableTracingAndCaptureOutputs()
- .DotNetRoot(TestContext.BuiltDotNet.BinPath)
+ .DotNetRoot(HostTestContext.BuiltDotNet.BinPath)
.MultilevelLookup(false)
.Execute();
@@ -174,6 +176,12 @@ public class SharedTestState : SharedTestStateBase
public SharedTestState()
{
+ if (!OperatingSystem.IsWindows())
+ {
+ // IJW is only supported on Windows, these tests are skipped in the constructor
+ return;
+ }
+
string folder = Path.Combine(BaseDirectory, "ijw");
IjwApp = new TestApp(folder, "ijw");
// Copy over ijwhost
@@ -194,7 +202,7 @@ public SharedTestState()
// Create a runtimeconfig.json for the C++/CLI test library
new RuntimeConfig(Path.Combine(folder, "ijw.runtimeconfig.json"))
- .WithFramework(new RuntimeConfig.Framework(Constants.MicrosoftNETCoreApp, TestContext.MicrosoftNETCoreAppVersion))
+ .WithFramework(new RuntimeConfig.Framework(Constants.MicrosoftNETCoreApp, HostTestContext.MicrosoftNETCoreAppVersion))
.Save();
ManagedHost_FrameworkDependent = TestApp.CreateFromBuiltAssets("ManagedHost");
diff --git a/src/installer/tests/HostActivation.Tests/NativeHosting/LoadAssembly.cs b/src/installer/tests/HostActivation.Tests/NativeHosting/LoadAssembly.cs
index ec221d3f952038..16c44b0aee963a 100644
--- a/src/installer/tests/HostActivation.Tests/NativeHosting/LoadAssembly.cs
+++ b/src/installer/tests/HostActivation.Tests/NativeHosting/LoadAssembly.cs
@@ -146,11 +146,11 @@ public class SharedTestState : SharedTestStateBase
public SharedTestState()
{
- DotNetRoot = TestContext.BuiltDotNet.BinPath;
- HostFxrPath = TestContext.BuiltDotNet.GreatestVersionHostFxrFilePath;
+ DotNetRoot = HostTestContext.BuiltDotNet.BinPath;
+ HostFxrPath = HostTestContext.BuiltDotNet.GreatestVersionHostFxrFilePath;
Application = TestApp.CreateEmpty("App");
- Application.PopulateFrameworkDependent(Constants.MicrosoftNETCoreApp, TestContext.MicrosoftNETCoreAppVersion);
+ Application.PopulateFrameworkDependent(Constants.MicrosoftNETCoreApp, HostTestContext.MicrosoftNETCoreAppVersion);
SelfContainedApplication = TestApp.CreateEmpty("SelfContainedApp");
SelfContainedApplication.PopulateSelfContained(TestApp.MockedComponent.None);
diff --git a/src/installer/tests/HostActivation.Tests/NativeHosting/LoadAssemblyAndGetFunctionPointer.cs b/src/installer/tests/HostActivation.Tests/NativeHosting/LoadAssemblyAndGetFunctionPointer.cs
index bb13eeafee1c08..d2e5b194030ef7 100644
--- a/src/installer/tests/HostActivation.Tests/NativeHosting/LoadAssemblyAndGetFunctionPointer.cs
+++ b/src/installer/tests/HostActivation.Tests/NativeHosting/LoadAssemblyAndGetFunctionPointer.cs
@@ -259,8 +259,8 @@ public void CallDelegateOnComponentContext_IgnoreWorkingDirectory()
.Should().Pass()
.And.InitializeContextForConfig(component.RuntimeConfigJson)
.And.ExecuteFunctionPointer(sharedState.ComponentEntryPoint1, 1, 1)
- .And.ResolveHostPolicy(TestContext.BuiltDotNet)
- .And.ResolveCoreClr(TestContext.BuiltDotNet);
+ .And.ResolveHostPolicy(HostTestContext.BuiltDotNet)
+ .And.ResolveCoreClr(HostTestContext.BuiltDotNet);
}
}
@@ -280,8 +280,8 @@ public class SharedTestState : SharedTestStateBase
public SharedTestState()
{
- DotNetRoot = TestContext.BuiltDotNet.BinPath;
- HostFxrPath = TestContext.BuiltDotNet.GreatestVersionHostFxrFilePath;
+ DotNetRoot = HostTestContext.BuiltDotNet.BinPath;
+ HostFxrPath = HostTestContext.BuiltDotNet.GreatestVersionHostFxrFilePath;
Component = TestApp.CreateFromBuiltAssets("Component");
diff --git a/src/installer/tests/HostActivation.Tests/NativeHosting/Nethost.cs b/src/installer/tests/HostActivation.Tests/NativeHosting/Nethost.cs
index 2a3fff034fe684..cf950ca14b669e 100644
--- a/src/installer/tests/HostActivation.Tests/NativeHosting/Nethost.cs
+++ b/src/installer/tests/HostActivation.Tests/NativeHosting/Nethost.cs
@@ -117,7 +117,7 @@ public void GetHostFxrPath_GlobalInstallation(bool explicitLoad, bool useAssembl
{
if (useRegisteredLocation)
{
- registeredInstallLocationOverride.SetInstallLocation((TestContext.BuildArchitecture, installLocation));
+ registeredInstallLocationOverride.SetInstallLocation((HostTestContext.BuildArchitecture, installLocation));
}
result = Command.Create(sharedState.NativeHostPath, $"{GetHostFxrPath} {explicitLoad} {(useAssemblyPath ? sharedState.TestAssemblyPath : string.Empty)}")
@@ -206,7 +206,7 @@ public void GetHostFxrPath_InstallLocationFile(string value, bool shouldUseArchS
using (var registeredInstallLocationOverride = new RegisteredInstallLocationOverride(sharedState.NethostPath))
{
if (shouldUseArchSpecificInstallLocation)
- registeredInstallLocationOverride.SetInstallLocation((TestContext.BuildArchitecture, string.Format(value, installLocation)));
+ registeredInstallLocationOverride.SetInstallLocation((HostTestContext.BuildArchitecture, string.Format(value, installLocation)));
else
registeredInstallLocationOverride.SetInstallLocation((string.Empty, string.Format(value, installLocation)));
@@ -223,7 +223,7 @@ public void GetHostFxrPath_InstallLocationFile(string value, bool shouldUseArchS
{
result.Should().HaveLookedForArchitectureSpecificInstallLocation(
registeredInstallLocationOverride.PathValueOverride,
- TestContext.BuildArchitecture);
+ HostTestContext.BuildArchitecture);
}
else
{
@@ -254,7 +254,7 @@ public void GetHostFxrPath_GlobalInstallation_HasNoDefaultInstallationPath()
using (var registeredInstallLocationOverride = new RegisteredInstallLocationOverride(sharedState.NethostPath))
{
registeredInstallLocationOverride.SetInstallLocation(new (string, string)[] {
- (TestContext.BuildArchitecture, installLocation),
+ (HostTestContext.BuildArchitecture, installLocation),
("someOtherArch", $"{installLocation}/invalid")
});
@@ -270,7 +270,7 @@ public void GetHostFxrPath_GlobalInstallation_HasNoDefaultInstallationPath()
result.Should().Pass()
.And.HaveLookedForArchitectureSpecificInstallLocation(
registeredInstallLocationOverride.PathValueOverride,
- TestContext.BuildArchitecture)
+ HostTestContext.BuildArchitecture)
.And.HaveUsedRegisteredInstallLocation(installLocation)
.And.HaveStdOutContaining($"hostfxr_path: {sharedState.HostFxrPath}".ToLower());
}
@@ -285,7 +285,7 @@ public void GetHostFxrPath_GlobalInstallation_ArchitectureSpecificPathIsPickedOv
{
registeredInstallLocationOverride.SetInstallLocation(new (string, string)[] {
(string.Empty, $"{installLocation}/a/b/c"),
- (TestContext.BuildArchitecture, installLocation)
+ (HostTestContext.BuildArchitecture, installLocation)
});
CommandResult result = Command.Create(sharedState.NativeHostPath, GetHostFxrPath)
@@ -300,7 +300,7 @@ public void GetHostFxrPath_GlobalInstallation_ArchitectureSpecificPathIsPickedOv
result.Should().Pass()
.And.HaveLookedForArchitectureSpecificInstallLocation(
registeredInstallLocationOverride.PathValueOverride,
- TestContext.BuildArchitecture)
+ HostTestContext.BuildArchitecture)
.And.HaveUsedRegisteredInstallLocation(installLocation)
.And.HaveStdOutContaining($"hostfxr_path: {sharedState.HostFxrPath}".ToLower());
}
diff --git a/src/installer/tests/HostActivation.Tests/RegisteredInstallLocationOverride.cs b/src/installer/tests/HostActivation.Tests/RegisteredInstallLocationOverride.cs
index bb2fe9f7785bf1..9fc4e569760d14 100644
--- a/src/installer/tests/HostActivation.Tests/RegisteredInstallLocationOverride.cs
+++ b/src/installer/tests/HostActivation.Tests/RegisteredInstallLocationOverride.cs
@@ -57,7 +57,7 @@ public RegisteredInstallLocationOverride(string productBinaryPath)
// On Linux/macOS the install location is registered in a file which is normally
// located in /etc/dotnet/install_location
// So we need to redirect it to a different place here.
- string directory = Path.Combine(TestContext.TestArtifactsPath, "installLocationOverride" + Process.GetCurrentProcess().Id.ToString());
+ string directory = Path.Combine(HostTestContext.TestArtifactsPath, "installLocationOverride" + Process.GetCurrentProcess().Id.ToString());
if (Directory.Exists(directory))
Directory.Delete(directory, true);
Directory.CreateDirectory(directory);
diff --git a/src/installer/tests/HostActivation.Tests/RuntimeProperties.cs b/src/installer/tests/HostActivation.Tests/RuntimeProperties.cs
index 39b872df613288..3bc19014bf379b 100644
--- a/src/installer/tests/HostActivation.Tests/RuntimeProperties.cs
+++ b/src/installer/tests/HostActivation.Tests/RuntimeProperties.cs
@@ -131,9 +131,9 @@ public class SharedTestState : IDisposable
public SharedTestState()
{
// Make a copy of the built .NET, as we will update the framework's runtime config
- copiedDotnet = TestArtifact.CreateFromCopy("runtimeProperties", TestContext.BuiltDotNet.BinPath);
+ copiedDotnet = TestArtifact.CreateFromCopy("runtimeProperties", HostTestContext.BuiltDotNet.BinPath);
- MockSDK = new DotNetBuilder(copiedDotnet.Location, TestContext.BuiltDotNet.BinPath, "mocksdk")
+ MockSDK = new DotNetBuilder(copiedDotnet.Location, HostTestContext.BuiltDotNet.BinPath, "mocksdk")
.AddMicrosoftNETCoreAppFrameworkMockCoreClr("9999.0.0")
.AddMockSDK("9999.0.0-dev", "9999.0.0")
.Build();
diff --git a/src/installer/tests/HostActivation.Tests/SDKLookup.cs b/src/installer/tests/HostActivation.Tests/SDKLookup.cs
index d633ec94d8d0f8..3c6135b09b4a71 100644
--- a/src/installer/tests/HostActivation.Tests/SDKLookup.cs
+++ b/src/installer/tests/HostActivation.Tests/SDKLookup.cs
@@ -26,7 +26,7 @@ public SDKLookup(SharedTestState sharedState)
SharedState = sharedState;
string exeDotNetPath = sharedState.BaseArtifact.GetUniqueSubdirectory("exe");
- ExecutableDotNetBuilder = new DotNetBuilder(exeDotNetPath, TestContext.BuiltDotNet.BinPath, null);
+ ExecutableDotNetBuilder = new DotNetBuilder(exeDotNetPath, HostTestContext.BuiltDotNet.BinPath, null);
ExecutableDotNet = ExecutableDotNetBuilder
.AddMicrosoftNETCoreAppFrameworkMockHostPolicy("9999.0.0")
.Build();
@@ -1224,7 +1224,7 @@ public SharedTestState()
// All dirs will be placed inside the base folder
// Executable location is created per test as each test adds a different set of SDK versions
- var currentWorkingSdk = new DotNetBuilder(BaseArtifact.Location, TestContext.BuiltDotNet.BinPath, "current")
+ var currentWorkingSdk = new DotNetBuilder(BaseArtifact.Location, HostTestContext.BuiltDotNet.BinPath, "current")
.AddMockSDK("10000.0.0", "9999.0.0")
.Build();
CurrentWorkingDir = currentWorkingSdk.BinPath;
diff --git a/src/installer/tests/HostActivation.Tests/SelfContainedAppLaunch.cs b/src/installer/tests/HostActivation.Tests/SelfContainedAppLaunch.cs
index 23f5dd91756d9d..5bad3a3b9e7b3a 100644
--- a/src/installer/tests/HostActivation.Tests/SelfContainedAppLaunch.cs
+++ b/src/installer/tests/HostActivation.Tests/SelfContainedAppLaunch.cs
@@ -37,21 +37,23 @@ public void Default()
.Execute()
.Should().Pass()
.And.HaveStdOutContaining("Hello World")
- .And.HaveStdOutContaining(TestContext.MicrosoftNETCoreAppVersion);
+ .And.HaveStdOutContaining(HostTestContext.MicrosoftNETCoreAppVersion);
if (OperatingSystem.IsWindows())
{
// App sets FileVersion to NETCoreApp version. On Windows, this should be copied to app resources.
- string expectedVersion = TestContext.MicrosoftNETCoreAppVersion.Contains('-')
- ? TestContext.MicrosoftNETCoreAppVersion[..TestContext.MicrosoftNETCoreAppVersion.IndexOf('-')]
- : TestContext.MicrosoftNETCoreAppVersion;
+ string expectedVersion = HostTestContext.MicrosoftNETCoreAppVersion.Contains('-')
+ ? HostTestContext.MicrosoftNETCoreAppVersion[..HostTestContext.MicrosoftNETCoreAppVersion.IndexOf('-')]
+ : HostTestContext.MicrosoftNETCoreAppVersion;
Assert.Equal(expectedVersion, System.Diagnostics.FileVersionInfo.GetVersionInfo(appExe).FileVersion);
}
}
- [ConditionalFact(typeof(Binaries.CetCompat), nameof(Binaries.CetCompat.IsSupported))]
+ [Fact]
public void AppHost_DisableCetCompat()
{
+ Assert.SkipUnless(Binaries.CetCompat.IsSupported, "CET not supported on this platform");
+
TestApp app = sharedTestState.App.Copy();
app.CreateAppHost(disableCetCompat: true);
Assert.False(Binaries.CetCompat.IsMarkedCompatible(app.AppExe));
@@ -62,7 +64,7 @@ public void AppHost_DisableCetCompat()
.Execute()
.Should().Pass()
.And.HaveStdOutContaining("Hello World")
- .And.HaveStdOutContaining(TestContext.MicrosoftNETCoreAppVersion);
+ .And.HaveStdOutContaining(HostTestContext.MicrosoftNETCoreAppVersion);
}
[Fact]
@@ -80,7 +82,7 @@ public void NoDepsJson_NoRuntimeConfig()
.Execute()
.Should().Pass()
// Note that this is an exact match - we don't expect any output from the host itself
- .And.HaveStdOut($"Hello World!{Environment.NewLine}{Environment.NewLine}.NET {TestContext.MicrosoftNETCoreAppVersion}{Environment.NewLine}")
+ .And.HaveStdOut($"Hello World!{Environment.NewLine}{Environment.NewLine}.NET {HostTestContext.MicrosoftNETCoreAppVersion}{Environment.NewLine}")
.And.NotHaveStdErr();
// Make sure tracing indicates there is no runtime config and no deps json
@@ -88,7 +90,7 @@ public void NoDepsJson_NoRuntimeConfig()
.EnableTracingAndCaptureOutputs()
.Execute()
.Should().Pass()
- .And.HaveStdOut($"Hello World!{Environment.NewLine}{Environment.NewLine}.NET {TestContext.MicrosoftNETCoreAppVersion}{Environment.NewLine}")
+ .And.HaveStdOut($"Hello World!{Environment.NewLine}{Environment.NewLine}.NET {HostTestContext.MicrosoftNETCoreAppVersion}{Environment.NewLine}")
.And.HaveStdErrContaining($"Runtime config does not exist at [{app.RuntimeConfigJson}]")
.And.HaveStdErrContaining($"Dependencies manifest does not exist at [{app.DepsJson}]");
}
@@ -107,7 +109,7 @@ public void RenameApphost()
.Execute()
.Should().Pass()
.And.HaveStdOutContaining("Hello World")
- .And.HaveStdOutContaining(TestContext.MicrosoftNETCoreAppVersion);
+ .And.HaveStdOutContaining(HostTestContext.MicrosoftNETCoreAppVersion);
}
[Fact]
@@ -134,7 +136,7 @@ public void RelativeEmbeddedPath()
.Execute()
.Should().Pass()
.And.HaveStdOutContaining("Hello World")
- .And.HaveStdOutContaining(TestContext.MicrosoftNETCoreAppVersion);
+ .And.HaveStdOutContaining(HostTestContext.MicrosoftNETCoreAppVersion);
}
[Fact]
@@ -156,13 +158,13 @@ public void DotNetRoot_IncorrectLayout_Fails()
.DotNetRoot(app.Location)
.Execute()
.Should().Fail()
- .And.HaveUsedDotNetRootInstallLocation(Path.GetFullPath(app.Location), TestContext.BuildRID)
+ .And.HaveUsedDotNetRootInstallLocation(Path.GetFullPath(app.Location), HostTestContext.BuildRID)
.And.HaveStdErrContaining($"The required library {Binaries.HostFxr.FileName} could not be found.");
}
- [Fact]
+ [Fact]
[PlatformSpecific(TestPlatforms.Windows)]
- public void DevicePath()
+ public void Exe_activation_of_GUI_App()
{
string appExe = $@"\\?\{sharedTestState.App.AppExe}";
Command.Create(appExe)
@@ -171,7 +173,7 @@ public void DevicePath()
.Execute()
.Should().Pass()
.And.HaveStdOutContaining("Hello World")
- .And.HaveStdOutContaining(TestContext.MicrosoftNETCoreAppVersion);
+ .And.HaveStdOutContaining(HostTestContext.MicrosoftNETCoreAppVersion);
appExe = $@"\\.\{sharedTestState.App.AppExe}";
Command.Create(appExe)
@@ -180,7 +182,7 @@ public void DevicePath()
.Execute()
.Should().Pass()
.And.HaveStdOutContaining("Hello World")
- .And.HaveStdOutContaining(TestContext.MicrosoftNETCoreAppVersion);
+ .And.HaveStdOutContaining(HostTestContext.MicrosoftNETCoreAppVersion);
}
[Fact]
@@ -191,7 +193,7 @@ public void CustomRuntimeLocation()
{
// Find the NETCoreApp runtime pack
RuntimeLibraryBuilder netCoreApp = b.RuntimeLibraries.First(
- r => r.Type == RuntimeLibraryType.runtimepack.ToString() && r.Name == $"runtimepack.{Constants.MicrosoftNETCoreApp}.Runtime.{TestContext.BuildRID}");
+ r => r.Type == RuntimeLibraryType.runtimepack.ToString() && r.Name == $"runtimepack.{Constants.MicrosoftNETCoreApp}.Runtime.{HostTestContext.BuildRID}");
// Update all NETCoreApp asset paths to point to the subdirectory
RuntimeAssetGroupBuilder[] groups = [.. netCoreApp.AssemblyGroups, .. netCoreApp.NativeLibraryGroups];
@@ -224,7 +226,7 @@ public void CustomRuntimeLocation()
.Execute()
.Should().Pass()
.And.HaveStdOutContaining("Hello World")
- .And.HaveStdOutContaining(TestContext.MicrosoftNETCoreAppVersion)
+ .And.HaveStdOutContaining(HostTestContext.MicrosoftNETCoreAppVersion)
.And.HaveStdErrContaining($"CoreCLR path = '{Path.Join(app.Location, subdirectory, Binaries.CoreClr.FileName)}'");
}
diff --git a/src/installer/tests/HostActivation.Tests/StartupHooks.cs b/src/installer/tests/HostActivation.Tests/StartupHooks.cs
index f902cdf849d3be..6f535a6112832e 100644
--- a/src/installer/tests/HostActivation.Tests/StartupHooks.cs
+++ b/src/installer/tests/HostActivation.Tests/StartupHooks.cs
@@ -29,7 +29,7 @@ public void Muxer_activation_of_RuntimeConfig_StartupHook_Succeeds()
.Save();
// RuntimeConfig defined startup hook
- TestContext.BuiltDotNet.Exec(app.AppDll)
+ HostTestContext.BuiltDotNet.Exec(app.AppDll)
.EnableTracingAndCaptureOutputs()
.Execute()
.Should().Pass()
@@ -55,7 +55,7 @@ public void Muxer_activation_of_RuntimeConfig_And_Environment_StartupHooks_Succe
const string wildcardPattern = @"[\r\n\s.]*";
// RuntimeConfig and Environment startup hooks in expected order
- TestContext.BuiltDotNet.Exec(app.AppDll)
+ HostTestContext.BuiltDotNet.Exec(app.AppDll)
.EnvironmentVariable(startupHookVarName, startupHook2Dll)
.CaptureStdOut()
.CaptureStdErr()
@@ -73,7 +73,7 @@ public void Muxer_activation_of_RuntimeConfig_And_Environment_StartupHooks_Succe
public void Muxer_activation_of_Empty_StartupHook_Variable_Succeeds()
{
var startupHookVar = "";
- TestContext.BuiltDotNet.Exec(sharedTestState.App.AppDll)
+ HostTestContext.BuiltDotNet.Exec(sharedTestState.App.AppDll)
.EnvironmentVariable(startupHookVarName, startupHookVar)
.CaptureStdOut()
.CaptureStdErr()
@@ -90,7 +90,7 @@ public void Muxer_activation_of_StartupHook_With_Missing_Dependencies_Fails()
var startupHookDll = sharedTestState.StartupHookWithAssemblyResolver.AppDll;
// Startup hook has a dependency not on the TPA list
- TestContext.BuiltDotNet.Exec(sharedTestState.App.AppDll)
+ HostTestContext.BuiltDotNet.Exec(sharedTestState.App.AppDll)
.EnvironmentVariable(startupHookVarName, startupHookDll)
// Indicate that the startup hook should try to use a dependency
.EnvironmentVariable("TEST_STARTUPHOOK_USE_DEPENDENCY", true.ToString())
@@ -109,7 +109,7 @@ public void Muxer_activation_of_StartupHook_With_Assembly_Resolver()
var startupHookDll = sharedTestState.StartupHookWithAssemblyResolver.AppDll;
// Startup hook with assembly resolver results in use of injected dependency
- TestContext.BuiltDotNet.Exec(sharedTestState.App.AppDll, "load_shared_library")
+ HostTestContext.BuiltDotNet.Exec(sharedTestState.App.AppDll, "load_shared_library")
.EnvironmentVariable(startupHookVarName, startupHookDll)
// Indicate that the startup hook should add an assembly resolver
.EnvironmentVariable("TEST_STARTUPHOOK_ADD_RESOLVER", true.ToString())
@@ -133,7 +133,7 @@ public void Muxer_activation_of_StartupHook_With_IsSupported_False()
// Startup hooks are not executed when the StartupHookSupport
// feature switch is set to false.
- TestContext.BuiltDotNet.Exec(app.AppDll)
+ HostTestContext.BuiltDotNet.Exec(app.AppDll)
.EnvironmentVariable(startupHookVarName, startupHookDll)
.CaptureStdOut()
.CaptureStdErr()
diff --git a/src/installer/tests/HostActivation.Tests/SymbolicLinks.cs b/src/installer/tests/HostActivation.Tests/SymbolicLinks.cs
index 5afab32a0881d2..a80d9c9e014e90 100644
--- a/src/installer/tests/HostActivation.Tests/SymbolicLinks.cs
+++ b/src/installer/tests/HostActivation.Tests/SymbolicLinks.cs
@@ -46,7 +46,7 @@ public void Symlink_all_files_fx(string symlinkRelativePath)
var result = Command.Create(Path.Combine(testDir.Location, symlinkRelativePath, Path.GetFileName(sharedTestState.FrameworkDependentApp.AppExe)))
.CaptureStdErr()
.CaptureStdOut()
- .DotNetRoot(TestContext.BuiltDotNet.BinPath)
+ .DotNetRoot(HostTestContext.BuiltDotNet.BinPath)
.Execute();
// This should succeed on all platforms, but for different reasons:
@@ -113,7 +113,7 @@ public void Symlink_split_files_fx(string symlinkRelativePath)
var result = Command.Create(Path.Combine(targetPath, appHostName))
.CaptureStdErr()
.CaptureStdOut()
- .DotNetRoot(TestContext.BuiltDotNet.BinPath)
+ .DotNetRoot(HostTestContext.BuiltDotNet.BinPath)
.Execute();
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
@@ -163,7 +163,7 @@ public void Symlink_all_files_self_contained(string symlinkRelativePath)
var result = Command.Create(Path.Combine(testDir.Location, symlinkRelativePath, Path.GetFileName(sharedTestState.FrameworkDependentApp.AppExe)))
.CaptureStdErr()
.CaptureStdOut()
- .DotNetRoot(TestContext.BuiltDotNet.BinPath)
+ .DotNetRoot(HostTestContext.BuiltDotNet.BinPath)
.Execute();
// This should succeed on all platforms, but for different reasons:
@@ -272,7 +272,7 @@ public void Run_framework_dependent_app_behind_symlink(string symlinkRelativePat
var result = Command.Create(symlink.SrcPath)
.CaptureStdErr()
.CaptureStdOut()
- .DotNetRoot(TestContext.BuiltDotNet.BinPath)
+ .DotNetRoot(HostTestContext.BuiltDotNet.BinPath)
.Execute();
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
@@ -299,7 +299,7 @@ public void Run_framework_dependent_app_with_runtime_behind_symlink()
{
var dotnetSymlink = Path.Combine(testDir.Location, Binaries.GetExeName("dotnet"));
- using var symlink = new SymLink(dotnetSymlink, TestContext.BuiltDotNet.BinPath);
+ using var symlink = new SymLink(dotnetSymlink, HostTestContext.BuiltDotNet.BinPath);
Command.Create(sharedTestState.FrameworkDependentApp.AppExe)
.EnvironmentVariable("DOTNET_ROOT", symlink.SrcPath)
.CaptureStdErr()
@@ -337,7 +337,7 @@ public void Put_dotnet_behind_symlink()
{
var dotnetSymlink = Path.Combine(testDir.Location, Binaries.DotNet.FileName);
- using var symlink = new SymLink(dotnetSymlink, TestContext.BuiltDotNet.DotnetExecutablePath);
+ using var symlink = new SymLink(dotnetSymlink, HostTestContext.BuiltDotNet.DotnetExecutablePath);
var result = Command.Create(symlink.SrcPath, sharedTestState.SelfContainedApp.AppDll)
.CaptureStdErr()
.CaptureStdOut()
@@ -369,7 +369,7 @@ public void Put_app_directory_behind_symlink_and_use_dotnet()
Directory.Move(app.Location, newAppDir.Location);
using var symlink = new SymLink(app.Location, newAppDir.Location);
- TestContext.BuiltDotNet.Exec(app.AppDll)
+ HostTestContext.BuiltDotNet.Exec(app.AppDll)
.CaptureStdErr()
.CaptureStdOut()
.Execute()
diff --git a/src/installer/tests/HostActivation.Tests/Tracing.cs b/src/installer/tests/HostActivation.Tests/Tracing.cs
index 9c0eb97c1f08ab..72c1fc2367cd31 100644
--- a/src/installer/tests/HostActivation.Tests/Tracing.cs
+++ b/src/installer/tests/HostActivation.Tests/Tracing.cs
@@ -18,7 +18,7 @@ public class Tracing
[Fact]
public void TracingOff()
{
- TestContext.BuiltDotNet.Exec("--list-runtimes")
+ HostTestContext.BuiltDotNet.Exec("--list-runtimes")
.CaptureStdOut()
.CaptureStdErr()
.Execute()
@@ -30,7 +30,7 @@ public void TracingOff()
[Fact]
public void TracingOnDefault()
{
- TestContext.BuiltDotNet.Exec("--list-runtimes")
+ HostTestContext.BuiltDotNet.Exec("--list-runtimes")
.EnableTracingAndCaptureOutputs()
.Execute()
.Should().Pass()
@@ -41,7 +41,7 @@ public void TracingOnDefault()
[Fact]
public void TracingOnVerbose()
{
- TestContext.BuiltDotNet.Exec("--list-runtimes")
+ HostTestContext.BuiltDotNet.Exec("--list-runtimes")
.EnableTracingAndCaptureOutputs()
.EnvironmentVariable(Constants.HostTracing.VerbosityEnvironmentVariable, "4")
.Execute()
@@ -53,7 +53,7 @@ public void TracingOnVerbose()
[Fact]
public void TracingOnInfo()
{
- TestContext.BuiltDotNet.Exec("--list-runtimes")
+ HostTestContext.BuiltDotNet.Exec("--list-runtimes")
.EnableTracingAndCaptureOutputs()
.EnvironmentVariable(Constants.HostTracing.VerbosityEnvironmentVariable, "3")
.Execute()
@@ -65,7 +65,7 @@ public void TracingOnInfo()
[Fact]
public void TracingOnWarning()
{
- TestContext.BuiltDotNet.Exec("--list-runtimes")
+ HostTestContext.BuiltDotNet.Exec("--list-runtimes")
.EnableTracingAndCaptureOutputs()
.EnvironmentVariable(Constants.HostTracing.VerbosityEnvironmentVariable, "2")
.Execute()
@@ -78,7 +78,7 @@ public void TracingOnWarning()
public void TracingOnToFileDefault()
{
string traceFilePath;
- TestContext.BuiltDotNet.Exec("--list-runtimes")
+ HostTestContext.BuiltDotNet.Exec("--list-runtimes")
.EnableHostTracingToFile(out traceFilePath)
.CaptureStdOut()
.CaptureStdErr()
@@ -95,7 +95,7 @@ public void TracingOnToFileDefault()
[Fact]
public void TracingOnToFileBadPathDefault()
{
- TestContext.BuiltDotNet.Exec("--list-runtimes")
+ HostTestContext.BuiltDotNet.Exec("--list-runtimes")
.EnableTracingAndCaptureOutputs()
.EnvironmentVariable(Constants.HostTracing.TraceFileEnvironmentVariable, "badpath/TracingOnToFileBadPathDefault.log")
.Execute()
@@ -110,7 +110,7 @@ public void TracingOnToDirectory()
{
using (TestArtifact directory = TestArtifact.Create("trace"))
{
- var result = TestContext.BuiltDotNet.Exec("--list-runtimes")
+ var result = HostTestContext.BuiltDotNet.Exec("--list-runtimes")
.EnableHostTracingToPath(directory.Location)
.CaptureStdOut()
.CaptureStdErr()
@@ -128,7 +128,7 @@ public void TracingOnToDirectory()
[Fact]
public void LegacyVariableName()
{
- TestContext.BuiltDotNet.Exec("--list-runtimes")
+ HostTestContext.BuiltDotNet.Exec("--list-runtimes")
.EnvironmentVariable("COREHOST_TRACE", "1")
.CaptureStdErr()
.Execute()
diff --git a/src/installer/tests/HostActivation.Tests/WindowsSpecificBehavior.cs b/src/installer/tests/HostActivation.Tests/WindowsSpecificBehavior.cs
index d81ae928823668..d7e09f06a413e8 100644
--- a/src/installer/tests/HostActivation.Tests/WindowsSpecificBehavior.cs
+++ b/src/installer/tests/HostActivation.Tests/WindowsSpecificBehavior.cs
@@ -2,14 +2,13 @@
// The .NET Foundation licenses this file to you under the MIT license.
using System;
-
+using System.Runtime.InteropServices;
using Microsoft.DotNet.Cli.Build.Framework;
using Microsoft.Win32;
using Xunit;
namespace Microsoft.DotNet.CoreSetup.Test.HostActivation
{
- [PlatformSpecific(TestPlatforms.Windows)]
public class WindowsSpecificBehavior : IClassFixture
{
private SharedTestState sharedTestState;
@@ -17,12 +16,14 @@ public class WindowsSpecificBehavior : IClassFixture
$(TestInfraTargetFramework)
+ Exe
+
+ $(HostRid)
false
$(NoWarn);NU1511
+ XUnitV3
diff --git a/src/installer/tests/Microsoft.DotNet.CoreSetup.Packaging.Tests/NETCoreTests.cs b/src/installer/tests/Microsoft.DotNet.CoreSetup.Packaging.Tests/NETCoreTests.cs
index bcb276907b33f0..3d102c47e715cf 100644
--- a/src/installer/tests/Microsoft.DotNet.CoreSetup.Packaging.Tests/NETCoreTests.cs
+++ b/src/installer/tests/Microsoft.DotNet.CoreSetup.Packaging.Tests/NETCoreTests.cs
@@ -38,7 +38,7 @@ public void NETCoreAppHostPackIsValid()
using (var tester = NuGetArtifactTester.Open(
dirs,
"Microsoft.NETCore.App.Host",
- $"Microsoft.NETCore.App.Host.{TestContext.BuildRID}"))
+ $"Microsoft.NETCore.App.Host.{HostTestContext.BuildRID}"))
{
tester.IsAppHostPack();
}
@@ -50,7 +50,7 @@ public void NETCoreRuntimePackIsValid()
using (var tester = NuGetArtifactTester.Open(
dirs,
"Microsoft.NETCore.App.Runtime",
- $"Microsoft.NETCore.App.Runtime.{TestContext.BuildRID}"))
+ $"Microsoft.NETCore.App.Runtime.{HostTestContext.BuildRID}"))
{
tester.IsRuntimePack();
}
diff --git a/src/installer/tests/Microsoft.DotNet.CoreSetup.Packaging.Tests/NuGetArtifactTester.cs b/src/installer/tests/Microsoft.DotNet.CoreSetup.Packaging.Tests/NuGetArtifactTester.cs
index b0efc8dc49b7fc..4733459f1d5ceb 100644
--- a/src/installer/tests/Microsoft.DotNet.CoreSetup.Packaging.Tests/NuGetArtifactTester.cs
+++ b/src/installer/tests/Microsoft.DotNet.CoreSetup.Packaging.Tests/NuGetArtifactTester.cs
@@ -37,9 +37,9 @@ public static NuGetArtifactTester OpenOrNull(
string nupkgPath = Path.Combine(
dirs.BaseArtifactsFolder,
"packages",
- TestContext.Configuration,
+ HostTestContext.Configuration,
"Shipping",
- $"{id}.{TestContext.MicrosoftNETCoreAppVersion}.nupkg");
+ $"{id}.{HostTestContext.MicrosoftNETCoreAppVersion}.nupkg");
// If the nuspec exists, the nupkg should exist.
Assert.True(File.Exists(nupkgPath));
diff --git a/src/installer/tests/Microsoft.NET.HostModel.Tests/AppHost/CreateAppHost.cs b/src/installer/tests/Microsoft.NET.HostModel.Tests/AppHost/CreateAppHost.cs
index e128cd7b6cbec5..dc69ddb8adc80a 100644
--- a/src/installer/tests/Microsoft.NET.HostModel.Tests/AppHost/CreateAppHost.cs
+++ b/src/installer/tests/Microsoft.NET.HostModel.Tests/AppHost/CreateAppHost.cs
@@ -262,9 +262,9 @@ public void ExecutableImage()
}
[Theory]
+ [PlatformSpecific(TestPlatforms.OSX)]
[InlineData("")]
[InlineData("dir with spaces")]
- [PlatformSpecific(TestPlatforms.OSX)]
public void CodeSignMachOAppHost(string subdir)
{
using (TestArtifact artifact = CreateTestDirectory())
@@ -287,9 +287,9 @@ public void CodeSignMachOAppHost(string subdir)
}
[Theory]
+ [PlatformSpecific(TestPlatforms.OSX)]
[InlineData("")]
[InlineData("dir with spaces")]
- [PlatformSpecific(TestPlatforms.OSX)]
public void SigningExistingAppHostCreatesNewInode(string subdir)
{
using (TestArtifact artifact = CreateTestDirectory())
diff --git a/src/installer/tests/Microsoft.NET.HostModel.Tests/Bundle/BundlerConsistencyTests.cs b/src/installer/tests/Microsoft.NET.HostModel.Tests/Bundle/BundlerConsistencyTests.cs
index fe6e122d46b68c..327ae29f2c47a9 100644
--- a/src/installer/tests/Microsoft.NET.HostModel.Tests/Bundle/BundlerConsistencyTests.cs
+++ b/src/installer/tests/Microsoft.NET.HostModel.Tests/Bundle/BundlerConsistencyTests.cs
@@ -245,7 +245,7 @@ public void BaseNameComputation()
// work correctly in the presence of "."s in the hostName.
using (var app = TestApp.CreateEmpty("App.With.Periods"))
{
- app.PopulateFrameworkDependent(Constants.MicrosoftNETCoreApp, TestContext.MicrosoftNETCoreAppVersion);
+ app.PopulateFrameworkDependent(Constants.MicrosoftNETCoreApp, HostTestContext.MicrosoftNETCoreAppVersion);
string hostName = Path.GetFileName(app.AppExe);
string depsJsonName = Path.GetFileName(app.DepsJson);
@@ -415,7 +415,7 @@ public SharedTestState()
App = TestApp.CreateFromBuiltAssets(AppName);
NonAsciiApp = TestApp.CreateFromBuiltAssets("HelloWorld_中文");
- SystemDll = Path.Combine(TestContext.BuiltDotNet.GreatestVersionSharedFxPath, "System.dll");
+ SystemDll = Path.Combine(HostTestContext.BuiltDotNet.GreatestVersionSharedFxPath, "System.dll");
}
public void Dispose()
diff --git a/src/installer/tests/Microsoft.NET.HostModel.Tests/MachObjectSigning/MachObjectTests.cs b/src/installer/tests/Microsoft.NET.HostModel.Tests/MachObjectSigning/MachObjectTests.cs
index 49aee13bebd87e..902eebdbaae1d4 100644
--- a/src/installer/tests/Microsoft.NET.HostModel.Tests/MachObjectSigning/MachObjectTests.cs
+++ b/src/installer/tests/Microsoft.NET.HostModel.Tests/MachObjectSigning/MachObjectTests.cs
@@ -13,7 +13,6 @@
using Microsoft.NET.HostModel.MachO;
using Microsoft.NET.HostModel.MachO.CodeSign.Tests;
using Xunit;
-using Xunit.Abstractions;
namespace Microsoft.NET.HostModel.Tests;
@@ -150,8 +149,8 @@ public void CanParseCodesignOutput()
// test all the binaries compared to codesinginfo from codesign output
[Theory]
- [MemberData(nameof(GetTestFilePaths), nameof(EmbeddedSignatureBlobMatchesCodesignInfo))]
[PlatformSpecific(TestPlatforms.OSX)]
+ [MemberData(nameof(GetTestFilePaths), nameof(EmbeddedSignatureBlobMatchesCodesignInfo))]
public void EmbeddedSignatureBlobMatchesCodesignInfo(string filePath, TestArtifact _)
{
if (!SigningTests.IsSigned(filePath))
diff --git a/src/installer/tests/Microsoft.NET.HostModel.Tests/MachObjectSigning/SigningTests.cs b/src/installer/tests/Microsoft.NET.HostModel.Tests/MachObjectSigning/SigningTests.cs
index b1ed8eada30fcd..003220e9017caf 100644
--- a/src/installer/tests/Microsoft.NET.HostModel.Tests/MachObjectSigning/SigningTests.cs
+++ b/src/installer/tests/Microsoft.NET.HostModel.Tests/MachObjectSigning/SigningTests.cs
@@ -78,9 +78,9 @@ public void CanUnsignAndResign(string filePath, TestArtifact _)
}
[Theory]
- [MemberData(nameof(GetTestFilePaths), nameof(MatchesCodesignOutput))]
[PlatformSpecific(TestPlatforms.OSX)]
- void MatchesCodesignOutput(string filePath, TestArtifact _)
+ [MemberData(nameof(GetTestFilePaths), nameof(MatchesCodesignOutput))]
+ public void MatchesCodesignOutput(string filePath, TestArtifact _)
{
string fileName = Path.GetFileName(filePath);
string originalFilePath = filePath;
diff --git a/src/installer/tests/Microsoft.NET.HostModel.Tests/Microsoft.NET.HostModel.Tests.csproj b/src/installer/tests/Microsoft.NET.HostModel.Tests/Microsoft.NET.HostModel.Tests.csproj
index a2782a71cbb943..808c5e13378118 100644
--- a/src/installer/tests/Microsoft.NET.HostModel.Tests/Microsoft.NET.HostModel.Tests.csproj
+++ b/src/installer/tests/Microsoft.NET.HostModel.Tests/Microsoft.NET.HostModel.Tests.csproj
@@ -2,6 +2,8 @@
$(TestInfraTargetFramework)
+ Exe
+ $(TargetRid)
Microsoft.NET.HostModel.Tests
true
@@ -9,6 +11,7 @@
$(NoWarn);NU1511
+ XUnitV3
@@ -17,6 +20,7 @@
+
diff --git a/src/installer/tests/TestUtils/Binaries.cs b/src/installer/tests/TestUtils/Binaries.cs
index 70837a4557b4fc..1fbda4fa30501b 100644
--- a/src/installer/tests/TestUtils/Binaries.cs
+++ b/src/installer/tests/TestUtils/Binaries.cs
@@ -44,7 +44,7 @@ public static class AppHost
public static class CoreClr
{
public static string FileName = GetSharedLibraryFileNameForCurrentPlatform("coreclr");
- public static string FilePath = Path.Combine(TestContext.BuiltDotNet.GreatestVersionSharedFxPath, FileName);
+ public static string FilePath = Path.Combine(HostTestContext.BuiltDotNet.GreatestVersionSharedFxPath, FileName);
public static string MockName = GetSharedLibraryFileNameForCurrentPlatform("mockcoreclr");
public static string MockPath = Path.Combine(RepoDirectoriesProvider.Default.HostTestArtifacts, MockName);
@@ -90,7 +90,7 @@ public static class SingleFileHost
public static (IEnumerable Assemblies, IEnumerable NativeLibraries) GetRuntimeFiles()
{
- var runtimePackDir = TestContext.BuiltDotNet.GreatestVersionSharedFxPath;
+ var runtimePackDir = HostTestContext.BuiltDotNet.GreatestVersionSharedFxPath;
var assemblies = Directory.GetFiles(runtimePackDir, "*.dll").Where(f => IsAssembly(f));
(string prefix, string suffix) = Binaries.GetSharedLibraryPrefixSuffix();
@@ -114,7 +114,7 @@ static bool IsAssembly(string filePath)
public static class CetCompat
{
// We only support CET shadow stack compatibility for Windows x64 currently
- public static bool IsSupported => OperatingSystem.IsWindows() && TestContext.BuildArchitecture == "x64";
+ public static bool IsSupported => OperatingSystem.IsWindows() && HostTestContext.BuildArchitecture == "x64";
// https://learn.microsoft.com/windows/win32/debug/pe-format#debug-type
private const int IMAGE_DEBUG_TYPE_EX_DLLCHARACTERISTICS = 20;
diff --git a/src/installer/tests/TestUtils/CommandExtensions.cs b/src/installer/tests/TestUtils/CommandExtensions.cs
index 70c18ab08ae25d..e5d7be4b81bb1c 100644
--- a/src/installer/tests/TestUtils/CommandExtensions.cs
+++ b/src/installer/tests/TestUtils/CommandExtensions.cs
@@ -17,7 +17,7 @@ public static Command EnableHostTracing(this Command command)
public static Command EnableHostTracingToFile(this Command command, out string filePath)
{
- filePath = Path.Combine(TestContext.TestArtifactsPath, "trace" + Guid.NewGuid().ToString() + ".log");
+ filePath = Path.Combine(HostTestContext.TestArtifactsPath, "trace" + Guid.NewGuid().ToString() + ".log");
if (File.Exists(filePath))
{
File.Delete(filePath);
@@ -48,7 +48,7 @@ public static Command DotNetRoot(this Command command, string dotNetRoot, string
// If we are clearing out the variable, make sure we clear out any architecture-specific one too
if (string.IsNullOrEmpty(dotNetRoot))
- command = command.EnvironmentVariable($"{Constants.DotnetRoot.ArchitectureEnvironmentVariablePrefix}{TestContext.BuildArchitecture.ToUpperInvariant()}", dotNetRoot);
+ command = command.EnvironmentVariable($"{Constants.DotnetRoot.ArchitectureEnvironmentVariablePrefix}{HostTestContext.BuildArchitecture.ToUpperInvariant()}", dotNetRoot);
return command
.EnvironmentVariable(Constants.DotnetRoot.EnvironmentVariable, dotNetRoot)
diff --git a/src/installer/tests/TestUtils/DotNetBuilder.cs b/src/installer/tests/TestUtils/DotNetBuilder.cs
index db9a316e2704fa..93be973732dde5 100644
--- a/src/installer/tests/TestUtils/DotNetBuilder.cs
+++ b/src/installer/tests/TestUtils/DotNetBuilder.cs
@@ -131,7 +131,7 @@ public DotNetBuilder AddMicrosoftNETCoreAppFrameworkMockCoreClr(string version,
// ./shared/Microsoft.NETCore.App/ - create a mock of the root framework
string netCoreAppPath = AddFramework(Constants.MicrosoftNETCoreApp, version);
- string currentRid = TestContext.BuildRID;
+ string currentRid = HostTestContext.BuildRID;
NetCoreAppBuilder.ForNETCoreApp(Constants.MicrosoftNETCoreApp, currentRid)
.WithStandardRuntimeFallbacks()
diff --git a/src/installer/tests/TestUtils/TestContext.cs b/src/installer/tests/TestUtils/HostTestContext.cs
similarity index 97%
rename from src/installer/tests/TestUtils/TestContext.cs
rename to src/installer/tests/TestUtils/HostTestContext.cs
index 24bbaebc0ca84d..eb67f6899b38b0 100644
--- a/src/installer/tests/TestUtils/TestContext.cs
+++ b/src/installer/tests/TestUtils/HostTestContext.cs
@@ -6,7 +6,7 @@
namespace Microsoft.DotNet.CoreSetup.Test
{
- public sealed class TestContext
+ public sealed class HostTestContext
{
public static string BuildArchitecture { get; }
public static string BuildRID { get; }
@@ -23,7 +23,7 @@ public sealed class TestContext
private static string _testContextVariableFilePath { get; }
private static ImmutableDictionary _testContextVariables { get; }
- static TestContext()
+ static HostTestContext()
{
_testContextVariableFilePath = Path.Combine(
Directory.GetCurrentDirectory(),
diff --git a/src/installer/tests/TestUtils/RepoDirectoriesProvider.cs b/src/installer/tests/TestUtils/RepoDirectoriesProvider.cs
index bf1e51ca44040f..50a92f4a910aa5 100644
--- a/src/installer/tests/TestUtils/RepoDirectoriesProvider.cs
+++ b/src/installer/tests/TestUtils/RepoDirectoriesProvider.cs
@@ -26,7 +26,7 @@ private RepoDirectoriesProvider()
string repoRoot = GetRepoRootDirectory();
BaseArtifactsFolder = Path.Combine(repoRoot, "artifacts");
- string osPlatformConfig = $"{TestContext.BuildRID}.{TestContext.Configuration}";
+ string osPlatformConfig = $"{HostTestContext.BuildRID}.{HostTestContext.Configuration}";
string artifacts = Path.Combine(BaseArtifactsFolder, "bin", osPlatformConfig);
HostArtifacts = Path.Combine(artifacts, "corehost");
HostTestArtifacts = Path.Combine(artifacts, "corehost_test");
diff --git a/src/installer/tests/TestUtils/SingleFileTestApp.cs b/src/installer/tests/TestUtils/SingleFileTestApp.cs
index 74a6df5cdf05da..97902b084c4a6f 100644
--- a/src/installer/tests/TestUtils/SingleFileTestApp.cs
+++ b/src/installer/tests/TestUtils/SingleFileTestApp.cs
@@ -43,7 +43,7 @@ private SingleFileTestApp(SingleFileTestApp source)
///
/// Name of pre-built app
///
- /// The is expected to be in
+ /// The is expected to be in
/// and have been built as framework-dependent
///
public static SingleFileTestApp CreateFrameworkDependent(string appName)
@@ -54,7 +54,7 @@ public static SingleFileTestApp CreateFrameworkDependent(string appName)
///
/// Name of pre-built app
///
- /// The is expected to be in
+ /// The is expected to be in
/// and have been built as framework-dependent
///
public static SingleFileTestApp CreateSelfContained(string appName)
@@ -177,23 +177,23 @@ private void PopulateBuiltAppDirectory()
{
// Copy the compiled app output - the app is expected to have been built as framework-dependent
TestArtifact.CopyRecursive(
- Path.Combine(TestContext.TestAssetsOutput, AppName),
+ Path.Combine(HostTestContext.TestAssetsOutput, AppName),
builtApp.Location);
// Remove any runtimeconfig.json or deps.json - we will be creating new ones
File.Delete(builtApp.RuntimeConfigJson);
File.Delete(builtApp.DepsJson);
- var shortVersion = TestContext.Tfm[3..]; // trim "net" from beginning
- var builder = NetCoreAppBuilder.ForNETCoreApp(AppName, TestContext.BuildRID, shortVersion);
+ var shortVersion = HostTestContext.Tfm[3..]; // trim "net" from beginning
+ var builder = NetCoreAppBuilder.ForNETCoreApp(AppName, HostTestContext.BuildRID, shortVersion);
// Update the .runtimeconfig.json
builder.WithRuntimeConfig(c =>
{
- c.WithTfm(TestContext.Tfm);
+ c.WithTfm(HostTestContext.Tfm);
c = selfContained
- ? c.WithIncludedFramework(Constants.MicrosoftNETCoreApp, TestContext.MicrosoftNETCoreAppVersion)
- : c.WithFramework(Constants.MicrosoftNETCoreApp, TestContext.MicrosoftNETCoreAppVersion);
+ ? c.WithIncludedFramework(Constants.MicrosoftNETCoreApp, HostTestContext.MicrosoftNETCoreAppVersion)
+ : c.WithFramework(Constants.MicrosoftNETCoreApp, HostTestContext.MicrosoftNETCoreAppVersion);
});
// Add runtime libraries and assets for generating the .deps.json.
@@ -205,7 +205,7 @@ private void PopulateBuiltAppDirectory()
.WithAsset(Path.GetFileName(builtApp.AppDll), f => f.NotOnDisk())));
if (selfContained)
{
- builder.WithRuntimePack($"{Constants.MicrosoftNETCoreApp}.Runtime.{TestContext.BuildRID}", TestContext.MicrosoftNETCoreAppVersion, l => l
+ builder.WithRuntimePack($"{Constants.MicrosoftNETCoreApp}.Runtime.{HostTestContext.BuildRID}", HostTestContext.MicrosoftNETCoreAppVersion, l => l
.WithAssemblyGroup(string.Empty, g =>
{
foreach (var file in Binaries.GetRuntimeFiles().Assemblies)
diff --git a/src/installer/tests/TestUtils/TestApp.cs b/src/installer/tests/TestUtils/TestApp.cs
index ace429ccdbc187..278225386786eb 100644
--- a/src/installer/tests/TestUtils/TestApp.cs
+++ b/src/installer/tests/TestUtils/TestApp.cs
@@ -57,7 +57,7 @@ public static TestApp CreateFromBuiltAssets(string appName, string assetRelative
assetRelativePath = assetRelativePath ?? appName;
TestApp app = CreateEmpty(appName);
TestArtifact.CopyRecursive(
- Path.Combine(TestContext.TestAssetsOutput, assetRelativePath),
+ Path.Combine(HostTestContext.TestAssetsOutput, assetRelativePath),
app.Location);
return app;
}
@@ -107,18 +107,18 @@ public enum MockedComponent
public void PopulateSelfContained(MockedComponent mock, Action customizer = null)
{
- var builder = NetCoreAppBuilder.ForNETCoreApp(Name, TestContext.BuildRID);
+ var builder = NetCoreAppBuilder.ForNETCoreApp(Name, HostTestContext.BuildRID);
// Update the .runtimeconfig.json - add included framework and remove any existing NETCoreApp framework
builder.WithRuntimeConfig(c =>
- c.WithIncludedFramework(Constants.MicrosoftNETCoreApp, TestContext.MicrosoftNETCoreAppVersion)
+ c.WithIncludedFramework(Constants.MicrosoftNETCoreApp, HostTestContext.MicrosoftNETCoreAppVersion)
.RemoveFramework(Constants.MicrosoftNETCoreApp));
// Add main project assembly
builder.WithProject(p => p.WithAssemblyGroup(null, g => g.WithMainAssembly()));
// Add runtime libraries and assets
- builder.WithRuntimePack($"{Constants.MicrosoftNETCoreApp}.Runtime.{TestContext.BuildRID}", TestContext.MicrosoftNETCoreAppVersion, l =>
+ builder.WithRuntimePack($"{Constants.MicrosoftNETCoreApp}.Runtime.{HostTestContext.BuildRID}", HostTestContext.MicrosoftNETCoreAppVersion, l =>
{
if (mock == MockedComponent.None)
{
diff --git a/src/installer/tests/TestUtils/TestArtifact.cs b/src/installer/tests/TestUtils/TestArtifact.cs
index 65062c542992a4..4fdac7380bbe96 100644
--- a/src/installer/tests/TestUtils/TestArtifact.cs
+++ b/src/installer/tests/TestUtils/TestArtifact.cs
@@ -120,7 +120,7 @@ protected static (string, string) GetNewTestArtifactPath(string artifactName)
Exception? lastException = null;
for (int i = 0; i < 10; i++)
{
- var parentPath = Path.Combine(TestContext.TestArtifactsPath, Path.GetRandomFileName());
+ var parentPath = Path.Combine(HostTestContext.TestArtifactsPath, Path.GetRandomFileName());
// Create a lock file next to the target folder
var lockPath = parentPath + ".lock";
var artifactPath = Path.Combine(parentPath, artifactName);
diff --git a/src/installer/tests/TestUtils/TestUtils.csproj b/src/installer/tests/TestUtils/TestUtils.csproj
index bc3968f7de2a13..a88b817b47ac5b 100644
--- a/src/installer/tests/TestUtils/TestUtils.csproj
+++ b/src/installer/tests/TestUtils/TestUtils.csproj
@@ -16,8 +16,8 @@
-
-
+
+
diff --git a/src/installer/tests/helixpublish.proj b/src/installer/tests/helixpublish.proj
index 3db775f566567b..7ad19673f90ad7 100644
--- a/src/installer/tests/helixpublish.proj
+++ b/src/installer/tests/helixpublish.proj
@@ -10,6 +10,7 @@
true
sdk
+ $(TargetRid)
@@ -45,9 +46,16 @@
+
+
+ <_TestExePath>$([System.IO.Path]::GetFileNameWithoutExtension($(_TargetPath)))$(ExeSuffix)
+
+
- dotnet test $([System.IO.Path]::GetFileName($(_TargetPath))) $(TestRunnerAdditionalArguments) --logger trx --results-directory .
+ $(_TestExePath) $(TestRunnerAdditionalArguments) --report-trx --results-directory .
+ ./$(_TestExePath) $(TestRunnerAdditionalArguments) --report-trx --results-directory .
+ chmod +x $(_TestExePath)
$(_PayloadDirectory)
@@ -58,7 +66,7 @@
%(HostTestProject.PayloadDirectory)
%(HostTestProject.Command)
- @(_HelixPreCommands)
+ @(_HelixPreCommands);%(HostTestProject.PreCommands)
00:30:00