Skip to content

Add a unit test for ARM projects to verify correct files are generated - #1251

Closed
jeremylindsayni wants to merge 14 commits into
dotnet:release/2.0.0from
jeremylindsayni:master
Closed

jeremylindsayni wants to merge 14 commits into
dotnet:release/2.0.0from
jeremylindsayni:master

Conversation

@jeremylindsayni

Copy link
Copy Markdown
Contributor

This adds a unit test to cover #1239 - this checks that the correct files are generated for self contained projects which target ARM runtimes.

Quick note for clarity - this request is just a unit test - the original fix was submitted by @eerhardt in pull request #20187.

@eerhardt @gkhanna79 @ericstj

@dnfclas

dnfclas commented May 24, 2017

Copy link
Copy Markdown

@jeremylindsayni,
Thanks for your contribution.
To ensure that the project team has proper rights to use your work, please complete the Contribution License Agreement at https://cla2.dotnetfoundation.org.

It will cover your contributions to all .NET Foundation-managed open source projects.
Thanks,
.NET Foundation Pull Request Bot

@dnfclas

dnfclas commented May 24, 2017

Copy link
Copy Markdown

@jeremylindsayni, thanks for signing the contribution license agreement. We will now validate the agreement and then the pull request.

Thanks, .NET Foundation Pull Request Bot

@dsplaisted

Copy link
Copy Markdown
Member

Thanks @jeremylindsayni!

Since this test depends on a fix in corefx, we'll have to wait for that fix to flow here before the test will pass and we can merge it. The path is that it needs to go into a version of the shared framework, which needs to go into the CLI, and then we need to update the SDK repo to depend on that updated CLI.

@eerhardt eerhardt left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR, @jeremylindsayni. This test looks really good. Just a few comments.

Hopefully we can get a new 2.0 runtime build into this repo soon, so we can merge this test.

[InlineData("win8-arm")]
[InlineData("win81-arm")]
[InlineData("win10-arm")]
public void Publish_standalone_post_netcoreapp2_arm_app(string runtimeIdentifier)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What does post mean in the name?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi - this came from a convention in an existing test method that I used as a template earlier in the same class, which was called "Publish_standalone_post_netcoreapp2_app_and_it_should_run".

That method has a comment above the test explaining that distinction between behaviours in pre and post Netcoreapp2.0 (which I guess will be relevant to this test too) - I've copied that in and re-committed the file, hopefully this explains the "post" bit of the method name better?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good to me. Thanks for the explanation.

var publishDirectory = publishCommand.GetOutputDirectory(
targetFramework: targetFramework,
runtimeIdentifier: runtimeIdentifier);
var selfContainedExecutable = $"Hello{Constants.ExeSuffix}";

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

{Constants.ExeSuffix} - this won't work correctly when this test is run on OSX or Linux. When running on those platforms, Constants.ExeSuffix will be string.Empty. However, since the project always targets Windows, the output self-contained executable will always be for Windows. Thus no matter which platform this test is run on, the output assembly will be named Hello.exe.

So I think you can just hard-code .exe here.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes - I think we spotted this one in parallel, I've changed this one.

runtimeIdentifier: runtimeIdentifier);
var selfContainedExecutable = $"Hello{Constants.ExeSuffix}";

string selfContainedExecutableFullPath = Path.Combine(publishDirectory.FullName, selfContainedExecutable);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This variable doesn't appear to be used.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes - just saw this comment too - I'll remove and re-commit.

"Hello.pdb",
"Hello.deps.json",
"Hello.runtimeconfig.json",
$"{FileConstants.DynamicLibPrefix}coreclr{FileConstants.DynamicLibSuffix}",

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same comment as above here. The app will always target Windows. Thus these files will always be named:

coreclr.dll
hostfxr.dll
hostpolicy.dll.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see what you mean - I've updated the file to have these file names and recommitted the file.

jeremylindsayni and others added 3 commits May 24, 2017 22:58
Update the branding in master to preview3.
Edited after code review:
- I've fixed a bug where the test expected the generated filename to be Hello on Ubuntu/OSX, which it should actually always be Hello.exe when we're targetting winX-arm;
- I've added some comments to the method to explain the naming convention;
- I've removed dynamic prefixes/suffixes from "hostfxr.dll", "hostpolicy.dll", "mscorlib.dll" as this test always targets windows.
@jeremylindsayni

Copy link
Copy Markdown
Contributor Author

Hi @dsplaisted and @eerhardt - thank you for the code review and the comments! I've hopefully addressed these now.

I re-examined the test code after seeing the automated failures on Ubuntu and OSX machines, and I actually now think there was a bug in the test I wrote (which I've now fixed). Specifically when publishing for a windows ARM project on Ubuntu or OSX, the test previously looked for a file named "Hello" when it should always be looking for "Hello.exe" after publishing to a Windows family runtime identifier.

Hopefully this test passes on all the environments after the corefx fix flows across.

// depending on the RuntimeInformation
var selfContainedExecutable = "Hello.exe";

string selfContainedExecutableFullPath = Path.Combine(publishDirectory.FullName, selfContainedExecutable);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The selfContainedExecutableFullPath variable is not used. Can it be removed?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes - sorry, I only noticed you asked this earlier, for some reason some comments are collapsed and tagged as outdated, I missed them. I'll update this when I'm in front of my dev machine to remove the unused variable and address any earlier comments I missed.

[InlineData("win-arm")]
[InlineData("win8-arm")]
[InlineData("win81-arm")]
[InlineData("win10-arm")]

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you think about adding win10-arm64 to this list?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that's a good idea, the more we cover the better - the only thing is I don't have an arm64 device to test this on, do we know if the list of files present on arm 32-bit devices should be the same as the 64-bit devices?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, the list of files will be the same. Obviously, the contents of those files will be different, but the names will be the same.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool - I'll update that in my next commit.

{
// Disabled on full framework MSBuild until CI machines have VS with bundled .NET Core / .NET Standard versions
// See https://github.com/dotnet/sdk/issues/1077
return;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IIRC, we have CoreMSBuildOnlyTheory for this now.

@nguerrera nguerrera left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your contribution!

@jeremylindsayni

Copy link
Copy Markdown
Contributor Author

Hi - should I edit this PR to merge into "dotnet:release/2.0.0" instead of "dotnet:master"?

@livarcocc
livarcocc changed the base branch from master to release/2.0.0 June 5, 2017 17:35
@jeremylindsayni

Copy link
Copy Markdown
Contributor Author

Hi @eerhardt - it looks like there's now a pretty complex (and risky looking) merge operation pending on this PR. I think it's safest if I close this PR and try re-applying my test into the current release:2.0.0 branch, what do you think?

@eerhardt

eerhardt commented Jun 6, 2017

Copy link
Copy Markdown
Member

I think it's safest if I close this PR and try re-applying my test into the current release:2.0.0 branch, what do you think?

Yes, I think that is a good strategy. Sorry the branching is getting in the way of progress here. It looks like switching base branches caused a few merge issues.

@jeremylindsayni

Copy link
Copy Markdown
Contributor Author

Closing this as merge conflicts appeared after switching branch to release:2.0.0, but will re-open after targeting the most up to date code in release:2.0.0.

mmitche pushed a commit to mmitche/sdk that referenced this pull request Jun 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants