Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Print docker info in installers tests #58061

Merged
2 commits merged into from
Aug 25, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions eng/pipelines/installer/jobs/base-job.yml
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,7 @@ jobs:
value: |
set -x
df -h
docker info
$(RunArguments) $(BuildScript) $(BuildArguments)

###
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

using System;
using System.IO;
using Microsoft.DotNet;
using Microsoft.DotNet.CoreSetup.Test;
using Xunit;
using static AppHost.Bundle.Tests.BundleTestBase;
Expand All @@ -15,10 +16,17 @@ public class SingleFileSharedState : SharedTestStateBase, IDisposable

public SingleFileSharedState()
{
// We include mockcoreclr in our project to test native binaries extraction.
string mockCoreClrPath = Path.Combine(RepoDirectories.Artifacts, "corehost_test",
RuntimeInformationExtensions.GetSharedLibraryFileNameForCurrentPlatform("mockcoreclr"));
TestFixture = PreparePublishedSelfContainedTestProject("SingleFileApiTests", $"/p:AddFile={mockCoreClrPath}");
try
{
// We include mockcoreclr in our project to test native binaries extraction.
string mockCoreClrPath = Path.Combine(RepoDirectories.Artifacts, "corehost_test",
RuntimeInformationExtensions.GetSharedLibraryFileNameForCurrentPlatform("mockcoreclr"));
TestFixture = PreparePublishedSelfContainedTestProject("SingleFileApiTests", $"/p:AddFile={mockCoreClrPath}");
}
catch (Exception e) when (TestUtils.FailFast(e)) // Fail fast to gather a crash dump
{
throw;
}
}

public void Dispose()
Expand Down
23 changes: 23 additions & 0 deletions src/installer/tests/TestUtils/TestUtils.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
// 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.Diagnostics;

namespace Microsoft.DotNet
{
public static class TestUtils
{
public static bool FailFast(Exception e)
{
if (Debugger.IsAttached)
{
Debugger.Break();
}

Environment.FailFast(e.ToString(), e);
// Should never happen
throw new InvalidOperationException();
}
}
}