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

Build all managed coreclr tests on OSX in CI #35783

Closed
wants to merge 2 commits into from

Conversation

sdmaclea
Copy link
Contributor

@sdmaclea sdmaclea commented May 4, 2020

Remove concept of targetGeneric and targetSpecific

Add OSX corelcr managed tests builds to all pipes
Remove all other platform coreclr managed test build

Remove property TestUnsupportedOutsideWindows
Rename target conditional DisableProjectBuild to CLRTestTargetUnsupported

Refactor tests to allow all managed tests to be built on OSX.

Split managed tests which based on target properties conditionally:

  • <Compile Include/>
  • <DefineConstant/>

This creates a separate test for each target configuration permutation.

Add <CLRTestTargetUnsupported/> conditions to select these at build time.

Add issues to issues.targets to exclude incompatible tests at run time.

Append split tests with _Target* to identify intended test target

For tests which depend on target specific internal details of System.Private.Corlib,
expose a dummy implementation for unsupported targets.

Clean up

Remove <TraitTags/>
Remove <CLRTestNeedTarget/>
Remove managedOSXBuild
Remove managedTestBuildOsGroup
Remove managedTestBuildOsSubGroup
"

@ghost
Copy link

ghost commented May 4, 2020

Tagging subscribers to this area: @ViktorHofer
Notify danmosemsft if you want to be subscribed.

@sdmaclea
Copy link
Contributor Author

sdmaclea commented May 4, 2020

This is a fairly significant change in CoreCLR test strategy, but I think it is a big win.

  • It will only create one test build leg which will build all tests for all targets
  • It will not add a managed build step to run-test-job
  • It will not incur extra delay while rerunning tests
  • It should save 10+ minutes per target
  • It fixes multiple issues with missing tests
  • It simplifies things

All pipelines will eventually need some testing.
I triggered outerloop https://dev.azure.com/dnceng/public/_build/results?buildId=629477&view=results

@trylek
Copy link
Member

trylek commented May 4, 2020

Most of this looks good to me. Apart from the above pipeline failures that need investigating and fixing as they seem clearly related to your change, I have a hard time figuring out how the test split works with your change. If I'm not mistaken, you're removing the targetGeneric and targetSpecific switches from build-test, replacing them with a single flag allTargets. Can you please explain to me how is this supposed to cater for the following three different scenarios?

  1. Building target-agnostic tests from build-test-job;
  2. Building target-specific tests from run-test-job;
  3. Building all tests when running build-test in local developer workflow.

Thanks

Tomas

@sdmaclea
Copy link
Contributor Author

sdmaclea commented May 4, 2020

Can you please explain to me how is this supposed to cater for the following three different scenarios?

  1. Building target-agnostic tests from build-test-job;
    2 .Building target-specific tests from run-test-job;
  2. Building all tests when running build-test in local developer workflow.

The idea is that the category targetSpecific test exists for a few reasons:

  • A test couldn't be built on all platforms (Windows historically, OSX currently)
  • A test conditionally included different source based on properties of the target
  • A test conditionally set DefineConstant ( based on properties of the target) and therefore affected #if code in C#

This patch eliminates the targetSpecific category, so any test can be built on any platform without changing the content or behavior of the test.

So this really changes the three scenarios. We now have

  1. Build tests for all targets (option allTargets)
  2. Build tests for the developer's target. (default)

The change relies on the bash/batch wrapper scripts to disable tests which do not run on the specific target

@trylek
Copy link
Member

trylek commented May 4, 2020

I think I'm getting the general idea but I still don't fully understand how we manage to only build platform-specific tests in run-test-job. Is the logic solely based on test build "incrementalism" that ends up not rebuilding tests that have already been built - i.o.w. we first download the target-agnostic tests and that by itself ensures that those tests won't be built again in run-test-job? If that is the case, it might be worth a comment in the yml file as it seems non-trivial to me and possible future changes to the test build process can easily break this.

@sdmaclea
Copy link
Contributor Author

sdmaclea commented May 4, 2020

We are not building managed tests in run-test-job. There is a stray comment that I missed when I deleted that code. I'll fix it, but that may be the source of confusion.

So we are now building all tests for all target on OSX. If a test used to have multiple configurations, it now has a separate name for each configuration. So all tests can be built simulataneously.

We are not building any managed tests during run-test-job.

The target specific tests are being skipped in helix because of the <BashCLRTestEnvironmentCompatibilityCheck Condition="'$(CLRTestTargetUnsupported)' == 'true'"> changes to src/coreclr/tests/src/CLRTest.Execute.Bash.targets & src/coreclr/tests/src/CLRTest.Execute.Batch.targets.

@trylek
Copy link
Member

trylek commented May 4, 2020

OK, I finally got it, thanks for your patience with me!

@BruceForstall
Copy link
Member

When you say "Build all managed coreclr tests on OSX", is that proxy for "Build all managed coreclr tests exactly once, and that happens to be macOS because our macOS build servers are the fastest ones we have available to us, and getting the build out fast unblocks subsequent parallel test run steps"?

Would this enable or make easier a dev inner-loop scenario where devs download a recent test build instead of building tests themselves (if desired)?

@jashook
Copy link
Contributor

jashook commented May 4, 2020

When you say "Build all managed coreclr tests on OSX", is that proxy for "Build all managed coreclr tests exactly once, and that happens to be macOS because our macOS build servers are the fastest ones we have available to us, and getting the build out fast unblocks subsequent parallel test run steps"?

Yes

Would this enable or make easier a dev inner-loop scenario where devs download a recent test build instead of building tests themselves (if desired)?

I do not see why not

@jashook
Copy link
Contributor

jashook commented May 4, 2020

I answered too soon. you would still need the native components of the tests. Those are built in the build job. You would need to download two artifacts

@jashook
Copy link
Contributor

jashook commented May 4, 2020

There is probably some more work required to improve the innerloop via download, but this makes things easier.

@sdmaclea
Copy link
Contributor Author

sdmaclea commented May 5, 2020

Looks to me like things are now working like they are expected.

There are still some failing tests. These were likely regressions introduced because of the CI coverage outage.

Rather than continuing to amend this patch, I have put these recent regressions in #35860

@sdmaclea
Copy link
Contributor Author

sdmaclea commented May 5, 2020

Also note the documentation doesn't actually represent the current implementation. To allow the PR to merge, I am not updating that here yet either.

Also if we are concerned with helix payload increases, we can look alternatives... I can think of a few....

@naricc
Copy link
Contributor

naricc commented May 5, 2020

@naricc I am just tagging my self here because I am working on making sure the runtime tests work on Mono (we already have a lane for OSX up and running) and want to follow this.

@@ -610,47 +610,6 @@ jobs:
jobParameters:
testGroup: innerloop
liveLibrariesBuildConfig: ${{ variables.debugOnPrReleaseOnRolling }}
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we can incorporate the mono build-test-job in here too: https://github.com/dotnet/runtime/blob/5335f94a9747a64bd300ce06a4ce36a60f4ea71f/eng/pipelines/runtime.yml#L663

Although I can do that as a separate PR later if you like.

Copy link
Contributor

Choose a reason for hiding this comment

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

I would suggest adding this in a follow up pr

@jashook
Copy link
Contributor

jashook commented May 5, 2020

Adding @jkoritzinsky and @AaronRobinsonMSFT for the COM specific bits

@jashook
Copy link
Contributor

jashook commented May 5, 2020

After some discussion we have decided to revert the existing change. The rest of the work will happen in its own branch as it is clear each change will have follow up work.

@jashook
Copy link
Contributor

jashook commented May 5, 2020

#35868

Copy link
Member

@AaronRobinsonMSFT AaronRobinsonMSFT left a comment

Choose a reason for hiding this comment

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

Interop tests look good to me.

Remove concept of targetGeneric and targetSpecific

Add OSX corelcr managed tests builds to all pipes
Remove all other platform coreclr managed test build

Remove property `TestUnsupportedOutsideWindows`
Rename conditional `DisableProjectBuild` to `CLRTestTargetUnsupported`

Refactor tests to allow all managed tests to be built on OSX.

Split managed tests which based on target properties conditionally:
+ `<Compile Include/>`
+ `<DefineConstant/>`

This creates a separate test for each target configuration permutation.

Add `<CLRTestTargetUnsupported/>` conditions to select these at build

Revise CLRTest.Execute.Bash.targets & CLRTest.Execute.Batch.targets to
disable on `<CLRTestTargetUnsupported/>`.

Append split tests with `_Target*` to identify intended test target

For tests which depend on target specific internal details od System.Private.Corlib,
expose a dummy implementation for unsupported targets.

Clean up

Remove <TraitTags/>
Remove <CLRTestNeedTarget/>
Remove managedOSXBuild
Remove managedTestBuildOsGroup
Remove managedTestBuildOsSubGroup

Use issues.target to disable expected failures

Some tests are configured to run on a targets with
specific charecteristics.

Use issues.targets to conditionally disable tests
not intended to run on all targets.
@sdmaclea sdmaclea force-pushed the OsxBuildsAllTargets branch from 5335f94 to 3264204 Compare May 6, 2020 06:33
@sdmaclea
Copy link
Contributor Author

sdmaclea commented May 6, 2020

I just squashed and rebased on the origin/master after the #35868 revert.

@sdmaclea
Copy link
Contributor Author

sdmaclea commented May 6, 2020

Design choices....

  • I wanted to build all tests in one place because it appeared it would essentially be free in terms of execution time.
  • The execution cost of building the targetSpecific tests seemed to be grossly out of proportion with the number of tests to build.
  • When I drafted this patch I hadn't realized the scripts associated with each test was built with the test. That meant target specific script changes would be based on OSX, not on the target.
  • Urgency led me to solve this with issues.targets

Open issues:

  • This PR affects every coreclr pipeline only inner and outloops have been tested

Open issues (deferrable):

  • The documentation associated with this change is slightly out of date.
  • issues.targets
    • Long term it would be ideal for a developer to be able to download the test artifacts and have them just work. In part that is a separate feature, but the script not properly disabling test is a blocking this feature
    • The disabling of tests which are not intended to run on specific targets using issues.targets is misleading. We need a better solution
    • I believe the script issue can be solved it just requires some design discussion.
    • Possibly even a requirements discussion

@sdmaclea
Copy link
Contributor Author

sdmaclea commented May 6, 2020

My current design thought is to leverage the --subset work to solve the test selection.

The project disable code would change to ...

<!-- Test unsupported outside of windows -->
<CLRTestTargetUnsupported>+Windows+</CLRTestTargetUnsupported>

<!-- Test unsupported outside of windows -->
<!-- IJW is not supported on ARM64 -->
<CLRTestTargetUnsupported>+Windows+arm64+</CLRTestTargetUnsupported>

The build of projects would be disabled based on <CLRTestTargetUnsupported/> unless built with allTargets.

The script targets would get added code to selectively disable the script

<BashCLRTestEnvironmentCompatibilityCheck Condition="'$(CLRTestTargetUnsupported.Contains('+arm64+)">

For OS specific disables, we would rely on

  • Batch == Windows
  • Bash == Unix, we would use uname -s to get the kernel name Linux, Darwin ... for more fine grained disables

For Arch specific disables

  • We could use an environment variable COMPlus_TargetArch
  • Abort the test if the environment variable is unset

@ViktorHofer
Copy link
Member

cc @safern for test selection. doesn't that sound very similar to what we are doing with xunit in libraries?

@sdmaclea
Copy link
Contributor Author

sdmaclea commented May 6, 2020

I started drafting the disable code. For reference this is the set of targetSpecific tests and the cases in which they must be disabled.

$ git grep -h CLRTestTargetUnsupported | sort | uniq -c | sort -n -r
    224     <CLRTestTargetUnsupported>+Unix+</CLRTestTargetUnsupported>
     20     <CLRTestTargetUnsupported>+arm+x86+</CLRTestTargetUnsupported>
     16     <CLRTestTargetUnsupported>+arm64+x64+</CLRTestTargetUnsupported>
      7     <CLRTestTargetUnsupported>+Unix+arm64+</CLRTestTargetUnsupported>
      4     <CLRTestTargetUnsupported>+Windows+</CLRTestTargetUnsupported>
      4     <CLRTestTargetUnsupported>+arm64+x64+x86+</CLRTestTargetUnsupported>
      4     <CLRTestTargetUnsupported>+arm64+x64+arm+</CLRTestTargetUnsupported>
      2     <CLRTestTargetUnsupported>+arm+</CLRTestTargetUnsupported>
      2     <CLRTestTargetUnsupported>+arm64+arm+x86+</CLRTestTargetUnsupported>
      1     <CLRTestTargetUnsupported>+Unix+arm+</CLRTestTargetUnsupported>
      1     <CLRTestTargetUnsupported>+arm64+</CLRTestTargetUnsupported>

@sdmaclea
Copy link
Contributor Author

Merged to the dev/infrastructure branch as #36253

@sdmaclea sdmaclea closed this May 11, 2020
@sdmaclea sdmaclea deleted the OsxBuildsAllTargets branch May 11, 2020 23:55
@ghost ghost locked as resolved and limited conversation to collaborators Dec 9, 2020
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.

8 participants