Skip to content
This repository was archived by the owner on Jan 23, 2023. It is now read-only.

Commit 5e9714c

Browse files
committed
Exclude XML test assemblies from code coverage
A bunch of XML helper assemblies used by tests are showing up in our code coverage reports, and due to the amount of code in these helper libraries, significantly skewing the results. OpenCover was very recently updated to support excluding assemblies via an attribute. This commit simply adds an ExcludeFromCodeCoverage attribute to these assemblies; our use of OpenCover is already excluding things marked with this attribute, as we were previously using it on some members in System.Collections.Immutable. This will take effect on code coverage once our buildtools are updated to the latest release of OpenCover.
1 parent 5a0d58a commit 5e9714c

File tree

15 files changed

+22
-5
lines changed

15 files changed

+22
-5
lines changed
Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,8 @@
33

44
namespace System.Diagnostics.CodeAnalysis
55
{
6-
// Missing from .NET for Windows store, NET 4.5
76
[AttributeUsage(AttributeTargets.All, Inherited = false, AllowMultiple = false)]
87
internal sealed class ExcludeFromCodeCoverageAttribute : Attribute
98
{
109
}
11-
}
10+
}

src/Common/tests/SystemXml/ModuleCore/ModuleCore.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
<Compile Include="ctestmodule.cs" />
2727
<Compile Include="cvariation.cs" />
2828
<Compile Include="interop.cs" />
29+
<Compile Include="$(CommonPath)\System\Diagnostics\CodeAnalysis\ExcludeFromCodeCoverageAttribute.cs" />
2930
</ItemGroup>
3031
<ItemGroup>
3132
<Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />

src/Common/tests/SystemXml/ModuleCore/ccommon.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
using System;
55
using System.Diagnostics; //Assert
66

7+
[assembly: System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage]
8+
79
namespace OLEDB.Test.ModuleCore
810
{
911
////////////////////////////////////////////////////////////////

src/Common/tests/SystemXml/XmlCoreTest/MiscUtil.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33

44
using System;
55

6+
[assembly: System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage]
7+
68
namespace XmlCoreTest.Common
79
{
810
public static class MiscUtil

src/Common/tests/SystemXml/XmlCoreTest/XmlCoreTest.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
<Compile Include="UnicodeCharHelper.cs" />
2525
<Compile Include="WriterFactory.cs" />
2626
<Compile Include="TestData.g.cs" />
27+
<Compile Include="$(CommonPath)\System\Diagnostics\CodeAnalysis\ExcludeFromCodeCoverageAttribute.cs" />
2728
</ItemGroup>
2829
<ItemGroup>
2930
<Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />

src/System.Collections.Immutable/src/System.Collections.Immutable.csproj

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,10 +96,12 @@
9696
<Compile Include="System\Collections\Immutable\KeysOrValuesCollectionAccessor.cs" />
9797
<Compile Include="System\Collections\Immutable\RefAsValueType.cs" />
9898
<Compile Include="System\Collections\Immutable\SecureObjectPool.cs" />
99-
<Compile Include="System\Diagnostics\CodeAnalysis\ExcludeFromCodeCoverageAttribute.cs" />
10099
<Compile Include="System\Linq\ImmutableArrayExtensions.cs" />
101100
<Compile Include="Validation\Requires.cs" />
102101
<Compile Include="Validation\ValidatedNotNullAttribute.cs" />
102+
<Compile Include="$(CommonPath)\System\Diagnostics\CodeAnalysis\ExcludeFromCodeCoverageAttribute.cs">
103+
<Link>Common\System\Diagnostics\CodeAnalysis\ExcludeFromCodeCoverageAttribute.cs</Link>
104+
</Compile>
103105
</ItemGroup>
104106
<ItemGroup>
105107
<None Include="Interfaces.cd" />
Binary file not shown.

src/System.Xml.ReaderWriter/tests/Writers/XmlWriterApi/System.Xml.RW.XmlWriterApi.Tests.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@
5353
<Compile Include="XmlFactoryWriterTests.cs" />
5454
<Compile Include="XmlWriterTestCaseBase.cs" />
5555
<Compile Include="XmlWriterTestModule.cs" />
56+
<Compile Include="$(CommonPath)\System\Diagnostics\CodeAnalysis\ExcludeFromCodeCoverageAttribute.cs" />
5657
</ItemGroup>
5758
<ItemGroup>
5859
<Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />

src/System.Xml.ReaderWriter/tests/XmlReader/Tests/System.Xml.RW.XmlReader.Tests.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
77
<ProjectGuid>{507DB29F-74F5-4B34-A240-ABE7BD168DF6}</ProjectGuid>
88
<OutputType>Library</OutputType>
9-
<AssemblyName>System.Xml.RW.XmlReaderDisposeTests</AssemblyName>
10-
<RootNamespace>XMLTests.ReaderWriter.DisposeTests</RootNamespace>
9+
<AssemblyName>System.Xml.RW.XmlReader.Tests</AssemblyName>
10+
<RootNamespace>XMLTests.ReaderWriter.Tests</RootNamespace>
1111
</PropertyGroup>
1212
<!-- Default configurations to help VS understand the configurations -->
1313
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">

src/System.Xml.ReaderWriter/tests/XmlReaderLib/CommonTest.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010
using XmlCoreTest.Common;
1111
using OLEDB.Test.ModuleCore;
1212

13+
[assembly: System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage]
14+
1315
namespace XmlReaderTest.Common
1416
{
1517
////////////////////////////////////////////////////////////////

0 commit comments

Comments
 (0)