Add a unit test for ARM projects to verify correct files are generated - #1251
jeremylindsayni wants to merge 14 commits into
Conversation
Updated test from Fact to Theory, with RID as parameter
|
@jeremylindsayni, It will cover your contributions to all .NET Foundation-managed open source projects. |
|
@jeremylindsayni, thanks for signing the contribution license agreement. We will now validate the agreement and then the pull request. |
|
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
left a comment
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
What does post mean in the name?
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
Sounds good to me. Thanks for the explanation.
| var publishDirectory = publishCommand.GetOutputDirectory( | ||
| targetFramework: targetFramework, | ||
| runtimeIdentifier: runtimeIdentifier); | ||
| var selfContainedExecutable = $"Hello{Constants.ExeSuffix}"; |
There was a problem hiding this comment.
{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.
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
This variable doesn't appear to be used.
There was a problem hiding this comment.
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}", |
There was a problem hiding this comment.
Same comment as above here. The app will always target Windows. Thus these files will always be named:
coreclr.dll
hostfxr.dll
hostpolicy.dll.
There was a problem hiding this comment.
I see what you mean - I've updated the file to have these file names and recommitted the file.
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.
|
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); |
There was a problem hiding this comment.
The selfContainedExecutableFullPath variable is not used. Can it be removed?
There was a problem hiding this comment.
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")] |
There was a problem hiding this comment.
What do you think about adding win10-arm64 to this list?
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
IIRC, we have CoreMSBuildOnlyTheory for this now.
nguerrera
left a comment
There was a problem hiding this comment.
Thanks for your contribution!
LOC CHECKIN | sdk-master | 20170529
Merge release/2.0.0 to master
|
Hi - should I edit this PR to merge into "dotnet:release/2.0.0" instead of "dotnet:master"? |
|
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? |
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. |
|
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. |
…203.5 (dotnet#1251) - Microsoft.DotNet.Arcade.Sdk - 5.0.0-beta.20103.5
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