-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Establish Code Coverage for wpf #10514
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
Changes from all commits
bf5e1b8
35aed82
4d42cc9
7585fd9
a6cedcc
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| # https://docs.codecov.io/docs/codecov-yaml | ||
| # https://github.com/codecov/support/wiki/Codecov-Yaml | ||
|
|
||
| coverage: | ||
| range: 20..80 # 20 is red, 80 is green | ||
| round: down # always round down | ||
| precision: 5 # highest level of decimal precision | ||
| status: | ||
| project: | ||
| default: false | ||
| patch: | ||
| default: false | ||
| fixes: | ||
| - "eng/::/" | ||
|
|
||
| comment: | ||
| layout: "diff, flags" # coverage difference, flags below | ||
|
|
||
| flags: # which files to include in the reporting | ||
| production: | ||
| paths: | ||
| - src/Microsoft.DotNet.Wpf/src | ||
| test: | ||
| paths: | ||
| - src/Microsoft.DotNet.Wpf/tests/ |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,40 @@ | ||
| <Project DefaultTargets="Codecov"> | ||
| <PropertyGroup> | ||
| <Language>C#</Language> | ||
| </PropertyGroup> | ||
|
|
||
| <Import Sdk="Microsoft.NET.Sdk" Project="Sdk.props" /> | ||
|
|
||
| <PropertyGroup> | ||
| <!-- We need to specify a framework in order for the Restore target to work --> | ||
| <TargetFramework>netcoreapp3.1</TargetFramework> | ||
| </PropertyGroup> | ||
|
|
||
| <ItemGroup> | ||
| <PackageReference Include="Codecov" Version="$(CodecovVersion)" GeneratePathProperty="true" /> | ||
| <PackageReference Include="ReportGenerator" Version="$(ReportGeneratorVersion)" GeneratePathProperty="true" /> | ||
| </ItemGroup> | ||
| <Target Name="Codecov"> | ||
| <PropertyGroup> | ||
| <_CodecovPath>$(NuGetPackageRoot)codecov\$(CodecovVersion)\tools\Codecov.exe</_CodecovPath> | ||
| <_ReportGeneratorPath>$(NuGetPackageRoot)reportgenerator\$(ReportGeneratorVersion)\tools\net47\ReportGenerator.exe</_ReportGeneratorPath> | ||
| </PropertyGroup> | ||
|
|
||
| <Message Importance="high" Text=""$(_ReportGeneratorPath)" -reports:$(ArtifactsDir)TestResults\**\coverage.opencover.xml -targetdir:$(ArtifactsDir)coverage -reporttypes:Cobertura" /> | ||
| <Exec Command=""$(_ReportGeneratorPath)" -reports:$(ArtifactsDir)TestResults\**\coverage.opencover.xml -targetdir:$(ArtifactsDir)coverage -reporttypes:Cobertura" /> | ||
|
|
||
| <ItemGroup> | ||
| <_CodecovArgs Include="-f;$(ArtifactsDir)coverage\Cobertura.xml" /> | ||
|
|
||
| <!-- Report an error if the upload fails (currently disabled due to reliability issues) --> | ||
| <_CodecovArgs Include="--required" Condition="'False' == ''" /> | ||
|
|
||
| <_CodecovFlags Include="$(Configuration)" Condition="'$(Configuration)' != ''" /> | ||
| </ItemGroup> | ||
|
|
||
| <Message Importance="high" Text=""$(_CodecovPath)" @(_CodecovArgs, ' ') --flag @(_CodecovFlags, ',')" /> | ||
| <Exec Command=""$(_CodecovPath)" @(_CodecovArgs, ' ') --flag @(_CodecovFlags, ',')" /> | ||
| </Target> | ||
|
|
||
| <Import Sdk="Microsoft.NET.Sdk" Project="Sdk.targets" /> | ||
| </Project> |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| <?xml version="1.0" encoding="utf-8"?> | ||
| <RunSettings> | ||
| <DataCollectionRunSettings> | ||
| <DataCollectors> | ||
| <DataCollector friendlyName="XPlat code coverage"> | ||
| <Configuration> | ||
| <Format>opencover</Format> | ||
|
|
||
| <!-- https://github.com/tonerdo/coverlet/issues/618 --> | ||
| <IncludeTestAssembly>true</IncludeTestAssembly> | ||
|
|
||
| <SingleHit>true</SingleHit> | ||
| <Include></Include> | ||
| <Exclude></Exclude> | ||
| <ExcludeByAttribute>ExcludeFromCodeCoverage</ExcludeByAttribute> | ||
| <ExcludeByFile></ExcludeByFile> | ||
| </Configuration> | ||
| </DataCollector> | ||
| </DataCollectors> | ||
| </DataCollectionRunSettings> | ||
| </RunSettings> |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| <Project> | ||
| <!-- Set code coverage properties that reference properties not available in Directory.Build.props --> | ||
| <PropertyGroup Condition="'$(Coverage)' == 'true'"> | ||
| <CoverletOutput>$(TargetDir)coverage\$(MSBuildProjectName).coverage</CoverletOutput> | ||
| <!-- https://github.com/tonerdo/coverlet/issues/363 --> | ||
| <DeterministicSourcePaths>false</DeterministicSourcePaths> | ||
| </PropertyGroup> | ||
|
|
||
| <PropertyGroup Condition="'$(IsTestProject)' == 'true'"> | ||
| <TestRunnerAdditionalArguments>$(TestRunnerAdditionalArguments) --blame</TestRunnerAdditionalArguments> | ||
| <TestRunnerAdditionalArguments>$(TestRunnerAdditionalArguments) --blame-hang-dump-type full</TestRunnerAdditionalArguments> | ||
| <TestRunnerAdditionalArguments>$(TestRunnerAdditionalArguments) --blame-hang-timeout 10min</TestRunnerAdditionalArguments> | ||
| <TestRunnerAdditionalArguments>$(TestRunnerAdditionalArguments) --blame-crash-dump-type full</TestRunnerAdditionalArguments> | ||
| </PropertyGroup> | ||
|
|
||
| <PropertyGroup Condition="'$(IsTestProject)' == 'true' AND '$(Coverage)' == 'true'"> | ||
| <TestRunnerAdditionalArguments>$(TestRunnerAdditionalArguments) --collect:"XPlat Code Coverage"</TestRunnerAdditionalArguments> | ||
| <TestRunnerAdditionalArguments>$(TestRunnerAdditionalArguments) --test-adapter-path "$(Pkgcoverlet_collector)/build/netstandard1.0"</TestRunnerAdditionalArguments> | ||
| <TestRunnerAdditionalArguments>$(TestRunnerAdditionalArguments) --settings "$(RepoRoot)/eng/CodeCoverage.runsettings"</TestRunnerAdditionalArguments> | ||
| </PropertyGroup> | ||
| </Project> |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -654,13 +654,15 @@ private void EnsureParameterDictionary() | |
| private const char _equalSeparator = '='; | ||
|
|
||
| //This array is sorted by the ascii value of these characters. | ||
| private static ReadOnlySpan<char> AllowedCharacters => [ | ||
| '!' /*33*/, '#' /*35*/ , '$' /*36*/, | ||
| '%' /*37*/, '&' /*38*/ , '\'' /*39*/, | ||
| '*' /*42*/, '+' /*43*/ , '-' /*45*/, | ||
| '.' /*46*/, '^' /*94*/ , '_' /*95*/, | ||
| '`' /*96*/, '|' /*124*/, '~' /*126*/, | ||
| ]; | ||
| private static readonly char[] s_allowedCharacters = [ | ||
| '!' /*33*/, '#' /*35*/ , '$' /*36*/, | ||
| '%' /*37*/, '&' /*38*/ , '\'' /*39*/, | ||
| '*' /*42*/, '+' /*43*/ , '-' /*45*/, | ||
| '.' /*46*/, '^' /*94*/ , '_' /*95*/, | ||
| '`' /*96*/, '|' /*124*/, '~' /*126*/, | ||
| ]; | ||
|
|
||
| private static ReadOnlySpan<char> AllowedCharacters => s_allowedCharacters; | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why was this changed? Makes no sense?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yep, just the same thing. This was done just to fix some test errors on CI:
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @singhashish-wpf Yeah but that should never fail, it makes no sense why it should throw
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Issue was in Coverlet, solved via #10625
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Cool ! Thanks @h3xds1nz |
||
|
|
||
| //Linear White Space characters | ||
| private static readonly char[] _linearWhiteSpaceChars = [ | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.