Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
<MSBuildTreatWarningsAsErrors>true</MSBuildTreatWarningsAsErrors>
<LangVersion>preview</LangVersion>
<RestoreSources>
https://api.nuget.org/v3/index.json;
</RestoreSources>
</PropertyGroup>

<ItemGroup>
Expand Down
1 change: 1 addition & 0 deletions Directory.Build.targets
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,6 @@
<PackageReference Update="xunit" Version="2.4.1" />
<PackageReference Update="xunit.assert" Version="2.4.1" />
<PackageReference Update="xunit.runner.visualstudio" Version="2.4.1"/>
<PackageReference Update="Tmds.ExecFunction" Version="0.3.0" />
</ItemGroup>
</Project>
17 changes: 8 additions & 9 deletions coverlet.sln
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "coverlet.collector", "src\c
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "coverlet.collector.tests", "test\coverlet.collector.tests\coverlet.collector.tests.csproj", "{5ED4FA81-8F8C-4211-BA88-7573BD63262E}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "coverlet.tests.remoteexecutor", "test\coverlet.tests.remoteexecutor\coverlet.tests.remoteexecutor.csproj", "{3E0F9E47-A1D7-4DF5-841D-A633486E2475}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "coverlet.tests.projectsample.empty", "test\coverlet.tests.projectsample.empty\coverlet.tests.projectsample.empty.csproj", "{085A3AFB-C086-4E98-86F1-1B481446EC5E}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{77A15177-8262-488F-AF2B-91B9055715DA}"
Expand All @@ -37,7 +35,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
Directory.Build.targets = Directory.Build.targets
global.json = global.json
eng\nightly.ps1 = eng\nightly.ps1
nuget.config = nuget.config
EndProjectSection
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "coverlet.tests.projectsample.excludedbyattribute", "test\coverlet.tests.projectsample.excludedbyattribute\coverlet.tests.projectsample.excludedbyattribute.csproj", "{D6B14F2F-9E7D-4D2C-BAC8-48834F853ED6}"
Expand All @@ -46,7 +43,9 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "coverlet.integration.tests"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "coverlet.integration.template", "test\coverlet.integration.template\coverlet.integration.template.csproj", "{F6FE7678-C662-43D3-AC6A-64F6AC5A5935}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "coverlet.core.tests.samples.netstandard", "test\coverlet.core.tests.samples.netstandard\coverlet.core.tests.samples.netstandard.csproj", "{5FF404AD-7C0B-465A-A1E9-558CDC642B0C}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "coverlet.core.tests.samples.netstandard", "test\coverlet.core.tests.samples.netstandard\coverlet.core.tests.samples.netstandard.csproj", "{5FF404AD-7C0B-465A-A1E9-558CDC642B0C}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "coverlet.tests.xunit.extensions", "test\coverlet.tests.xunit.extensions\coverlet.tests.xunit.extensions.csproj", "{F8199E19-FA9A-4559-9101-CAD7028121B4}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand Down Expand Up @@ -86,10 +85,6 @@ Global
{5ED4FA81-8F8C-4211-BA88-7573BD63262E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{5ED4FA81-8F8C-4211-BA88-7573BD63262E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{5ED4FA81-8F8C-4211-BA88-7573BD63262E}.Release|Any CPU.Build.0 = Release|Any CPU
{3E0F9E47-A1D7-4DF5-841D-A633486E2475}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{3E0F9E47-A1D7-4DF5-841D-A633486E2475}.Debug|Any CPU.Build.0 = Debug|Any CPU
{3E0F9E47-A1D7-4DF5-841D-A633486E2475}.Release|Any CPU.ActiveCfg = Release|Any CPU
{3E0F9E47-A1D7-4DF5-841D-A633486E2475}.Release|Any CPU.Build.0 = Release|Any CPU
{085A3AFB-C086-4E98-86F1-1B481446EC5E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{085A3AFB-C086-4E98-86F1-1B481446EC5E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{085A3AFB-C086-4E98-86F1-1B481446EC5E}.Release|Any CPU.ActiveCfg = Release|Any CPU
Expand All @@ -110,6 +105,10 @@ Global
{5FF404AD-7C0B-465A-A1E9-558CDC642B0C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{5FF404AD-7C0B-465A-A1E9-558CDC642B0C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{5FF404AD-7C0B-465A-A1E9-558CDC642B0C}.Release|Any CPU.Build.0 = Release|Any CPU
{F8199E19-FA9A-4559-9101-CAD7028121B4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{F8199E19-FA9A-4559-9101-CAD7028121B4}.Debug|Any CPU.Build.0 = Debug|Any CPU
{F8199E19-FA9A-4559-9101-CAD7028121B4}.Release|Any CPU.ActiveCfg = Release|Any CPU
{F8199E19-FA9A-4559-9101-CAD7028121B4}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand All @@ -123,12 +122,12 @@ Global
{C68CF6DE-F86C-4BCF-BAB9-7A60C320E1F9} = {2FEBDE1B-83E3-445B-B9F8-5644B0E0E134}
{F5B2C45B-274B-43D6-9565-8B50659CFE56} = {E877EBA4-E78B-4F7D-A2D3-1E070FED04CD}
{5ED4FA81-8F8C-4211-BA88-7573BD63262E} = {2FEBDE1B-83E3-445B-B9F8-5644B0E0E134}
{3E0F9E47-A1D7-4DF5-841D-A633486E2475} = {2FEBDE1B-83E3-445B-B9F8-5644B0E0E134}
{085A3AFB-C086-4E98-86F1-1B481446EC5E} = {2FEBDE1B-83E3-445B-B9F8-5644B0E0E134}
{D6B14F2F-9E7D-4D2C-BAC8-48834F853ED6} = {2FEBDE1B-83E3-445B-B9F8-5644B0E0E134}
{99B4059C-B25C-4B82-8117-A0E9DC9B0949} = {2FEBDE1B-83E3-445B-B9F8-5644B0E0E134}
{F6FE7678-C662-43D3-AC6A-64F6AC5A5935} = {2FEBDE1B-83E3-445B-B9F8-5644B0E0E134}
{5FF404AD-7C0B-465A-A1E9-558CDC642B0C} = {2FEBDE1B-83E3-445B-B9F8-5644B0E0E134}
{F8199E19-FA9A-4559-9101-CAD7028121B4} = {2FEBDE1B-83E3-445B-B9F8-5644B0E0E134}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {9CA57C02-97B0-4C38-A027-EA61E8741F10}
Expand Down
2 changes: 1 addition & 1 deletion eng/azure-pipelines-nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ steps:
version: 2.2.402
- task: UseDotNet@2
inputs:
version: 3.1.100
version: 3.1.200
- powershell:
.\eng\nightly.ps1 -apiKey $env:APIKEY -source $env:SOURCE
ignoreLASTEXITCODE: true
Expand Down
4 changes: 2 additions & 2 deletions eng/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ steps:

- task: UseDotNet@2
inputs:
version: 3.1.100
version: 3.1.200
displayName: Install .NET Core SDK

- script: dotnet restore
Expand All @@ -22,5 +22,5 @@ steps:
displayName: Test
inputs:
command: test
arguments: -c $(BuildConfiguration) --no-build /p:CollectCoverage=true /p:CoverletOutputFormat=opencover /p:Include="[coverlet.collector]*%2c[coverlet.core]*%2c[coverlet.msbuild.tasks]*" /p:Exclude="[coverlet.core.tests.samples.netstandard]*%2c[coverlet.tests.remoteexecutor]*"
arguments: -c $(BuildConfiguration) --no-build /p:CollectCoverage=true /p:CoverletOutputFormat=opencover /p:Include="[coverlet.collector]*%2c[coverlet.core]*%2c[coverlet.msbuild.tasks]*" /p:Exclude="[coverlet.core.tests.samples.netstandard]*%2c[coverlet.tests.xunit.extensions]*"
testRunTitle: $(Agent.JobName)
2 changes: 1 addition & 1 deletion global.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"sdk": {
"version": "3.1.100"
"version": "3.1.*"
}
}
7 changes: 0 additions & 7 deletions nuget.config

This file was deleted.

29 changes: 16 additions & 13 deletions test/coverlet.core.tests/Coverage/CoverageTests.AsyncAwait.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,21 @@
using System.Threading.Tasks;

using Coverlet.Core.Samples.Tests;
using Coverlet.Tests.RemoteExecutor;
using Coverlet.Tests.Xunit.Extensions;
using Xunit;

namespace Coverlet.Core.Tests
{
public partial class CoverageTests
{
[Fact]
[ConditionalFact]
[SkipOnOS(OS.MacOS)]
public void AsyncAwait()
{
string path = Path.GetTempFileName();
try
{
RemoteExecutor.Invoke(async pathSerialize =>
FunctionExecutor.Run(async (string[] pathSerialize) =>
{
CoveragePrepareResult coveragePrepareResult = await TestInstrumentationHelper.Run<AsyncAwait>(instance =>
{
Expand All @@ -29,9 +30,9 @@ public void AsyncAwait()
res = ((Task<int>)instance.ConfigureAwait()).ConfigureAwait(false).GetAwaiter().GetResult();

return Task.CompletedTask;
}, persistPrepareResultToFile: pathSerialize);
}, persistPrepareResultToFile: pathSerialize[0]);
return 0;
}, path).Dispose();
}, new string[] { path });

TestInstrumentationHelper.GetCoverageResult(path)
.Document("Instrumentation.AsyncAwait.cs")
Expand Down Expand Up @@ -66,23 +67,24 @@ public void AsyncAwait()
}
}

[Fact]
[ConditionalFact]
[SkipOnOS(OS.MacOS)]
public void AsyncAwait_Issue_669_1()
{
string path = Path.GetTempFileName();
try
{
RemoteExecutor.Invoke(async pathSerialize =>
FunctionExecutor.Run(async (string[] pathSerialize) =>
{
CoveragePrepareResult coveragePrepareResult = await TestInstrumentationHelper.Run<Issue_669_1>(instance =>
{
((Task)instance.Test()).ConfigureAwait(false).GetAwaiter().GetResult();
return Task.CompletedTask;
},
persistPrepareResultToFile: pathSerialize);
persistPrepareResultToFile: pathSerialize[0]);

return 0;
}, path).Dispose();
}, new string[] { path });

TestInstrumentationHelper.GetCoverageResult(path)
.Document("Instrumentation.AsyncAwait.cs")
Expand All @@ -97,23 +99,24 @@ public void AsyncAwait_Issue_669_1()
}
}

[Fact]
[ConditionalFact]
[SkipOnOS(OS.MacOS)]
public void AsyncAwait_Issue_669_2()
{
string path = Path.GetTempFileName();
try
{
RemoteExecutor.Invoke(async pathSerialize =>
FunctionExecutor.Run(async (string[] pathSerialize) =>
{
CoveragePrepareResult coveragePrepareResult = await TestInstrumentationHelper.Run<Issue_669_2>(instance =>
{
((ValueTask<System.Net.Http.HttpResponseMessage>)instance.SendRequest()).ConfigureAwait(false).GetAwaiter().GetResult();
return Task.CompletedTask;
},
persistPrepareResultToFile: pathSerialize);
persistPrepareResultToFile: pathSerialize[0]);

return 0;
}, path).Dispose();
}, new string[] { path });

TestInstrumentationHelper.GetCoverageResult(path)
.Document("Instrumentation.AsyncAwait.cs")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
using System;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices;
using System.Threading.Tasks;

using Coverlet.Core.Abstracts;
using Coverlet.Core.Helpers;
using Coverlet.Core.Samples.Tests;
using Coverlet.Tests.RemoteExecutor;
using Coverlet.Tests.Xunit.Extensions;
using Moq;
using Xunit;

Expand All @@ -33,23 +34,24 @@ public void TestCoverageSkipModule__AssemblyMarkedAsExcludeFromCodeCoverage()
loggerMock.Verify(l => l.LogVerbose(It.IsAny<string>()));
}

[Fact]
[ConditionalFact]
[SkipOnOS(OS.MacOS)]
public void ExcludeFromCodeCoverage_CompilerGeneratedMethodsAndTypes()
{
string path = Path.GetTempFileName();
try
{
RemoteExecutor.Invoke(async pathSerialize =>
FunctionExecutor.Run(async (string[] pathSerialize) =>
{
CoveragePrepareResult coveragePrepareResult = await TestInstrumentationHelper.Run<MethodsWithExcludeFromCodeCoverageAttr>(instance =>
{
((Task<int>)instance.Test("test")).ConfigureAwait(false).GetAwaiter().GetResult();
return Task.CompletedTask;
}, persistPrepareResultToFile: pathSerialize);
}, persistPrepareResultToFile: pathSerialize[0]);

return 0;

}, path).Dispose();
}, new string[] { path });

CoverageResult result = TestInstrumentationHelper.GetCoverageResult(path);

Expand All @@ -74,23 +76,24 @@ public void ExcludeFromCodeCoverage_CompilerGeneratedMethodsAndTypes()
}
}

[Fact]
[ConditionalFact]
[SkipOnOS(OS.MacOS)]
public void ExcludeFromCodeCoverage_CompilerGeneratedMethodsAndTypes_NestedMembers()
{
string path = Path.GetTempFileName();
try
{
RemoteExecutor.Invoke(async pathSerialize =>
FunctionExecutor.Run(async (string[] pathSerialize) =>
{
CoveragePrepareResult coveragePrepareResult = await TestInstrumentationHelper.Run<MethodsWithExcludeFromCodeCoverageAttr_NestedStateMachines>(instance =>
{
instance.Test();
return Task.CompletedTask;
}, persistPrepareResultToFile: pathSerialize);
}, persistPrepareResultToFile: pathSerialize[0]);

return 0;

}, path).Dispose();
}, new string[] { path });

CoverageResult result = TestInstrumentationHelper.GetCoverageResult(path);

Expand All @@ -104,23 +107,24 @@ public void ExcludeFromCodeCoverage_CompilerGeneratedMethodsAndTypes_NestedMembe
}
}

[Fact]
[ConditionalFact]
[SkipOnOS(OS.MacOS)]
public void ExcludeFromCodeCoverageCompilerGeneratedMethodsAndTypes_Issue670()
{
string path = Path.GetTempFileName();
try
{
RemoteExecutor.Invoke(async pathSerialize =>
FunctionExecutor.Run(async (string[] pathSerialize) =>
{
CoveragePrepareResult coveragePrepareResult = await TestInstrumentationHelper.Run<MethodsWithExcludeFromCodeCoverageAttr_Issue670>(instance =>
{
instance.Test("test");
return Task.CompletedTask;
}, persistPrepareResultToFile: pathSerialize);
}, persistPrepareResultToFile: pathSerialize[0]);

return 0;

}, path).Dispose();
}, new string[] { path });

CoverageResult result = TestInstrumentationHelper.GetCoverageResult(path);

Expand All @@ -134,22 +138,23 @@ public void ExcludeFromCodeCoverageCompilerGeneratedMethodsAndTypes_Issue670()
}
}

[Fact]
[ConditionalFact]
[SkipOnOS(OS.MacOS)]
public void ExcludeFromCodeCoverageNextedTypes()
{
string path = Path.GetTempFileName();
try
{
RemoteExecutor.Invoke(async pathSerialize =>
FunctionExecutor.Run(async (string[] pathSerialize) =>
{
CoveragePrepareResult coveragePrepareResult = await TestInstrumentationHelper.Run<ExcludeFromCoverageAttrFilterClass1>(instance =>
{
Assert.Equal(42, instance.Run());
return Task.CompletedTask;
}, persistPrepareResultToFile: pathSerialize);
}, persistPrepareResultToFile: pathSerialize[0]);

return 0;
}, path).Dispose();
}, new string[] { path });

TestInstrumentationHelper.GetCoverageResult(path)
.Document("Instrumentation.ExcludeFromCoverage.cs")
Expand Down
Loading