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

Update AOT test #27334

Merged
merged 7 commits into from
Aug 30, 2022
Merged
Changes from 1 commit
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
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ namespace Microsoft.NET.Publish.Tests
{
public class GivenThatWeWantToPublishAnAotApp : SdkTest
{
/// <summary>
/// The test scenarios in a broad sense are covered below,
/// https://github.com/dotnet/runtime/issues/72415#issuecomment-1205540035
LakshanF marked this conversation as resolved.
Show resolved Hide resolved
/// </summary>
private readonly string RuntimeIdentifier = $"/p:RuntimeIdentifier={RuntimeInformation.RuntimeIdentifier}";

public GivenThatWeWantToPublishAnAotApp(ITestOutputHelper log) : base(log)
Expand Down Expand Up @@ -272,6 +276,8 @@ public void NativeAot_hw_runs_with_PackageReference_PublishAot_is_enabled(string
testProject.AdditionalProperties["PublishAot"] = "true";

// This will add a reference to a package that will also be automatically imported by the SDK
// The final ILCompiler packages that are used should be the onm defined in the explicit package reference but we
LakshanF marked this conversation as resolved.
Show resolved Hide resolved
// don't have an easy way to validate the version
testProject.PackageReferences.Add(new TestPackageReference("Microsoft.DotNet.ILCompiler", "7.0.0-rc.1.22416.1"));

// Linux symbol files are embedded and require additional steps to be stripped to a separate file
Expand Down Expand Up @@ -361,18 +367,17 @@ public void NativeAot_hw_runs_with_cross_PackageReference_PublishAot_is_enabled(
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows) && (RuntimeInformation.OSArchitecture == System.Runtime.InteropServices.Architecture.X64))
LakshanF marked this conversation as resolved.
Show resolved Hide resolved
{
var projectName = "HellowWorldNativeAotApp";
// Setting a cross target RID will ensure that the SDK will download 2 runtime packages, host and target
var rid = "win-arm64";

var testProject = CreateHelloWorldTestProject(targetFramework, projectName, true);
testProject.AdditionalProperties["PublishAot"] = "true";

// This will add a reference to a package that will also be automatically imported by the SDK
testProject.PackageReferences.Add(new TestPackageReference("Microsoft.DotNet.ILCompiler", "7.0.0-rc.1.22416.1"));
testProject.PackageReferences.Add(new TestPackageReference("runtime.win-x64.Microsoft.DotNet.ILCompiler", "7.0.0-rc.1.22416.1"));

var testAsset = _testAssetsManager.CreateTestProject(testProject);

var publishCommand = new PublishCommand(Log, Path.Combine(testAsset.TestRoot, testProject.Name));

// We dont have a way of executing the application in this scenario but publish should succeed
LakshanF marked this conversation as resolved.
Show resolved Hide resolved
publishCommand
.Execute($"/p:RuntimeIdentifier={rid}")
.Should().Pass();
LakshanF marked this conversation as resolved.
Show resolved Hide resolved
Expand Down