Skip to content

Commit

Permalink
Print docker info in installers tests (#58061)
Browse files Browse the repository at this point in the history
* Print docker info in installers CI

* Also add FailFast around SingleFileSharedState
  • Loading branch information
agocke committed Aug 25, 2021
1 parent 1d32e0a commit e0ebe9e
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 4 deletions.
1 change: 1 addition & 0 deletions eng/pipelines/installer/jobs/base-job.yml
Expand Up @@ -252,6 +252,7 @@ jobs:
value: |
set -x
df -h
docker info
$(RunArguments) $(BuildScript) $(BuildArguments)
###
Expand Down
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
@@ -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();
}
}
}

0 comments on commit e0ebe9e

Please sign in to comment.