Skip to content

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

Merged
44 commits merged into
dotnet:mainfrom
agocke:single-file-xunit
Mar 31, 2021
Merged

44 commits merged into
dotnet:mainfrom
agocke:single-file-xunit

Conversation

@agocke

@agocke agocke commented Oct 2, 2020

Copy link
Copy Markdown
Member

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...

@ViktorHofer ViktorHofer 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.

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
Copy Markdown
Contributor

/cc @akoeplinger

@agocke

agocke commented Oct 2, 2020

Copy link
Copy Markdown
Member Author

@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

safern commented Oct 2, 2020

Copy link
Copy Markdown
Member

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.

Comment thread eng/pipelines/runtime.yml Resolved
Comment thread eng/testing/tests.singlefile.targets Outdated

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.

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
Copy Markdown
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

agocke commented Nov 9, 2020

Copy link
Copy Markdown
Member Author

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

@safern

safern commented Nov 10, 2020

Copy link
Copy Markdown
Member

@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.

Comment thread eng/testing/tests.singlefile.targets Resolved
@agocke

agocke commented Nov 17, 2020

Copy link
Copy Markdown
Member Author

@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

safern commented Nov 17, 2020

Copy link
Copy Markdown
Member

@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

safern commented Nov 17, 2020

Copy link
Copy Markdown
Member

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

agocke commented Nov 17, 2020

Copy link
Copy Markdown
Member Author

I probably need host.native only

Comment thread eng/Subsets.props Resolved
Comment thread eng/Subsets.props Resolved
@agocke

agocke commented Nov 19, 2020

Copy link
Copy Markdown
Member Author

@safern @ViktorHofer I believe this is ready for review

@safern

safern commented Nov 21, 2020

Copy link
Copy Markdown
Member

/azp run runtime

@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

agocke commented Mar 29, 2021

Copy link
Copy Markdown
Member Author

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

@MichalStrehovsky MichalStrehovsky 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.

Thank you!

Comment thread src/native/corehost/hostmisc/utils.h Resolved
Comment thread eng/testing/tests.singlefile.targets Resolved
Comment thread eng/testing/tests.singlefile.targets Resolved
Comment thread src/libraries/tests.proj Resolved

@MichalStrehovsky MichalStrehovsky 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.

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

@ghost

ghost commented Mar 31, 2021

Copy link
Copy Markdown

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.

Comment thread eng/pipelines/runtime.yml
buildConfig: Release
platforms:
- windows_x64
- Linux_x64

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.

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

Copy link
Copy Markdown
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.

Labels

area-Infrastructure-coreclr Only use for closed issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

9 participants