Skip to content

Add SkipOnCoreclr and SkipOnMono attributes#4231

Merged
safern merged 7 commits intodotnet:masterfrom
safern:AddCoreclrMonoXunitAttributes
Nov 18, 2019
Merged

Add SkipOnCoreclr and SkipOnMono attributes#4231
safern merged 7 commits intodotnet:masterfrom
safern:AddCoreclrMonoXunitAttributes

Conversation

@safern
Copy link
Member

@safern safern commented Oct 30, 2019

This contributes toward unifying the way we disable tests in between CoreFX/CoreCLR and Mono testing for corefx tests.

The way it works is as follows:

SkipOnCoreClrAttribute

We can use this attribute in different ways:

  1. Disable always when running on a checked System.Private.CoreLib runtime.
[SkipOnCoreClr("The reason to disable it")]
  1. Disable it only when running on a specific test platform (Windows, AnyUnix, Linux, OSX, etc).
[SkipOnCoreClr("The reason to disable it", TestPlatform.Windows)]
  1. Disable it only when running in a specific runtime stress mode:
[SkipOnCoreClr("The reason to disable it", RuntimeStressTestModes.JitStress)]
  1. A combination of both
[SkipOnCoreClr("The reason to disable it", TestPlatform.Linux, RuntimeStressTestModes.JitStress)]

SkipOnMonoAttribute

We can use this attribute in different ways:

  1. Disable always when running on the mono runtime
[SkipOnMono("The reason to disable it")]
  1. Disable it only when running on a specific test platform (Windows, AnyUnix, Linux, OSX, etc).
[SkipOnMono("The reason to disable it", TestPlatform.Windows)]

The way these attributes work, if the attribute is added and the conditions are met, we will add a trait to the member which it was added (assembly, class or method) Category=failing. Then when calling XUnit as we already do today, we need to pass an argument, -notrait Category=failing.

I'm still testing this locally but wanted to start gathering feedback on the proposal.

cc: @jkotas @BruceForstall @stephentoub @jaredpar @ViktorHofer @danmosemsft

@safern
Copy link
Member Author

safern commented Oct 30, 2019

cc: @marek-safar

@ViktorHofer
Copy link
Member

What's the remaining work here?

@safern
Copy link
Member Author

safern commented Nov 12, 2019

What's the remaining work here?

I'm finishing local testing (found a small couple bugs), will update and merge.

@safern
Copy link
Member Author

safern commented Nov 12, 2019

@BruceForstall @jkotas @stephentoub @marek-safar can I get a review just to make sure this change meets all we need the way it is and see if you can spot any wrong assumptions?

Copy link
Contributor

@BruceForstall BruceForstall left a comment

Choose a reason for hiding this comment

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

LGTM


return assemblyConfigurationAttribute != null &&
string.Equals(assemblyConfigurationAttribute.Configuration, "Checked", StringComparison.InvariantCulture);
}
Copy link
Member

Choose a reason for hiding this comment

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

Should we cache the answer to this and some of the other IsXx properties/methods? Seems like they could end up being invoked many times while running tests and potentially affect test execution time. It could always be done later, though, if it's found to be an issue.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah, I was thinking about that. I will explore on doing it before merging the PR.

@safern
Copy link
Member Author

safern commented Nov 18, 2019

Merging as it is to unblock ongoing work. Will add caching later this week. I'll open an issue for that.

@safern safern merged commit 3c424ae into dotnet:master Nov 18, 2019
@safern safern deleted the AddCoreclrMonoXunitAttributes branch November 18, 2019 22:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants