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

Framework.Tests: support running against Linux build artifacts. #46600

Merged
merged 3 commits into from
Feb 14, 2023

Conversation

tmds
Copy link
Member

@tmds tmds commented Feb 13, 2023

Fixes #46524.

@dougbu ptal.

These are the changes that make the tests pass for a local build.

Can we make it so that the aspnetcore CI when running on X will consume the binaries built for X?
Or will CI keep on running these tests against Windows build artifacts only?

In what files should I make the changes for HELIX_WORKITEM_ROOT?

cc @omajid

@ghost ghost added area-infrastructure Includes: MSBuild projects/targets, build scripts, CI, Installers and shared framework community-contribution Indicates that the PR has been added by a community member labels Feb 13, 2023
@ghost
Copy link

ghost commented Feb 13, 2023

Thanks for your PR, @tmds. Someone from the team will get assigned to your PR shortly and we'll get it reviewed.

@mkArtakMSFT
Copy link
Member

Thanks for your PR, @tmds.
@wtgodbe can you please review this? Thanks!

// System.Diagnostics.EventLog.Messages is only present in the Windows build.
if (!RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
{
ListedSharedFxAssemblies.Remove("System.Diagnostics.EventLog.Messages");
Copy link
Member

Choose a reason for hiding this comment

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

This won't work on Helix since we always run tests against the windows assets there (we don't intend to change that) - you could add !SkipOnHelixAttribute.OnHelix() to this condition to account for that

Copy link
Member Author

Choose a reason for hiding this comment

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

I'll make the change.
I'm curious, is there a reason you only run these tests against the Windows assets?

Copy link
Member

Choose a reason for hiding this comment

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

We try to run every test we can on Helix because it saves resources, and helix works by building assets once & sending them off to multiple test queues. So the answer is essentially "because we can" - but, I might be swayed by an argument that these tests should not be run on Helix because they're testing if the assets were produced correctly on the target OS, not that they run correctly there. @dougbu what do you think?

Copy link
Member

Choose a reason for hiding this comment

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

@wtgodbe the background here is in #46524, where @tmds and I discussed the issues w/ local testing on non-Windows machines.

The condition now looks like it'll work fine when run on Helix agents. Am I missing something❔

Copy link
Member

Choose a reason for hiding this comment

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

My point is that these tests check "Was the sharedFx built correctly?". Since we run them in helix, we're only testing "Was the sharedFx built on windows built correctly?" - we don't run this test against a SharedFx built on Linux or Mac (in CI).

Copy link
Member

Choose a reason for hiding this comment

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

My point is that these tests check "Was the sharedFx built correctly?". Since we run them in helix, we're only testing "Was the sharedFx built on windows built correctly?" - we don't run this test against a SharedFx built on Linux or Mac (in CI).

One way to add such testing would be to move the tests off Helix. Unfortunately, that goes against our preference to test everything we can in Helix and avoid duplicate testing.

This also pretty normal because all of our assemblies are built on Windows and tested on the Helix agents. The main unusual thing is that we actually ship shared Fx packages built on non-Windows agents.

Until and unless we centralize crossgen2 execution to the Windows build, let's ignore this. Thoughts❔

Copy link
Member

Choose a reason for hiding this comment

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

The condition now looks like it'll work fine when run on Helix agents. Am I missing something❔

The tests failed on non-windows on helix in the first iteration because of this test, because of this condition (they ran on non-windows, but tested against a SharedFx built on windows)

Are we 🆗 from your perspective here now❔

Copy link
Member

@wtgodbe wtgodbe Feb 13, 2023

Choose a reason for hiding this comment

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

One way to add such testing would be to move the tests off Helix. Unfortunately, that goes against our preference to test everything we can in Helix and avoid duplicate testing. This also pretty normal because all of our assemblies are built on Windows and tested on the Helix agents. The main unusual thing is that we actually ship shared Fx packages built on non-Windows agents.

There are some exceptions to that rule though, and I think this should be one of them - these tests are different from others in that they're not testing "do these bits run on this platform", they're testing "Did we produce the correct set of bits for this platform". As it is today, there's no point in running this test on the Windows, Linux, and MacOS Helix queues - all three are testing "Did we build the correct set of bits for windows", and none are testing "Did we build the correct set of bits for Mac/Linux"

Copy link
Member

Choose a reason for hiding this comment

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

There are some exceptions to that rule though, and I think this should be one of them

The exceptions are all bugs and I would prefer we don't pile on more technical debt. But I also don't disagree our tests of the shared Fx packages is a touch of tunnel vision.

My thought was also about urgency because we haven't hit significant platform-specific problems w/ the shared Fx packages (ignoring those that show up when building in the CI) more than a couple of times (if that). I also plan to try centralizing crossgen2 sooner rather than later.

Copy link
Member

Choose a reason for hiding this comment

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

I don't think we need to block this PR on it - I opened #46620 to track fixing it in the future.

Copy link
Member

@wtgodbe wtgodbe left a comment

Choose a reason for hiding this comment

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

Looks good to me other than the change to TestData, which won't work in Helix

@wtgodbe
Copy link
Member

wtgodbe commented Feb 13, 2023

In what files should I make the changes for HELIX_WORKITEM_ROOT?

What changes do you mean?

@(ExternalAspNetCoreAppReference);
@(_TransitiveExternalAspNetCoreAppReference);
System.Diagnostics.EventLog.Messages" />
<_ExpectedSharedFrameworkBinaries Condition="'$(TargetOsName)' == 'win'" Include="System.Diagnostics.EventLog.Messages" />
Copy link
Member Author

Choose a reason for hiding this comment

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

Is there some Helix check needed here too?

Copy link
Member

Choose a reason for hiding this comment

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

No, the project will be built only in test jobs (on build agents) or locally. We just upload the test assemblies to Helix agents.

@tmds
Copy link
Member Author

tmds commented Feb 13, 2023

What changes do you mean?

I was looking for the feedback you are providing.

@(ExternalAspNetCoreAppReference);
@(_TransitiveExternalAspNetCoreAppReference);
System.Diagnostics.EventLog.Messages" />
<_ExpectedSharedFrameworkBinaries Condition="'$(TargetOsName)' == 'win'" Include="System.Diagnostics.EventLog.Messages" />
Copy link
Member

Choose a reason for hiding this comment

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

No, the project will be built only in test jobs (on build agents) or locally. We just upload the test assemblies to Helix agents.

src/Framework/test/SharedFxTests.cs Outdated Show resolved Hide resolved
// System.Diagnostics.EventLog.Messages is only present in the Windows build.
if (!RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
{
ListedSharedFxAssemblies.Remove("System.Diagnostics.EventLog.Messages");
Copy link
Member

Choose a reason for hiding this comment

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

@wtgodbe the background here is in #46524, where @tmds and I discussed the issues w/ local testing on non-Windows machines.

The condition now looks like it'll work fine when run on Helix agents. Am I missing something❔

@tmds
Copy link
Member Author

tmds commented Feb 14, 2023

CI is happy. @dougbu can you merge this please?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-infrastructure Includes: MSBuild projects/targets, build scripts, CI, Installers and shared framework community-contribution Indicates that the PR has been added by a community member
Projects
None yet
Development

Successfully merging this pull request may close these issues.

DOTNET_ROOT while running tests
4 participants