Skip to content

Commit 684d359

Browse files
committed
Revert "new code coverage (dotnet#5169)"
This reverts commit c8cace2.
1 parent 66c6c24 commit 684d359

6 files changed

Lines changed: 24 additions & 42 deletions

File tree

build.proj

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@
3838
$(TraversalBuildDependsOn);
3939
DownloadExternalTestFiles;
4040
DownloadTensorflowMetaFiles;
41-
DeleteTestHost;
4241
</TraversalBuildDependsOn>
4342
</PropertyGroup>
4443

@@ -117,18 +116,6 @@
117116
</DownloadFile>
118117
</Target>
119118

120-
<!-- Delete testhost.dll and testhost.exe from output folder,
121-
start test from dotnet.exe to keep consistent behavior with older version of Microsoft.NET.Test.Sdk -->
122-
<Target Name="DeleteTestHost">
123-
<Message Importance="High" Text="Delete testhost.dll and testhost.exe from output folder..." />
124-
<ItemGroup>
125-
<FilesToClean Include="$(MSBuildThisFileDirectory)\bin\**\testhost.dll" />
126-
<FilesToClean Include="$(MSBuildThisFileDirectory)\bin\**\testhost.exe" />
127-
</ItemGroup>
128-
<Delete Files="@(FilesToClean)"/>
129-
<RemoveDir Directories="@(FoldersToClean)" />
130-
</Target>
131-
132119
<Target Name="RunTests">
133120
<MSBuild Projects="test\run-tests.proj"
134121
Targets="RunTests" />

build/Codecoverage.proj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@
1616
<_ReportGeneratorPath>$(PkgReportGenerator)\tools\net47\ReportGenerator.exe</_ReportGeneratorPath>
1717
</PropertyGroup>
1818

19-
<Message Importance="high" Text="&quot;$(_ReportGeneratorPath)&quot; -reports:$(BaseOutputPath)$(PlatformConfig)\*\*\coverage.opencover.xml -targetdir:$(BaseOutputPath)$(PlatformConfig)\coverage -filefilters:+*.cs;+*.fs -reporttypes:Cobertura" />
20-
<Exec Command="&quot;$(_ReportGeneratorPath)&quot; -reports:$(BaseOutputPath)$(PlatformConfig)\*\*\coverage.opencover.xml -targetdir:$(BaseOutputPath)$(PlatformConfig)\coverage -filefilters:+*.cs;+*.fs -reporttypes:Cobertura" />
19+
<Message Importance="high" Text="&quot;$(_ReportGeneratorPath)&quot; -reports:$(BaseOutputPath)$(PlatformConfig)\coverage\*.coverage -targetdir:$(BaseOutputPath)$(PlatformConfig)\coverage -filefilters:+https*;+*.fs -reporttypes:Cobertura" />
20+
<Exec Command="&quot;$(_ReportGeneratorPath)&quot; -reports:$(BaseOutputPath)$(PlatformConfig)\coverage\*.coverage -targetdir:$(BaseOutputPath)$(PlatformConfig)\coverage -filefilters:+https*;+*.fs -reporttypes:Cobertura" />
2121

2222
<ItemGroup>
2323
<_CodecovArgs Include="-f;$(BaseOutputPath)$(PlatformConfig)\coverage\Cobertura.xml" />

build/Dependencies.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
<PropertyGroup>
4444
<PublishSymbolsPackageVersion>1.0.0-beta-62824-02</PublishSymbolsPackageVersion>
4545
<CodecovVersion>1.9.0</CodecovVersion>
46-
<CoverletCollectorVersion>1.2.1</CoverletCollectorVersion>
46+
<CoverletVersion>2.7.0</CoverletVersion>
4747
<ReportGeneratorVersion>4.3.6</ReportGeneratorVersion>
4848
<MicrosoftDotNetApiCompatPackageVersion>1.0.0-beta.19225.5</MicrosoftDotNetApiCompatPackageVersion>
4949
</PropertyGroup>

test/Directory.Build.props

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,14 @@
2727
</PropertyGroup>
2828

2929
<ItemGroup>
30-
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.6.1" />
30+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.8.0" />
3131
<PackageReference Include="MSTest.TestFramework" Version="2.1.0" />
3232
<PackageReference Include="MSTest.TestAdapter" Version="2.1.0" />
3333
<PackageReference Include="xunit" Version="2.4.0" />
3434
<PackageReference Include="Xunit.Combinatorial" Version="$(XunitCombinatorialVersion)" />
3535
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.0" />
3636
<PackageReference Include="Microsoft.DotNet.XUnitExtensions" Version="2.4.0-prerelease-63213-02" />
37-
<PackageReference Include="coverlet.collector" Version="$(CoverletCollectorVersion)" />
37+
<PackageReference Include="coverlet.msbuild" Version="$(CoverletVersion)" />
3838
</ItemGroup>
3939

4040
<ItemGroup>
@@ -54,4 +54,22 @@
5454
</ProjectReference>
5555
</ItemGroup>
5656

57+
<PropertyGroup Condition="'$(Coverage)' == 'true'">
58+
<!-- https://github.com/tonerdo/coverlet/issues/618 -->
59+
<IncludeTestAssembly>true</IncludeTestAssembly>
60+
61+
<CollectCoverage>true</CollectCoverage>
62+
<SingleHit>true</SingleHit>
63+
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies> <!-- https://github.com/tonerdo/coverlet/issues/72 -->
64+
<CoverletOutputFormat>opencover</CoverletOutputFormat>
65+
<CoverletOutput>$(BaseOutputPath)$(PlatformConfig)\coverage\$(MSBuildProjectName).coverage</CoverletOutput>
66+
<Include>[Microsoft.ML.*]*</Include>
67+
<!-- Excluding for perf reasons. These classes have tests that can be run conditionally
68+
but they need to be migrated. Excluding these classes should have very minimal effect on code coverage.
69+
-->
70+
<Exclude>[*]Microsoft.ML.*Contracts*,[*]Microsoft.ML.Internal.Utilities*,[*]Microsoft.ML.Data.VBuffer*</Exclude>
71+
<ExcludeByAttribute>Obsolete,ExcludeFromCodeCoverage</ExcludeByAttribute>
72+
<ExcludeByFile>$(RepoRoot)src\Microsoft.ML.OnnxConverter\OnnxMl.cs,$(RepoRoot)src\Microsoft.ML.TensorFlow\TensorFlow\Buffer.cs,$(RepoRoot)src\Microsoft.ML.TensorFlow\TensorFlow\Tensor.cs,$(RepoRoot)src\Microsoft.ML.TensorFlow\TensorFlow\Tensorflow.cs</ExcludeByFile>
73+
</PropertyGroup>
74+
5775
</Project>

test/coverlet.runsettings

Lines changed: 0 additions & 18 deletions
This file was deleted.

test/run-tests.proj

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,7 @@
88

99
<Target Name="RunTests">
1010
<Message Importance="High" Text="Running tests ..." />
11-
<MSBuild Condition="'$(Coverage)' == 'true'"
12-
Targets="VSTest"
13-
Projects="@(Project)"
14-
Properties="VSTestNoBuild=true;VSTestBlame=true;VSTestCollect=XPlat Code Coverage;VSTestSetting=$(MSBuildThisFileDirectory)\coverlet.runsettings" />
15-
<MSBuild Condition="'$(Coverage)' == 'false'"
16-
Targets="VSTest"
11+
<MSBuild Targets="VSTest"
1712
Projects="@(Project)"
1813
Properties="VSTestNoBuild=true;VSTestBlame=true" />
1914
</Target>

0 commit comments

Comments
 (0)