forked from dotnet/runtime
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move
StartupHooks
tests and remaining uses of PortableApp project t…
…o pre-built test assets (dotnet#95761)
- Loading branch information
1 parent
5201ec3
commit 46bf1af
Showing
17 changed files
with
200 additions
and
345 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
...ts/Assets/Projects/StartupHookWithAssemblyResolver/StartupHookWithAssemblyResolver.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<TargetFramework>$(NetCoreAppCurrent)</TargetFramework> | ||
</PropertyGroup> | ||
|
||
<!-- Copy the preloaded base type to the startup hook's output | ||
directory to make it easy to find. --> | ||
<ItemGroup> | ||
<ProjectReference Include="..\SharedLibrary\SharedLibrary.csproj" /> | ||
</ItemGroup> | ||
|
||
</Project> |
9 changes: 0 additions & 9 deletions
9
src/installer/tests/Assets/TestProjects/PortableApp/PortableApp.csproj
This file was deleted.
Oops, something went wrong.
36 changes: 0 additions & 36 deletions
36
src/installer/tests/Assets/TestProjects/PortableApp/Program.cs
This file was deleted.
Oops, something went wrong.
12 changes: 0 additions & 12 deletions
12
.../tests/Assets/TestProjects/StartupHookWithAssemblyResolver/SharedLibrary/SharedLibrary.cs
This file was deleted.
Oops, something went wrong.
9 changes: 0 additions & 9 deletions
9
...ts/Assets/TestProjects/StartupHookWithAssemblyResolver/SharedLibrary/SharedLibrary.csproj
This file was deleted.
Oops, something went wrong.
19 changes: 0 additions & 19 deletions
19
...ssets/TestProjects/StartupHookWithAssemblyResolver/StartupHookWithAssemblyResolver.csproj
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
|
||
using Microsoft.DotNet.Cli.Build; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.IO; | ||
using System.Runtime.InteropServices; | ||
using Xunit; | ||
|
||
namespace Microsoft.DotNet.CoreSetup.Test.HostActivation | ||
{ | ||
public class Breadcrumbs : IClassFixture<Breadcrumbs.SharedTestState> | ||
{ | ||
private SharedTestState sharedTestState; | ||
|
||
public Breadcrumbs(SharedTestState fixture) | ||
{ | ||
sharedTestState = fixture; | ||
} | ||
|
||
[Fact] | ||
public void BreadcrumbThreadFinishes() | ||
{ | ||
TestContext.BuiltDotNet.Exec(sharedTestState.App.AppDll) | ||
.EnvironmentVariable(Constants.Breadcrumbs.EnvironmentVariable, sharedTestState.BreadcrumbLocation) | ||
.EnableTracingAndCaptureOutputs() | ||
.Execute() | ||
.Should().Pass() | ||
.And.HaveStdOutContaining("Hello World") | ||
.And.HaveStdErrContaining("Done waiting for breadcrumb thread to exit..."); | ||
} | ||
|
||
[Fact] | ||
public void UnhandledException_BreadcrumbThreadDoesNotFinish() | ||
{ | ||
TestContext.BuiltDotNet.Exec(sharedTestState.App.AppDll, "throw_exception") | ||
.EnvironmentVariable(Constants.Breadcrumbs.EnvironmentVariable, sharedTestState.BreadcrumbLocation) | ||
.EnableTracingAndCaptureOutputs() | ||
.Execute(expectedToFail: true) | ||
.Should().Fail() | ||
.And.HaveStdErrContaining("Unhandled exception.") | ||
.And.HaveStdErrContaining("System.Exception: Goodbye World") | ||
.And.NotHaveStdErrContaining("Done waiting for breadcrumb thread to exit..."); | ||
} | ||
|
||
public class SharedTestState : IDisposable | ||
{ | ||
public TestApp App { get; } | ||
public string BreadcrumbLocation { get; } | ||
|
||
public SharedTestState() | ||
{ | ||
App = TestApp.CreateFromBuiltAssets("HelloWorld"); | ||
if (!OperatingSystem.IsWindows()) | ||
{ | ||
// On non-Windows breadcrumbs are only written if the breadcrumb directory already exists, | ||
// so we explicitly create a directory for breadcrumbs | ||
BreadcrumbLocation = Path.Combine( | ||
App.Location, | ||
"opt", | ||
"corebreadcrumbs"); | ||
Directory.CreateDirectory(BreadcrumbLocation); | ||
} | ||
} | ||
|
||
public void Dispose() | ||
{ | ||
App?.Dispose(); | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.