Skip to content

Commit

Permalink
Stop skipping tests in installer pipeline on linux_x64 (dotnet#89953)
Browse files Browse the repository at this point in the history
- Run tests in in installer pipeline on Linux_x64 even though it is cross-build. 
- Fix uploading of binaries/symbols on failure
  • Loading branch information
elinor-fung authored Aug 18, 2023
1 parent 76d4549 commit 5b448cf
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 16 deletions.
13 changes: 11 additions & 2 deletions eng/pipelines/installer/jobs/build-job.yml
Original file line number Diff line number Diff line change
Expand Up @@ -86,18 +86,26 @@ jobs:
- name: OfficialBuildArg
value: ''

# Explicitly enable tests for linux even though it is a cross build using mariner
# They still work in this configuration and until they run on Helix, it is our only
# linux test coverage in the installer pipeline
- name: SkipTests
value: ${{ or(
not(in(parameters.archType, 'x64', 'x86')),
eq(parameters.runtimeFlavor, 'mono'),
eq(parameters.isOfficialBuild, true),
eq(parameters.crossBuild, true),
and(
eq(parameters.crossBuild, true),
not(and(
eq(parameters.osGroup, 'linux'),
eq(parameters.osSubgroup, ''))
)),
eq(parameters.pgoType, 'PGO')) }}

- name: BuildAction
value: -test

- ${{ if eq(or(not(in(parameters.archType, 'x64', 'x86')), eq(parameters.runtimeFlavor, 'mono'), eq(parameters.isOfficialBuild, true), eq(parameters.crossBuild, true), eq(parameters.pgoType, 'PGO')), true) }}:
- ${{ if eq(or(not(in(parameters.archType, 'x64', 'x86')), eq(parameters.runtimeFlavor, 'mono'), eq(parameters.isOfficialBuild, true), and(eq(parameters.crossBuild, true), not(and(eq(parameters.osGroup, 'linux'), eq(parameters.osSubgroup, '')))), eq(parameters.pgoType, 'PGO')), true) }}:
- name: BuildAction
value: ''

Expand Down Expand Up @@ -397,6 +405,7 @@ jobs:
runtimeVariant: ${{ parameters.runtimeVariant }}
isOfficialBuild: ${{ eq(parameters.isOfficialBuild, true) }}
pgoType: ${{ parameters.pgoType }}
skipTests: ${{ eq(variables.SkipTests, true) }}

- ${{ if ne(parameters.osGroup, 'windows') }}:
- script: set -x && df -h
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,23 @@ public class TestSetup

// Expected behaviour of the test based on above settings
public bool ShouldUseRidGraph => UseRidGraph == true;
public bool ShouldUseFallbackRid => ShouldUseRidGraph && (Rid == UnknownRid || !HasRidGraph);

public bool? ShouldUseFallbackRid
{
get
{
if (!ShouldUseRidGraph)
return false;

if (Rid == UnknownRid || !HasRidGraph)
return true;

// We use the product RID graph for testing (for cases with a RID graph). If the test is running
// on a platform that isn't in that RID graph, we may end up with the fallback even when the RID
// graph is used and RID is not unknown. Value of null indicates this state.
return null;
}
}

public override string ToString() => $"""
{nameof(Rid)}: {(Rid ?? "<null>")}
Expand Down Expand Up @@ -623,18 +639,20 @@ protected override void RunTest(

UpdateAppConfigForTest(app, setup, copyOnUpdate: false);

dotnet.Exec(app.AppDll)
var result = dotnet.Exec(app.AppDll)
.EnableTracingAndCaptureOutputs()
.RuntimeId(setup.Rid)
.Execute()
.Should().Pass()
.Execute();
result.Should().Pass()
.And.HaveResolvedAssembly(expected.IncludedAssemblyPaths, app)
.And.NotHaveResolvedAssembly(expected.ExcludedAssemblyPaths, app)
.And.HaveResolvedNativeLibraryPath(expected.IncludedNativeLibraryPaths, app)
.And.NotHaveResolvedNativeLibraryPath(expected.ExcludedNativeLibraryPaths, app)
.And.HaveReadRidGraph(setup.ShouldUseRidGraph)
.And.HaveUsedFallbackRid(setup.ShouldUseFallbackRid)
.And.HaveUsedFrameworkProbe(dotnet.GreatestVersionSharedFxPath, level: 1);

if (setup.ShouldUseFallbackRid.HasValue)
result.Should().HaveUsedFallbackRid(setup.ShouldUseFallbackRid.Value);
}
}
}
Expand Down Expand Up @@ -674,17 +692,19 @@ protected override void RunTest(

TestApp app = UpdateAppConfigForTest(SharedState.FrameworkReferenceApp, setup, copyOnUpdate: true);

SharedState.RunComponentResolutionTest(component.AppDll, app, dotnet.GreatestVersionHostFxrPath, command => command
.RuntimeId(setup.Rid))
.Should().Pass()
var result = SharedState.RunComponentResolutionTest(component.AppDll, app, dotnet.GreatestVersionHostFxrPath, command => command
.RuntimeId(setup.Rid));
result.Should().Pass()
.And.HaveSuccessfullyResolvedComponentDependencies()
.And.HaveResolvedComponentDependencyAssembly(expected.IncludedAssemblyPaths, component)
.And.NotHaveResolvedComponentDependencyAssembly(expected.ExcludedAssemblyPaths, component)
.And.HaveResolvedComponentDependencyNativeLibraryPath(expected.IncludedNativeLibraryPaths, component)
.And.NotHaveResolvedComponentDependencyNativeLibraryPath(expected.ExcludedNativeLibraryPaths, component)
.And.HaveReadRidGraph(setup.ShouldUseRidGraph)
.And.HaveUsedFallbackRid(setup.ShouldUseFallbackRid)
.And.NotHaveUsedFrameworkProbe(dotnet.GreatestVersionSharedFxPath);

if (setup.ShouldUseFallbackRid.HasValue)
result.Should().HaveUsedFallbackRid(setup.ShouldUseFallbackRid.Value);
}
}

Expand Down Expand Up @@ -723,16 +743,18 @@ protected override void RunTest(

app = UpdateAppConfigForTest(app, setup, copyOnUpdate: true);

SharedState.RunComponentResolutionTest(component.AppDll, app, app.Location, command => command
.RuntimeId(setup.Rid))
.Should().Pass()
var result = SharedState.RunComponentResolutionTest(component.AppDll, app, app.Location, command => command
.RuntimeId(setup.Rid));
result.Should().Pass()
.And.HaveSuccessfullyResolvedComponentDependencies()
.And.HaveResolvedComponentDependencyAssembly(expected.IncludedAssemblyPaths, component)
.And.NotHaveResolvedComponentDependencyAssembly(expected.ExcludedAssemblyPaths, component)
.And.HaveResolvedComponentDependencyNativeLibraryPath(expected.IncludedNativeLibraryPaths, component)
.And.NotHaveResolvedComponentDependencyNativeLibraryPath(expected.ExcludedNativeLibraryPaths, component)
.And.HaveReadRidGraph(setup.ShouldUseRidGraph)
.And.HaveUsedFallbackRid(setup.ShouldUseFallbackRid);
.And.HaveReadRidGraph(setup.ShouldUseRidGraph);

if (setup.ShouldUseFallbackRid.HasValue)
result.Should().HaveUsedFallbackRid(setup.ShouldUseFallbackRid.Value);
}

public class ComponentSharedTestState : ComponentSharedTestStateBase
Expand Down

0 comments on commit 5b448cf

Please sign in to comment.