-
Notifications
You must be signed in to change notification settings - Fork 5.3k
WIP: using Jeremy's Roslyn generator to prototype the test migration process #61224
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
Closed
Closed
Changes from 1 commit
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
fd6d4e4
Add a basic xunit runner generator that generates a top-level-stateme…
jkoritzinsky 119238e
Fix some bugs in the generator. Convert the Interop/PInvoke/Vector2_3…
jkoritzinsky 6d602f7
Implement support for [Fact] methods that are instance methods on IDi…
jkoritzinsky 4f53c37
Import enum sources from XUnitExtensions and hook up support for some…
jkoritzinsky a9d8bfc
Add one more newline
jkoritzinsky 32c46b3
Add preliminary support for building an IL test runner using the sour…
jkoritzinsky 4ccde3d
Rename to make the logic clearer.
jkoritzinsky 3ccb8ad
Update src/tests/Common/XUnitWrapperGenerator/XUnitWrapperGenerator.cs
jkoritzinsky aced97b
Add support for extern-alias with references (to handle conflicting n…
jkoritzinsky b169530
Apply suggestions from code review
jkoritzinsky 3b35236
Update src/tests/Common/XUnitWrapperGenerator/XUnitWrapperGenerator.cs
jkoritzinsky 23697b2
Add the XUnit wrapper generator to the list of ambient project depend…
trylek 6b61951
Fix nullability bug in XUnitWrapperGenerator
trylek e23a75b
Add build script logic to facilitate the test switchover to [Fact] style
trylek File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev
Previous commit
Add build script logic to facilitate the test switchover to [Fact] style
This change is based on Jeremy's POC PR; I have modified the build scripts to minimize the changes to the individual test build scripts. In the simplest case the conversion requires just replacing the Main method with a [Fact]-marked test entrypoint and removing the OutputType property from the project file. Empty OutputType property gets automatically replaced with the Library default in the SDK scripts; this is not a huge deal but I had to remove the pre-existing hack of OutputType=Library + CLRTestKind="" implying SharedLibrary. According to my search most Library projects already have the SharedLibrary CLRTestKind set, for the rest I plan to set it using a bulk project modification; I think I should be able to adapt the ILTransform analyzer for this purpose. Thanks Tomas
- Loading branch information
commit e23a75b73bad943f6dcf19e4aef44005e1fb0466
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
src/tests/Common/CoreCLRTestLibrary/SkipOnPlatformAttribute.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| // Licensed to the .NET Foundation under one or more agreements. | ||
| // The .NET Foundation licenses this file to you under the MIT license. | ||
| // | ||
|
|
||
| using System; | ||
|
|
||
| namespace Xunit | ||
| { | ||
| [AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Class | AttributeTargets.Method, AllowMultiple = true, Inherited = true)] | ||
| public class SkipOnPlatformAttribute : Attribute | ||
| { | ||
| internal SkipOnPlatformAttribute() { } | ||
| public SkipOnPlatformAttribute(TestPlatforms testPlatforms, string reason) { } | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| // Licensed to the .NET Foundation under one or more agreements. | ||
| // The .NET Foundation licenses this file to you under the MIT license. | ||
| // | ||
|
|
||
| using System; | ||
|
|
||
| namespace Xunit | ||
| { | ||
| [Flags] | ||
| public enum TestPlatforms | ||
| { | ||
| Windows = 1, | ||
| Linux = 2, | ||
| OSX = 4, | ||
| FreeBSD = 8, | ||
| NetBSD = 16, | ||
| illumos= 32, | ||
| Solaris = 64, | ||
| iOS = 128, | ||
| tvOS = 256, | ||
| Android = 512, | ||
| Browser = 1024, | ||
| MacCatalyst = 2048, | ||
| AnyUnix = FreeBSD | Linux | NetBSD | OSX | illumos | Solaris | iOS | tvOS | MacCatalyst | Android | Browser, | ||
| Any = ~0 | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,14 +1,8 @@ | ||
| <Project Sdk="Microsoft.NET.Sdk"> | ||
| <PropertyGroup> | ||
| <OutputType>Exe</OutputType> | ||
| </PropertyGroup> | ||
| <ItemGroup> | ||
| <Compile Include="*.cs" /> | ||
| </ItemGroup> | ||
| <ItemGroup> | ||
| <ProjectReference Include="CMakeLists.txt" /> | ||
| <ProjectReference Include="$(RepoRoot)/src/tests/Common/XUnitWrapperGenerator/XUnitWrapperGenerator.csproj" OutputItemType="Analyzer" ReferenceOutputAssembly="false" /> | ||
| </ItemGroup> | ||
|
|
||
| <Import Project="$(RepoRoot)/src/tests/Common/XUnitWrapperGenerator/XUnitWrapperGenerator.props" /> | ||
| </Project> |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can reference the generator and import the MSBuild file for all tests. The generator should be a no-op for non-Fact-style tests. If it isn't, I can make changes to the generator to fix that.