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

Add option for building a test exe as single file #42972

Merged
44 commits merged into from
Mar 31, 2021

Conversation

agocke
Copy link
Member

@agocke agocke commented Oct 2, 2020

This is a work-in-progress PR, I haven't yet figured out how the xharness runners actually report test failures, since it doesn't look like they write the xunit results anywhere.

There's also the simpler matter of the exes not actually passing the tests...

Copy link
Member

@ViktorHofer ViktorHofer left a comment

Choose a reason for hiding this comment

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

This design will need to change as with #39923 the xunit.console targets and props files and the RunTests.cmd/sh generation for desktop configuration will go away. We should really get #39923 as that's part of our crash dump working group.

I'm marking this as request changes meanwhile to avoid an accidental merge.

@marek-safar
Copy link
Contributor

/cc @akoeplinger

@agocke
Copy link
Member Author

agocke commented Oct 2, 2020

@ViktorHofer Haven't seen that PR before, I'll try to integrate.

I'd also like to treat this as progressive enhancement -- enable one project at at time. Idea on how best to do that? Is there a central list of the test projects which I could condition on PublishSingleFile=true and narrow it down to a smaller list?

@safern
Copy link
Member

safern commented Oct 2, 2020

We have been doing similar things for Wasm and iOS as we enable more projects and get them green:

<ItemGroup Condition="('$(TargetOS)' == 'iOS' or '$(TargetOS)' == 'tvOS') and '$(RunDisablediOSTests)' != 'true'">

Maybe we could do it in a cleaner way by adding these items to a testexclusion.props file or something and import it so that tests.proj doesn't get that complicated/polluted.

<Target Name="__ExcludeAssembliesFromSingleFile"
Inputs="%(ResolvedFileToPublish.Identity)"
Outputs="__NewResolvedFiles"
BeforeTargets="_ComputeFilesToBundle">
Copy link
Member

Choose a reason for hiding this comment

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

We usually try to not depend on private targets which are implementation detail and could change their name or be removed. Is there a public target that runs before this or on the chain of this target that you can hook to?

Copy link
Member Author

Choose a reason for hiding this comment

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

Not at the moment, but I think we could probably add something. I'm open to adding a lot more integration points here to help with testing.

@agocke
Copy link
Member Author

agocke commented Nov 9, 2020

@safern @ViktorHofer Can you help me write the yaml for a new leg? I don't really know what these commands do.

@safern
Copy link
Member

safern commented Nov 10, 2020

@safern @ViktorHofer Can you help me write the yaml for a new leg? I don't really know what these commands do.

I can help. Feel free to ping me offline.

@agocke
Copy link
Member Author

agocke commented Nov 17, 2020

@safern I think I'm really close to having this working -- I think the problem is that I'm depending on the singlefilehost produced by the host partition in the libs.test build, but I think the host partition isn't necessarily being built before that partition. Is there any way to force that, or at least validate that my hypothesis is correct?

@safern
Copy link
Member

safern commented Nov 17, 2020

@safern I think I'm really close to having this working -- I think the problem is that I'm depending on the singlefilehost produced by the host partition in the libs.test build, but I think the host partition isn't necessarily being built before that partition. Is there any way to force that, or at least validate that my hypothesis is correct?

I believe that wouldn't be such a hard change to do. @jkoritzinsky of @ViktorHofer do you know how we can change the order so that libs.tests is the last subset built when passed as part of the subsets?

@safern
Copy link
Member

safern commented Nov 17, 2020

I believe it is just a matter of moving this:

runtime/eng/Subsets.props

Lines 245 to 247 in e5c7168

<ItemGroup Condition="$(_subset.Contains('+libs.tests+'))">
<ProjectToBuild Include="$(LibrariesProjectRoot)tests.proj" Category="libs" Test="true" />
</ItemGroup>

to after the host subsets.

@agocke do you need all the host subsets? I'm asking as it seems like it builds host.tests by default:

https://github.com/dotnet/runtime/blob/master/eng/Subsets.props#L109-L113

@agocke
Copy link
Member Author

agocke commented Nov 17, 2020

I probably need host.native only

@agocke
Copy link
Member Author

agocke commented Nov 19, 2020

@safern @ViktorHofer I believe this is ready for review

@agocke agocke dismissed ViktorHofer’s stale review March 29, 2021 22:30

The VS test work is helpful, but for now we'll have to always have a custom runner for platforms like single-file and mobile

@agocke
Copy link
Member Author

agocke commented Mar 29, 2021

@MichalStrehovsky I believe this is ready for integration if you wouldn't mind reviewing it.

Copy link
Member

@MichalStrehovsky MichalStrehovsky left a comment

Choose a reason for hiding this comment

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

Thank you!

Copy link
Member

@MichalStrehovsky MichalStrehovsky left a comment

Choose a reason for hiding this comment

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

Thank you! Not a pipeline expert, so I'm not reviewing the yml changes.

@ghost
Copy link

ghost commented Mar 31, 2021

Hello @agocke!

Because this pull request has the auto-merge label, I will be glad to assist with helping to merge this pull request once all check-in policies pass.

p.s. you can customize the way I help with merging this pull request, such as holding this pull request until a specific person approves. Simply @mention me (@msftbot) and give me an instruction to get started! Learn more here.

buildConfig: Release
platforms:
- windows_x64
- Linux_x64
Copy link
Member

Choose a reason for hiding this comment

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

It seems to be missing osx_x64, is it by design?

Copy link
Member Author

Choose a reason for hiding this comment

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

There were some problems what I tested this earlier. Bringing Mac online would be good, but wasn't necessary for a first pass here.

@ghost ghost merged commit 7677f7d into dotnet:main Mar 31, 2021
@agocke agocke deleted the single-file-xunit branch March 31, 2021 22:44
@ghost ghost locked as resolved and limited conversation to collaborators Apr 30, 2021
@karelz karelz added this to the 6.0.0 milestone May 20, 2021
This pull request was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants