From 96e723b8198c678557ac5220d80fc96e3a29a045 Mon Sep 17 00:00:00 2001 From: Marco Rossignoli Date: Fri, 8 Apr 2022 09:21:04 +0200 Subject: [PATCH 01/60] Add project name to the CoverletSourceRootsMapping file to avoid file locking --- .../Examples/VSTest/DeterministicBuild/HowTo.md | 4 ++-- .../build/netstandard1.0/coverlet.collector.targets | 2 +- src/coverlet.core/Helpers/SourceRootTranslator.cs | 5 +++-- src/coverlet.msbuild.tasks/coverlet.msbuild.targets | 2 +- .../Helpers/SourceRootTranslatorTests.cs | 6 +++--- test/coverlet.integration.tests/DeterministicBuild.cs | 9 +++++---- 6 files changed, 15 insertions(+), 13 deletions(-) diff --git a/Documentation/Examples/VSTest/DeterministicBuild/HowTo.md b/Documentation/Examples/VSTest/DeterministicBuild/HowTo.md index b1002a65c..96d94ef1b 100644 --- a/Documentation/Examples/VSTest/DeterministicBuild/HowTo.md +++ b/Documentation/Examples/VSTest/DeterministicBuild/HowTo.md @@ -59,7 +59,7 @@ Add collectors package version generated to `"..\Documentation\Examples\VSTest\D Go to test project folder and run ``` C:\git\coverlet\Documentation\Examples\VSTest\DeterministicBuild (detbuilddocs -> origin) -λ dotnet test --collect:"XPlat Code Coverage" /p:DeterministicSourcePaths=true +λ dotnet test --collect:"XPlat Code Coverage" /p:DeterministicSourcePaths=true -- DataCollectionRunSettings.DataCollectors.DataCollector.Configuration.DeterministicReport=true Test run for C:\git\coverlet\Documentation\Examples\VSTest\DeterministicBuild\XUnitTestProject1\bin\Debug\netcoreapp3.1\XUnitTestProject1.dll(.NETCoreApp,Version=v3.1) Microsoft (R) Test Execution Command Line Tool Version 16.5.0 Copyright (c) Microsoft Corporation. All rights reserved. @@ -78,5 +78,5 @@ Total tests: 1 You should see on output folder the coverlet source root mapping file generated. This is the confirmation that you're running coverage on deterministic build. ``` -Documentation\Examples\VSTest\DeterministicBuild\XUnitTestProject1\bin\Debug\netcoreapp3.1\CoverletSourceRootsMapping +Documentation\Examples\VSTest\DeterministicBuild\XUnitTestProject1\bin\Debug\netcoreapp3.1\CoverletSourceRootsMapping_XUnitTestProject1 ``` \ No newline at end of file diff --git a/src/coverlet.collector/build/netstandard1.0/coverlet.collector.targets b/src/coverlet.collector/build/netstandard1.0/coverlet.collector.targets index 2e4adb4c5..7bd7b28e7 100644 --- a/src/coverlet.collector/build/netstandard1.0/coverlet.collector.targets +++ b/src/coverlet.collector/build/netstandard1.0/coverlet.collector.targets @@ -44,7 +44,7 @@ WARNING: DO NOT MODIFY this file unless you are knowledgeable about MSBuild and <_mapping Include="@(_byProject->'%(Identity)|%(OriginalPath)=%(MappedPath)')" /> - <_sourceRootMappingFilePath>$([MSBuild]::EnsureTrailingSlash('$(OutputPath)'))CoverletSourceRootsMapping + <_sourceRootMappingFilePath>$([MSBuild]::EnsureTrailingSlash('$(OutputPath)'))CoverletSourceRootsMapping_$(AssemblyName) > _sourceRootMapping; private readonly Dictionary> _sourceToDeterministicPathMapping; - private const string MappingFileName = "CoverletSourceRootsMapping"; + private readonly string _mappingFileName; private Dictionary _resolutionCacheFiles; public SourceRootTranslator(ILogger logger, IFileSystem fileSystem) @@ -44,6 +44,7 @@ public SourceRootTranslator(string moduleTestPath, ILogger logger, IFileSystem f { throw new FileNotFoundException($"Module test path '{moduleTestPath}' not found", moduleTestPath); } + _mappingFileName = $"CoverletSourceRootsMapping_{Path.GetFileNameWithoutExtension(moduleTestPath)}"; _sourceRootMapping = LoadSourceRootMapping(Path.GetDirectoryName(moduleTestPath)); _sourceToDeterministicPathMapping = LoadSourceToDeterministicPathMapping(_sourceRootMapping); } @@ -75,7 +76,7 @@ private Dictionary> LoadSourceRootMapping(string { var mapping = new Dictionary>(); - string mappingFilePath = Path.Combine(directory, MappingFileName); + string mappingFilePath = Path.Combine(directory, _mappingFileName); if (!_fileSystem.Exists(mappingFilePath)) { return mapping; diff --git a/src/coverlet.msbuild.tasks/coverlet.msbuild.targets b/src/coverlet.msbuild.tasks/coverlet.msbuild.targets index c271ec2d1..96fa56a6c 100644 --- a/src/coverlet.msbuild.tasks/coverlet.msbuild.targets +++ b/src/coverlet.msbuild.tasks/coverlet.msbuild.targets @@ -24,7 +24,7 @@ <_mapping Include="@(_byProject->'%(Identity)|%(OriginalPath)=%(MappedPath)')" /> - <_sourceRootMappingFilePath>$([MSBuild]::EnsureTrailingSlash('$(OutputPath)'))CoverletSourceRootsMapping + <_sourceRootMappingFilePath>$([MSBuild]::EnsureTrailingSlash('$(OutputPath)'))CoverletSourceRootsMapping_$(AssemblyName) (); fileSystem.Setup(f => f.Exists(It.IsAny())).Returns((string p) => { - if (p == "testLib.dll" || p == @"C:\git\coverlet\src\coverlet.core\obj\Debug\netstandard2.0\coverlet.core.pdb" || p == "CoverletSourceRootsMapping") return true; + if (p == "testLib.dll" || p == @"C:\git\coverlet\src\coverlet.core\obj\Debug\netstandard2.0\coverlet.core.pdb" || p == "CoverletSourceRootsMapping_testLib") return true; return false; }); fileSystem.Setup(f => f.ReadAllLines(It.IsAny())).Returns(File.ReadAllLines(@"TestAssets/CoverletSourceRootsMappingTest")); @@ -39,7 +39,7 @@ public void TranslatePathRoot_Success() var fileSystem = new Mock(); fileSystem.Setup(f => f.Exists(It.IsAny())).Returns((string p) => { - if (p == "testLib.dll" || p == @"C:\git\coverlet\src\coverlet.core\obj\Debug\netstandard2.0\coverlet.core.pdb" || p == "CoverletSourceRootsMapping") return true; + if (p == "testLib.dll" || p == @"C:\git\coverlet\src\coverlet.core\obj\Debug\netstandard2.0\coverlet.core.pdb" || p == "CoverletSourceRootsMapping_testLib") return true; return false; }); fileSystem.Setup(f => f.ReadAllLines(It.IsAny())).Returns(File.ReadAllLines(@"TestAssets/CoverletSourceRootsMappingTest")); @@ -71,7 +71,7 @@ public void Translate_MalformedFile() var fileSystem = new Mock(); fileSystem.Setup(f => f.Exists(It.IsAny())).Returns((string p) => { - if (p == "testLib.dll" || p == "CoverletSourceRootsMapping") return true; + if (p == "testLib.dll" || p == "CoverletSourceRootsMapping_testLib") return true; return false; }); fileSystem.Setup(f => f.ReadAllLines(It.IsAny())).Returns(new string[1] { "malformedRow" }); diff --git a/test/coverlet.integration.tests/DeterministicBuild.cs b/test/coverlet.integration.tests/DeterministicBuild.cs index b9f11a047..9f830771d 100644 --- a/test/coverlet.integration.tests/DeterministicBuild.cs +++ b/test/coverlet.integration.tests/DeterministicBuild.cs @@ -16,6 +16,7 @@ public class DeterministicBuild : BaseTest, IDisposable private readonly string _testProjectPath = Path.GetFullPath("../../../../coverlet.integration.determisticbuild"); private string? _testProjectTfm; private const string PropsFileName = "DeterministicTest.props"; + private const string ExpectedMappingFileName = "CoverletSourceRootsMapping_coverletsample.integration.determisticbuild"; private readonly string _buildConfiguration; public DeterministicBuild() @@ -75,7 +76,7 @@ public void Msbuild() CreateDeterministicTestPropsFile(); DotnetCli($"build -c {_buildConfiguration} /p:DeterministicSourcePaths=true", out string standardOutput, out string _, _testProjectPath); Assert.Contains("Build succeeded.", standardOutput); - string sourceRootMappingFilePath = Path.Combine(_testProjectPath, "bin", _buildConfiguration, _testProjectTfm!, "CoverletSourceRootsMapping"); + string sourceRootMappingFilePath = Path.Combine(_testProjectPath, "bin", _buildConfiguration, _testProjectTfm!, ExpectedMappingFileName); Assert.True(File.Exists(sourceRootMappingFilePath), sourceRootMappingFilePath); Assert.True(!string.IsNullOrEmpty(File.ReadAllText(sourceRootMappingFilePath)), "Empty CoverletSourceRootsMapping file"); Assert.Contains("=/_/", File.ReadAllText(sourceRootMappingFilePath)); @@ -98,7 +99,7 @@ public void Msbuild_SourceLink() CreateDeterministicTestPropsFile(); DotnetCli($"build -c {_buildConfiguration} /p:DeterministicSourcePaths=true", out string standardOutput, out string _, _testProjectPath); Assert.Contains("Build succeeded.", standardOutput); - string sourceRootMappingFilePath = Path.Combine(_testProjectPath, "bin", _buildConfiguration, _testProjectTfm!, "CoverletSourceRootsMapping"); + string sourceRootMappingFilePath = Path.Combine(_testProjectPath, "bin", _buildConfiguration, _testProjectTfm!, ExpectedMappingFileName); Assert.True(File.Exists(sourceRootMappingFilePath), sourceRootMappingFilePath); Assert.True(!string.IsNullOrEmpty(File.ReadAllText(sourceRootMappingFilePath)), "Empty CoverletSourceRootsMapping file"); Assert.Contains("=/_/", File.ReadAllText(sourceRootMappingFilePath)); @@ -122,7 +123,7 @@ public void Collectors() CreateDeterministicTestPropsFile(); DotnetCli($"build -c {_buildConfiguration} /p:DeterministicSourcePaths=true", out string standardOutput, out string _, _testProjectPath); Assert.Contains("Build succeeded.", standardOutput); - string sourceRootMappingFilePath = Path.Combine(_testProjectPath, "bin", GetAssemblyBuildConfiguration().ToString(), _testProjectTfm!, "CoverletSourceRootsMapping"); + string sourceRootMappingFilePath = Path.Combine(_testProjectPath, "bin", GetAssemblyBuildConfiguration().ToString(), _testProjectTfm!, ExpectedMappingFileName); Assert.True(File.Exists(sourceRootMappingFilePath), sourceRootMappingFilePath); Assert.NotEmpty(File.ReadAllText(sourceRootMappingFilePath)); Assert.Contains("=/_/", File.ReadAllText(sourceRootMappingFilePath)); @@ -150,7 +151,7 @@ public void Collectors_SourceLink() CreateDeterministicTestPropsFile(); DotnetCli($"build -c {_buildConfiguration} /p:DeterministicSourcePaths=true", out string standardOutput, out string _, _testProjectPath); Assert.Contains("Build succeeded.", standardOutput); - string sourceRootMappingFilePath = Path.Combine(_testProjectPath, "bin", GetAssemblyBuildConfiguration().ToString(), _testProjectTfm!, "CoverletSourceRootsMapping"); + string sourceRootMappingFilePath = Path.Combine(_testProjectPath, "bin", GetAssemblyBuildConfiguration().ToString(), _testProjectTfm!, ExpectedMappingFileName); Assert.True(File.Exists(sourceRootMappingFilePath), sourceRootMappingFilePath); Assert.NotEmpty(File.ReadAllText(sourceRootMappingFilePath)); Assert.Contains("=/_/", File.ReadAllText(sourceRootMappingFilePath)); From d6dd658f6bc60d202ab88b4be6671fab9a03e78a Mon Sep 17 00:00:00 2001 From: Marco Rossignoli Date: Fri, 8 Apr 2022 09:38:11 +0200 Subject: [PATCH 02/60] bump build sdk --- eng/azure-pipelines-nightly.yml | 4 ++-- eng/build.yml | 4 ++-- global.json | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/eng/azure-pipelines-nightly.yml b/eng/azure-pipelines-nightly.yml index 3535bd2bc..3ad3c6a44 100644 --- a/eng/azure-pipelines-nightly.yml +++ b/eng/azure-pipelines-nightly.yml @@ -9,8 +9,8 @@ steps: - task: UseDotNet@2 inputs: - version: 5.0.401 - displayName: Install .NET Core SDK 5.0.401 + version: 6.0.201 + displayName: Install .NET Core SDK 6.0.201 - task: NuGetAuthenticate@0 displayName: Authenticate with NuGet feeds diff --git a/eng/build.yml b/eng/build.yml index fb3a5b9c9..fc1958632 100644 --- a/eng/build.yml +++ b/eng/build.yml @@ -6,8 +6,8 @@ steps: - task: UseDotNet@2 inputs: - version: 5.0.401 - displayName: Install .NET Core SDK 5.0.401 + version: 6.0.201 + displayName: Install .NET Core SDK 6.0.201 - script: dotnet restore displayName: Restore packages diff --git a/global.json b/global.json index c07142494..6532e5913 100644 --- a/global.json +++ b/global.json @@ -1,6 +1,6 @@ { "sdk": { - "version": "5.0.401", + "version": "6.0.201", "rollForward": "latestMajor" } } From 6b602c594e328421959d32601cdb25ae7ed5ca23 Mon Sep 17 00:00:00 2001 From: Marco Rossignoli Date: Fri, 8 Apr 2022 09:41:04 +0200 Subject: [PATCH 03/60] bump build sdk --- eng/build.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/eng/build.yml b/eng/build.yml index fc1958632..c80e71960 100644 --- a/eng/build.yml +++ b/eng/build.yml @@ -4,6 +4,11 @@ steps: version: 3.1.404 displayName: Install .NET Core SDK 3.1.404 +- task: UseDotNet@2 + inputs: + version: 5.0.406 + displayName: Install .NET Core SDK 5.0.406 + - task: UseDotNet@2 inputs: version: 6.0.201 From b727487e99900f2b5d3b7e877963dd84b7d5e097 Mon Sep 17 00:00:00 2001 From: Marco Rossignoli Date: Fri, 8 Apr 2022 09:41:28 +0200 Subject: [PATCH 04/60] bump build sdk --- eng/azure-pipelines-nightly.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/eng/azure-pipelines-nightly.yml b/eng/azure-pipelines-nightly.yml index 3ad3c6a44..3fa0dacaf 100644 --- a/eng/azure-pipelines-nightly.yml +++ b/eng/azure-pipelines-nightly.yml @@ -7,6 +7,11 @@ steps: version: 3.1.404 displayName: Install .NET Core SDK 3.1.404 +- task: UseDotNet@2 + inputs: + version: 5.0.406 + displayName: Install .NET Core SDK 5.0.406 + - task: UseDotNet@2 inputs: version: 6.0.201 From ea859afe9155911770e2c49be4357e68a32d77d0 Mon Sep 17 00:00:00 2001 From: Marco Rossignoli Date: Fri, 8 Apr 2022 09:48:16 +0200 Subject: [PATCH 05/60] bump sdk version --- Directory.Build.targets | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Directory.Build.targets b/Directory.Build.targets index f6cd1b61d..e2454dfe2 100644 --- a/Directory.Build.targets +++ b/Directory.Build.targets @@ -7,7 +7,7 @@ - + From c6b354774bbc21738983a75449464b46bd5e7883 Mon Sep 17 00:00:00 2001 From: Marco Rossignoli Date: Fri, 8 Apr 2022 09:51:31 +0200 Subject: [PATCH 06/60] bump runtime for tests --- .../coverlet.collector.tests.csproj | 4 +-- .../coverlet.core.performancetest.csproj | 2 +- .../coverlet.core.tests.csproj | 4 +-- .../coverage.cobertura.xml | 26 +++++++++++++++++++ .../coverlet.integration.template.csproj | 2 +- .../coverlet.integration.tests.csproj | 4 +-- ...s.projectsample.excludedbyattribute.csproj | 2 +- ...coverlet.tests.projectsample.fsharp.fsproj | 2 +- .../coverlet.testsubject.csproj | 2 +- 9 files changed, 37 insertions(+), 11 deletions(-) create mode 100644 test/coverlet.integration.determisticbuild/coverage.cobertura.xml diff --git a/test/coverlet.collector.tests/coverlet.collector.tests.csproj b/test/coverlet.collector.tests/coverlet.collector.tests.csproj index 822ddda6f..87826ac9d 100644 --- a/test/coverlet.collector.tests/coverlet.collector.tests.csproj +++ b/test/coverlet.collector.tests/coverlet.collector.tests.csproj @@ -1,8 +1,8 @@ - + - net5.0 + net6.0 false diff --git a/test/coverlet.core.performancetest/coverlet.core.performancetest.csproj b/test/coverlet.core.performancetest/coverlet.core.performancetest.csproj index be9cd0e08..3eecd2ea5 100644 --- a/test/coverlet.core.performancetest/coverlet.core.performancetest.csproj +++ b/test/coverlet.core.performancetest/coverlet.core.performancetest.csproj @@ -2,7 +2,7 @@ - net5.0 + net6.0 false diff --git a/test/coverlet.core.tests/coverlet.core.tests.csproj b/test/coverlet.core.tests/coverlet.core.tests.csproj index d5fdc3257..49af889d5 100644 --- a/test/coverlet.core.tests/coverlet.core.tests.csproj +++ b/test/coverlet.core.tests/coverlet.core.tests.csproj @@ -1,8 +1,8 @@ - + - net5.0 + net6.0 false $(NoWarn);CS8002 NU1702 diff --git a/test/coverlet.integration.determisticbuild/coverage.cobertura.xml b/test/coverlet.integration.determisticbuild/coverage.cobertura.xml new file mode 100644 index 000000000..3fefd1c66 --- /dev/null +++ b/test/coverlet.integration.determisticbuild/coverage.cobertura.xml @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/test/coverlet.integration.template/coverlet.integration.template.csproj b/test/coverlet.integration.template/coverlet.integration.template.csproj index 60bfec072..5f65f7fa6 100644 --- a/test/coverlet.integration.template/coverlet.integration.template.csproj +++ b/test/coverlet.integration.template/coverlet.integration.template.csproj @@ -1,7 +1,7 @@  - net5.0 + net6.0 false coverletsamplelib.integration.template false diff --git a/test/coverlet.integration.tests/coverlet.integration.tests.csproj b/test/coverlet.integration.tests/coverlet.integration.tests.csproj index b80f7c1a2..6de30285a 100644 --- a/test/coverlet.integration.tests/coverlet.integration.tests.csproj +++ b/test/coverlet.integration.tests/coverlet.integration.tests.csproj @@ -1,7 +1,7 @@ - + - net5.0 + net6.0 false enable diff --git a/test/coverlet.tests.projectsample.excludedbyattribute/coverlet.tests.projectsample.excludedbyattribute.csproj b/test/coverlet.tests.projectsample.excludedbyattribute/coverlet.tests.projectsample.excludedbyattribute.csproj index 6acabd989..4826d6f56 100644 --- a/test/coverlet.tests.projectsample.excludedbyattribute/coverlet.tests.projectsample.excludedbyattribute.csproj +++ b/test/coverlet.tests.projectsample.excludedbyattribute/coverlet.tests.projectsample.excludedbyattribute.csproj @@ -1,7 +1,7 @@ - net5.0 + net6.0 false false diff --git a/test/coverlet.tests.projectsample.fsharp/coverlet.tests.projectsample.fsharp.fsproj b/test/coverlet.tests.projectsample.fsharp/coverlet.tests.projectsample.fsharp.fsproj index 03637dad4..cd7a95969 100644 --- a/test/coverlet.tests.projectsample.fsharp/coverlet.tests.projectsample.fsharp.fsproj +++ b/test/coverlet.tests.projectsample.fsharp/coverlet.tests.projectsample.fsharp.fsproj @@ -1,7 +1,7 @@  - net5.0 + net6.0 true false false diff --git a/test/coverlet.testsubject/coverlet.testsubject.csproj b/test/coverlet.testsubject/coverlet.testsubject.csproj index 6acabd989..3020bf383 100644 --- a/test/coverlet.testsubject/coverlet.testsubject.csproj +++ b/test/coverlet.testsubject/coverlet.testsubject.csproj @@ -1,7 +1,7 @@ - net5.0 + net6.0 false false From 850eca9c3e054ea26d1c941b5d0ae73d1d80ecae Mon Sep 17 00:00:00 2001 From: Marco Rossignoli Date: Fri, 8 Apr 2022 09:52:27 +0200 Subject: [PATCH 07/60] cleanup --- .../coverage.cobertura.xml | 26 ------------------- 1 file changed, 26 deletions(-) delete mode 100644 test/coverlet.integration.determisticbuild/coverage.cobertura.xml diff --git a/test/coverlet.integration.determisticbuild/coverage.cobertura.xml b/test/coverlet.integration.determisticbuild/coverage.cobertura.xml deleted file mode 100644 index 3fefd1c66..000000000 --- a/test/coverlet.integration.determisticbuild/coverage.cobertura.xml +++ /dev/null @@ -1,26 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file From 9b4d3c0cb4bb331cbd95b3b6226dbc2629214b93 Mon Sep 17 00:00:00 2001 From: Marco Rossignoli Date: Fri, 8 Apr 2022 10:02:36 +0200 Subject: [PATCH 08/60] update yaml --- eng/azure-pipelines-nightly.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eng/azure-pipelines-nightly.yml b/eng/azure-pipelines-nightly.yml index 3fa0dacaf..3d8d7e69c 100644 --- a/eng/azure-pipelines-nightly.yml +++ b/eng/azure-pipelines-nightly.yml @@ -1,5 +1,5 @@ pool: - vmImage: 'windows-2019' + vmImage: 'windows-latest' steps: - task: UseDotNet@2 From e82ce4cf7a1ad5af399b63e85fd39f739aa3657f Mon Sep 17 00:00:00 2001 From: Marco Rossignoli Date: Fri, 8 Apr 2022 12:05:08 +0200 Subject: [PATCH 09/60] add logs --- eng/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eng/build.yml b/eng/build.yml index c80e71960..53d3d84f0 100644 --- a/eng/build.yml +++ b/eng/build.yml @@ -27,5 +27,5 @@ steps: displayName: Run tests 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.xunit.extensions]*" + 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]* --diag:log.txt" testRunTitle: $(Agent.JobName) From 44d3ee3780a1b174530cd440db69a9d6ebc0d7e3 Mon Sep 17 00:00:00 2001 From: Marco Rossignoli Date: Fri, 8 Apr 2022 12:19:20 +0200 Subject: [PATCH 10/60] add logs --- eng/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eng/build.yml b/eng/build.yml index 53d3d84f0..61bedbf97 100644 --- a/eng/build.yml +++ b/eng/build.yml @@ -27,5 +27,5 @@ steps: displayName: Run tests 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.xunit.extensions]* --diag:log.txt" + 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]*" --diag:log.txt testRunTitle: $(Agent.JobName) From 6fc6c6b2890c3c090c3c21790b2bec2a7a249ae9 Mon Sep 17 00:00:00 2001 From: Marco Rossignoli Date: Fri, 8 Apr 2022 12:21:05 +0200 Subject: [PATCH 11/60] updates --- eng/azure-pipelines.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/eng/azure-pipelines.yml b/eng/azure-pipelines.yml index 67d6bc41e..c04323a8a 100644 --- a/eng/azure-pipelines.yml +++ b/eng/azure-pipelines.yml @@ -1,3 +1,7 @@ +variables: +- name: System.Debug + value: true + trigger: branches: include: ["master", "*_validate"] From 1830d174e82f7e48b48866742c5ecff7a09b90a5 Mon Sep 17 00:00:00 2001 From: Marco Rossignoli Date: Sat, 19 Mar 2022 19:30:05 +0100 Subject: [PATCH 12/60] updates --- .../netstandard1.0/coverlet.collector.targets | 30 ++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/src/coverlet.collector/build/netstandard1.0/coverlet.collector.targets b/src/coverlet.collector/build/netstandard1.0/coverlet.collector.targets index 2e4adb4c5..98904a3b3 100644 --- a/src/coverlet.collector/build/netstandard1.0/coverlet.collector.targets +++ b/src/coverlet.collector/build/netstandard1.0/coverlet.collector.targets @@ -9,6 +9,31 @@ WARNING: DO NOT MODIFY this file unless you are knowledgeable about MSBuild and --> + + + + + + + + + + + + + + + + @@ -32,6 +57,9 @@ WARNING: DO NOT MODIFY this file unless you are knowledgeable about MSBuild and + + + - <_sourceRootMappingFilePath>$([MSBuild]::EnsureTrailingSlash('$(OutputPath)'))CoverletSourceRootsMapping + <_sourceRootMappingFilePath>$([MSBuild]::EnsureTrailingSlash('$(OutputPath)'))CoverletSourceRootsMapping_$(TestContainerAssemblyNameHash) Date: Sun, 20 Mar 2022 17:49:35 +0100 Subject: [PATCH 13/60] updates --- .../VSTest/DeterministicBuild/HowTo.md | 4 +-- .../netstandard1.0/coverlet.collector.targets | 30 +------------------ .../Helpers/SourceRootTranslator.cs | 5 ++-- .../coverlet.msbuild.targets | 2 +- .../Helpers/SourceRootTranslatorTests.cs | 6 ++-- .../DeterministicBuild.cs | 9 +++--- 6 files changed, 15 insertions(+), 41 deletions(-) diff --git a/Documentation/Examples/VSTest/DeterministicBuild/HowTo.md b/Documentation/Examples/VSTest/DeterministicBuild/HowTo.md index b1002a65c..96d94ef1b 100644 --- a/Documentation/Examples/VSTest/DeterministicBuild/HowTo.md +++ b/Documentation/Examples/VSTest/DeterministicBuild/HowTo.md @@ -59,7 +59,7 @@ Add collectors package version generated to `"..\Documentation\Examples\VSTest\D Go to test project folder and run ``` C:\git\coverlet\Documentation\Examples\VSTest\DeterministicBuild (detbuilddocs -> origin) -λ dotnet test --collect:"XPlat Code Coverage" /p:DeterministicSourcePaths=true +λ dotnet test --collect:"XPlat Code Coverage" /p:DeterministicSourcePaths=true -- DataCollectionRunSettings.DataCollectors.DataCollector.Configuration.DeterministicReport=true Test run for C:\git\coverlet\Documentation\Examples\VSTest\DeterministicBuild\XUnitTestProject1\bin\Debug\netcoreapp3.1\XUnitTestProject1.dll(.NETCoreApp,Version=v3.1) Microsoft (R) Test Execution Command Line Tool Version 16.5.0 Copyright (c) Microsoft Corporation. All rights reserved. @@ -78,5 +78,5 @@ Total tests: 1 You should see on output folder the coverlet source root mapping file generated. This is the confirmation that you're running coverage on deterministic build. ``` -Documentation\Examples\VSTest\DeterministicBuild\XUnitTestProject1\bin\Debug\netcoreapp3.1\CoverletSourceRootsMapping +Documentation\Examples\VSTest\DeterministicBuild\XUnitTestProject1\bin\Debug\netcoreapp3.1\CoverletSourceRootsMapping_XUnitTestProject1 ``` \ No newline at end of file diff --git a/src/coverlet.collector/build/netstandard1.0/coverlet.collector.targets b/src/coverlet.collector/build/netstandard1.0/coverlet.collector.targets index 98904a3b3..7bd7b28e7 100644 --- a/src/coverlet.collector/build/netstandard1.0/coverlet.collector.targets +++ b/src/coverlet.collector/build/netstandard1.0/coverlet.collector.targets @@ -9,31 +9,6 @@ WARNING: DO NOT MODIFY this file unless you are knowledgeable about MSBuild and --> - - - - - - - - - - - - - - - - @@ -57,9 +32,6 @@ using (MD5 hash = MD5.Create()) - - - - <_sourceRootMappingFilePath>$([MSBuild]::EnsureTrailingSlash('$(OutputPath)'))CoverletSourceRootsMapping_$(TestContainerAssemblyNameHash) + <_sourceRootMappingFilePath>$([MSBuild]::EnsureTrailingSlash('$(OutputPath)'))CoverletSourceRootsMapping_$(AssemblyName) > _sourceRootMapping; private readonly Dictionary> _sourceToDeterministicPathMapping; - private const string MappingFileName = "CoverletSourceRootsMapping"; + private readonly string _mappingFileName; private Dictionary _resolutionCacheFiles; public SourceRootTranslator(ILogger logger, IFileSystem fileSystem) @@ -44,6 +44,7 @@ public SourceRootTranslator(string moduleTestPath, ILogger logger, IFileSystem f { throw new FileNotFoundException($"Module test path '{moduleTestPath}' not found", moduleTestPath); } + _mappingFileName = $"CoverletSourceRootsMapping_{Path.GetFileNameWithoutExtension(moduleTestPath)}"; _sourceRootMapping = LoadSourceRootMapping(Path.GetDirectoryName(moduleTestPath)); _sourceToDeterministicPathMapping = LoadSourceToDeterministicPathMapping(_sourceRootMapping); } @@ -75,7 +76,7 @@ private Dictionary> LoadSourceRootMapping(string { var mapping = new Dictionary>(); - string mappingFilePath = Path.Combine(directory, MappingFileName); + string mappingFilePath = Path.Combine(directory, _mappingFileName); if (!_fileSystem.Exists(mappingFilePath)) { return mapping; diff --git a/src/coverlet.msbuild.tasks/coverlet.msbuild.targets b/src/coverlet.msbuild.tasks/coverlet.msbuild.targets index c271ec2d1..96fa56a6c 100644 --- a/src/coverlet.msbuild.tasks/coverlet.msbuild.targets +++ b/src/coverlet.msbuild.tasks/coverlet.msbuild.targets @@ -24,7 +24,7 @@ <_mapping Include="@(_byProject->'%(Identity)|%(OriginalPath)=%(MappedPath)')" /> - <_sourceRootMappingFilePath>$([MSBuild]::EnsureTrailingSlash('$(OutputPath)'))CoverletSourceRootsMapping + <_sourceRootMappingFilePath>$([MSBuild]::EnsureTrailingSlash('$(OutputPath)'))CoverletSourceRootsMapping_$(AssemblyName) (); fileSystem.Setup(f => f.Exists(It.IsAny())).Returns((string p) => { - if (p == "testLib.dll" || p == @"C:\git\coverlet\src\coverlet.core\obj\Debug\netstandard2.0\coverlet.core.pdb" || p == "CoverletSourceRootsMapping") return true; + if (p == "testLib.dll" || p == @"C:\git\coverlet\src\coverlet.core\obj\Debug\netstandard2.0\coverlet.core.pdb" || p == "CoverletSourceRootsMapping_testLib") return true; return false; }); fileSystem.Setup(f => f.ReadAllLines(It.IsAny())).Returns(File.ReadAllLines(@"TestAssets/CoverletSourceRootsMappingTest")); @@ -39,7 +39,7 @@ public void TranslatePathRoot_Success() var fileSystem = new Mock(); fileSystem.Setup(f => f.Exists(It.IsAny())).Returns((string p) => { - if (p == "testLib.dll" || p == @"C:\git\coverlet\src\coverlet.core\obj\Debug\netstandard2.0\coverlet.core.pdb" || p == "CoverletSourceRootsMapping") return true; + if (p == "testLib.dll" || p == @"C:\git\coverlet\src\coverlet.core\obj\Debug\netstandard2.0\coverlet.core.pdb" || p == "CoverletSourceRootsMapping_testLib") return true; return false; }); fileSystem.Setup(f => f.ReadAllLines(It.IsAny())).Returns(File.ReadAllLines(@"TestAssets/CoverletSourceRootsMappingTest")); @@ -71,7 +71,7 @@ public void Translate_MalformedFile() var fileSystem = new Mock(); fileSystem.Setup(f => f.Exists(It.IsAny())).Returns((string p) => { - if (p == "testLib.dll" || p == "CoverletSourceRootsMapping") return true; + if (p == "testLib.dll" || p == "CoverletSourceRootsMapping_testLib") return true; return false; }); fileSystem.Setup(f => f.ReadAllLines(It.IsAny())).Returns(new string[1] { "malformedRow" }); diff --git a/test/coverlet.integration.tests/DeterministicBuild.cs b/test/coverlet.integration.tests/DeterministicBuild.cs index b9f11a047..9f830771d 100644 --- a/test/coverlet.integration.tests/DeterministicBuild.cs +++ b/test/coverlet.integration.tests/DeterministicBuild.cs @@ -16,6 +16,7 @@ public class DeterministicBuild : BaseTest, IDisposable private readonly string _testProjectPath = Path.GetFullPath("../../../../coverlet.integration.determisticbuild"); private string? _testProjectTfm; private const string PropsFileName = "DeterministicTest.props"; + private const string ExpectedMappingFileName = "CoverletSourceRootsMapping_coverletsample.integration.determisticbuild"; private readonly string _buildConfiguration; public DeterministicBuild() @@ -75,7 +76,7 @@ public void Msbuild() CreateDeterministicTestPropsFile(); DotnetCli($"build -c {_buildConfiguration} /p:DeterministicSourcePaths=true", out string standardOutput, out string _, _testProjectPath); Assert.Contains("Build succeeded.", standardOutput); - string sourceRootMappingFilePath = Path.Combine(_testProjectPath, "bin", _buildConfiguration, _testProjectTfm!, "CoverletSourceRootsMapping"); + string sourceRootMappingFilePath = Path.Combine(_testProjectPath, "bin", _buildConfiguration, _testProjectTfm!, ExpectedMappingFileName); Assert.True(File.Exists(sourceRootMappingFilePath), sourceRootMappingFilePath); Assert.True(!string.IsNullOrEmpty(File.ReadAllText(sourceRootMappingFilePath)), "Empty CoverletSourceRootsMapping file"); Assert.Contains("=/_/", File.ReadAllText(sourceRootMappingFilePath)); @@ -98,7 +99,7 @@ public void Msbuild_SourceLink() CreateDeterministicTestPropsFile(); DotnetCli($"build -c {_buildConfiguration} /p:DeterministicSourcePaths=true", out string standardOutput, out string _, _testProjectPath); Assert.Contains("Build succeeded.", standardOutput); - string sourceRootMappingFilePath = Path.Combine(_testProjectPath, "bin", _buildConfiguration, _testProjectTfm!, "CoverletSourceRootsMapping"); + string sourceRootMappingFilePath = Path.Combine(_testProjectPath, "bin", _buildConfiguration, _testProjectTfm!, ExpectedMappingFileName); Assert.True(File.Exists(sourceRootMappingFilePath), sourceRootMappingFilePath); Assert.True(!string.IsNullOrEmpty(File.ReadAllText(sourceRootMappingFilePath)), "Empty CoverletSourceRootsMapping file"); Assert.Contains("=/_/", File.ReadAllText(sourceRootMappingFilePath)); @@ -122,7 +123,7 @@ public void Collectors() CreateDeterministicTestPropsFile(); DotnetCli($"build -c {_buildConfiguration} /p:DeterministicSourcePaths=true", out string standardOutput, out string _, _testProjectPath); Assert.Contains("Build succeeded.", standardOutput); - string sourceRootMappingFilePath = Path.Combine(_testProjectPath, "bin", GetAssemblyBuildConfiguration().ToString(), _testProjectTfm!, "CoverletSourceRootsMapping"); + string sourceRootMappingFilePath = Path.Combine(_testProjectPath, "bin", GetAssemblyBuildConfiguration().ToString(), _testProjectTfm!, ExpectedMappingFileName); Assert.True(File.Exists(sourceRootMappingFilePath), sourceRootMappingFilePath); Assert.NotEmpty(File.ReadAllText(sourceRootMappingFilePath)); Assert.Contains("=/_/", File.ReadAllText(sourceRootMappingFilePath)); @@ -150,7 +151,7 @@ public void Collectors_SourceLink() CreateDeterministicTestPropsFile(); DotnetCli($"build -c {_buildConfiguration} /p:DeterministicSourcePaths=true", out string standardOutput, out string _, _testProjectPath); Assert.Contains("Build succeeded.", standardOutput); - string sourceRootMappingFilePath = Path.Combine(_testProjectPath, "bin", GetAssemblyBuildConfiguration().ToString(), _testProjectTfm!, "CoverletSourceRootsMapping"); + string sourceRootMappingFilePath = Path.Combine(_testProjectPath, "bin", GetAssemblyBuildConfiguration().ToString(), _testProjectTfm!, ExpectedMappingFileName); Assert.True(File.Exists(sourceRootMappingFilePath), sourceRootMappingFilePath); Assert.NotEmpty(File.ReadAllText(sourceRootMappingFilePath)); Assert.Contains("=/_/", File.ReadAllText(sourceRootMappingFilePath)); From e53eddbdc0539d8549149c42676920b66b6f68f8 Mon Sep 17 00:00:00 2001 From: Marco Rossignoli Date: Fri, 8 Apr 2022 09:38:11 +0200 Subject: [PATCH 14/60] bump build sdk --- eng/azure-pipelines-nightly.yml | 4 ++-- eng/build.yml | 4 ++-- global.json | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/eng/azure-pipelines-nightly.yml b/eng/azure-pipelines-nightly.yml index 3535bd2bc..3ad3c6a44 100644 --- a/eng/azure-pipelines-nightly.yml +++ b/eng/azure-pipelines-nightly.yml @@ -9,8 +9,8 @@ steps: - task: UseDotNet@2 inputs: - version: 5.0.401 - displayName: Install .NET Core SDK 5.0.401 + version: 6.0.201 + displayName: Install .NET Core SDK 6.0.201 - task: NuGetAuthenticate@0 displayName: Authenticate with NuGet feeds diff --git a/eng/build.yml b/eng/build.yml index fb3a5b9c9..fc1958632 100644 --- a/eng/build.yml +++ b/eng/build.yml @@ -6,8 +6,8 @@ steps: - task: UseDotNet@2 inputs: - version: 5.0.401 - displayName: Install .NET Core SDK 5.0.401 + version: 6.0.201 + displayName: Install .NET Core SDK 6.0.201 - script: dotnet restore displayName: Restore packages diff --git a/global.json b/global.json index c07142494..6532e5913 100644 --- a/global.json +++ b/global.json @@ -1,6 +1,6 @@ { "sdk": { - "version": "5.0.401", + "version": "6.0.201", "rollForward": "latestMajor" } } From 7331331ba20cb7132493c660de6d93737b86085f Mon Sep 17 00:00:00 2001 From: Marco Rossignoli Date: Fri, 8 Apr 2022 09:41:04 +0200 Subject: [PATCH 15/60] bump build sdk --- eng/build.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/eng/build.yml b/eng/build.yml index fc1958632..c80e71960 100644 --- a/eng/build.yml +++ b/eng/build.yml @@ -4,6 +4,11 @@ steps: version: 3.1.404 displayName: Install .NET Core SDK 3.1.404 +- task: UseDotNet@2 + inputs: + version: 5.0.406 + displayName: Install .NET Core SDK 5.0.406 + - task: UseDotNet@2 inputs: version: 6.0.201 From 4c0ca754a0c6b72b7797b156d04ab4c526d7fea4 Mon Sep 17 00:00:00 2001 From: Marco Rossignoli Date: Fri, 8 Apr 2022 09:41:28 +0200 Subject: [PATCH 16/60] bump build sdk --- eng/azure-pipelines-nightly.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/eng/azure-pipelines-nightly.yml b/eng/azure-pipelines-nightly.yml index 3ad3c6a44..3fa0dacaf 100644 --- a/eng/azure-pipelines-nightly.yml +++ b/eng/azure-pipelines-nightly.yml @@ -7,6 +7,11 @@ steps: version: 3.1.404 displayName: Install .NET Core SDK 3.1.404 +- task: UseDotNet@2 + inputs: + version: 5.0.406 + displayName: Install .NET Core SDK 5.0.406 + - task: UseDotNet@2 inputs: version: 6.0.201 From 6f35cae1c934ea6c934536a4bbe7c1e61df33722 Mon Sep 17 00:00:00 2001 From: Marco Rossignoli Date: Fri, 8 Apr 2022 09:48:16 +0200 Subject: [PATCH 17/60] bump sdk version --- Directory.Build.targets | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Directory.Build.targets b/Directory.Build.targets index f6cd1b61d..e2454dfe2 100644 --- a/Directory.Build.targets +++ b/Directory.Build.targets @@ -7,7 +7,7 @@ - + From 387c0e74241a076e34d322502f493a8bd06c22af Mon Sep 17 00:00:00 2001 From: Marco Rossignoli Date: Fri, 8 Apr 2022 09:51:31 +0200 Subject: [PATCH 18/60] bump runtime for tests --- .../coverlet.collector.tests.csproj | 4 +-- .../coverlet.core.performancetest.csproj | 2 +- .../coverlet.core.tests.csproj | 4 +-- .../coverage.cobertura.xml | 26 +++++++++++++++++++ .../coverlet.integration.template.csproj | 2 +- .../coverlet.integration.tests.csproj | 4 +-- ...s.projectsample.excludedbyattribute.csproj | 2 +- ...coverlet.tests.projectsample.fsharp.fsproj | 2 +- .../coverlet.testsubject.csproj | 2 +- 9 files changed, 37 insertions(+), 11 deletions(-) create mode 100644 test/coverlet.integration.determisticbuild/coverage.cobertura.xml diff --git a/test/coverlet.collector.tests/coverlet.collector.tests.csproj b/test/coverlet.collector.tests/coverlet.collector.tests.csproj index 822ddda6f..87826ac9d 100644 --- a/test/coverlet.collector.tests/coverlet.collector.tests.csproj +++ b/test/coverlet.collector.tests/coverlet.collector.tests.csproj @@ -1,8 +1,8 @@ - + - net5.0 + net6.0 false diff --git a/test/coverlet.core.performancetest/coverlet.core.performancetest.csproj b/test/coverlet.core.performancetest/coverlet.core.performancetest.csproj index be9cd0e08..3eecd2ea5 100644 --- a/test/coverlet.core.performancetest/coverlet.core.performancetest.csproj +++ b/test/coverlet.core.performancetest/coverlet.core.performancetest.csproj @@ -2,7 +2,7 @@ - net5.0 + net6.0 false diff --git a/test/coverlet.core.tests/coverlet.core.tests.csproj b/test/coverlet.core.tests/coverlet.core.tests.csproj index d5fdc3257..49af889d5 100644 --- a/test/coverlet.core.tests/coverlet.core.tests.csproj +++ b/test/coverlet.core.tests/coverlet.core.tests.csproj @@ -1,8 +1,8 @@ - + - net5.0 + net6.0 false $(NoWarn);CS8002 NU1702 diff --git a/test/coverlet.integration.determisticbuild/coverage.cobertura.xml b/test/coverlet.integration.determisticbuild/coverage.cobertura.xml new file mode 100644 index 000000000..3fefd1c66 --- /dev/null +++ b/test/coverlet.integration.determisticbuild/coverage.cobertura.xml @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/test/coverlet.integration.template/coverlet.integration.template.csproj b/test/coverlet.integration.template/coverlet.integration.template.csproj index 60bfec072..5f65f7fa6 100644 --- a/test/coverlet.integration.template/coverlet.integration.template.csproj +++ b/test/coverlet.integration.template/coverlet.integration.template.csproj @@ -1,7 +1,7 @@  - net5.0 + net6.0 false coverletsamplelib.integration.template false diff --git a/test/coverlet.integration.tests/coverlet.integration.tests.csproj b/test/coverlet.integration.tests/coverlet.integration.tests.csproj index b80f7c1a2..6de30285a 100644 --- a/test/coverlet.integration.tests/coverlet.integration.tests.csproj +++ b/test/coverlet.integration.tests/coverlet.integration.tests.csproj @@ -1,7 +1,7 @@ - + - net5.0 + net6.0 false enable diff --git a/test/coverlet.tests.projectsample.excludedbyattribute/coverlet.tests.projectsample.excludedbyattribute.csproj b/test/coverlet.tests.projectsample.excludedbyattribute/coverlet.tests.projectsample.excludedbyattribute.csproj index 6acabd989..4826d6f56 100644 --- a/test/coverlet.tests.projectsample.excludedbyattribute/coverlet.tests.projectsample.excludedbyattribute.csproj +++ b/test/coverlet.tests.projectsample.excludedbyattribute/coverlet.tests.projectsample.excludedbyattribute.csproj @@ -1,7 +1,7 @@ - net5.0 + net6.0 false false diff --git a/test/coverlet.tests.projectsample.fsharp/coverlet.tests.projectsample.fsharp.fsproj b/test/coverlet.tests.projectsample.fsharp/coverlet.tests.projectsample.fsharp.fsproj index 03637dad4..cd7a95969 100644 --- a/test/coverlet.tests.projectsample.fsharp/coverlet.tests.projectsample.fsharp.fsproj +++ b/test/coverlet.tests.projectsample.fsharp/coverlet.tests.projectsample.fsharp.fsproj @@ -1,7 +1,7 @@  - net5.0 + net6.0 true false false diff --git a/test/coverlet.testsubject/coverlet.testsubject.csproj b/test/coverlet.testsubject/coverlet.testsubject.csproj index 6acabd989..3020bf383 100644 --- a/test/coverlet.testsubject/coverlet.testsubject.csproj +++ b/test/coverlet.testsubject/coverlet.testsubject.csproj @@ -1,7 +1,7 @@ - net5.0 + net6.0 false false From 4e30b35108964a986b2e5fa72cb21c526a788869 Mon Sep 17 00:00:00 2001 From: Marco Rossignoli Date: Fri, 8 Apr 2022 09:52:27 +0200 Subject: [PATCH 19/60] cleanup --- .../coverage.cobertura.xml | 26 ------------------- 1 file changed, 26 deletions(-) delete mode 100644 test/coverlet.integration.determisticbuild/coverage.cobertura.xml diff --git a/test/coverlet.integration.determisticbuild/coverage.cobertura.xml b/test/coverlet.integration.determisticbuild/coverage.cobertura.xml deleted file mode 100644 index 3fefd1c66..000000000 --- a/test/coverlet.integration.determisticbuild/coverage.cobertura.xml +++ /dev/null @@ -1,26 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file From f76d917651c67405152fb681a02095a3116dc466 Mon Sep 17 00:00:00 2001 From: Marco Rossignoli Date: Fri, 8 Apr 2022 10:02:36 +0200 Subject: [PATCH 20/60] update yaml --- eng/azure-pipelines-nightly.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eng/azure-pipelines-nightly.yml b/eng/azure-pipelines-nightly.yml index 3fa0dacaf..3d8d7e69c 100644 --- a/eng/azure-pipelines-nightly.yml +++ b/eng/azure-pipelines-nightly.yml @@ -1,5 +1,5 @@ pool: - vmImage: 'windows-2019' + vmImage: 'windows-latest' steps: - task: UseDotNet@2 From 10079a9fef10686d2c0b12644f1b439e8d7c31fd Mon Sep 17 00:00:00 2001 From: Marco Rossignoli Date: Fri, 8 Apr 2022 12:05:08 +0200 Subject: [PATCH 21/60] add logs --- eng/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eng/build.yml b/eng/build.yml index c80e71960..53d3d84f0 100644 --- a/eng/build.yml +++ b/eng/build.yml @@ -27,5 +27,5 @@ steps: displayName: Run tests 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.xunit.extensions]*" + 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]* --diag:log.txt" testRunTitle: $(Agent.JobName) From d4a6dd051563835d69b7272ae35bfa068fd50905 Mon Sep 17 00:00:00 2001 From: Marco Rossignoli Date: Fri, 8 Apr 2022 12:19:20 +0200 Subject: [PATCH 22/60] add logs --- eng/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eng/build.yml b/eng/build.yml index 53d3d84f0..61bedbf97 100644 --- a/eng/build.yml +++ b/eng/build.yml @@ -27,5 +27,5 @@ steps: displayName: Run tests 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.xunit.extensions]* --diag:log.txt" + 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]*" --diag:log.txt testRunTitle: $(Agent.JobName) From 9490547c0042e1148e17b0c7bb73d50655109fa7 Mon Sep 17 00:00:00 2001 From: Marco Rossignoli Date: Fri, 8 Apr 2022 12:21:05 +0200 Subject: [PATCH 23/60] updates --- eng/azure-pipelines.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/eng/azure-pipelines.yml b/eng/azure-pipelines.yml index 67d6bc41e..c04323a8a 100644 --- a/eng/azure-pipelines.yml +++ b/eng/azure-pipelines.yml @@ -1,3 +1,7 @@ +variables: +- name: System.Debug + value: true + trigger: branches: include: ["master", "*_validate"] From 573407bfebd10257192ca16040c1ac3896fda08c Mon Sep 17 00:00:00 2001 From: Marco Rossignoli Date: Sat, 21 May 2022 11:39:09 +0200 Subject: [PATCH 24/60] updates --- Directory.Build.targets | 2 +- eng/azure-pipelines-nightly.yml | 11 +++-------- eng/build.yml | 11 +++-------- global.json | 2 +- .../coverlet.collector.tests.csproj | 4 ++-- .../coverlet.core.performancetest.csproj | 2 +- test/coverlet.core.tests/coverlet.core.tests.csproj | 4 ++-- .../coverlet.integration.template.csproj | 2 +- .../coverlet.integration.tests.csproj | 4 ++-- ...let.tests.projectsample.excludedbyattribute.csproj | 2 +- .../coverlet.tests.projectsample.fsharp.fsproj | 2 +- test/coverlet.testsubject/coverlet.testsubject.csproj | 2 +- 12 files changed, 19 insertions(+), 29 deletions(-) diff --git a/Directory.Build.targets b/Directory.Build.targets index e2454dfe2..f6cd1b61d 100644 --- a/Directory.Build.targets +++ b/Directory.Build.targets @@ -7,7 +7,7 @@ - + diff --git a/eng/azure-pipelines-nightly.yml b/eng/azure-pipelines-nightly.yml index 3d8d7e69c..3535bd2bc 100644 --- a/eng/azure-pipelines-nightly.yml +++ b/eng/azure-pipelines-nightly.yml @@ -1,5 +1,5 @@ pool: - vmImage: 'windows-latest' + vmImage: 'windows-2019' steps: - task: UseDotNet@2 @@ -9,13 +9,8 @@ steps: - task: UseDotNet@2 inputs: - version: 5.0.406 - displayName: Install .NET Core SDK 5.0.406 - -- task: UseDotNet@2 - inputs: - version: 6.0.201 - displayName: Install .NET Core SDK 6.0.201 + version: 5.0.401 + displayName: Install .NET Core SDK 5.0.401 - task: NuGetAuthenticate@0 displayName: Authenticate with NuGet feeds diff --git a/eng/build.yml b/eng/build.yml index 61bedbf97..fb3a5b9c9 100644 --- a/eng/build.yml +++ b/eng/build.yml @@ -6,13 +6,8 @@ steps: - task: UseDotNet@2 inputs: - version: 5.0.406 - displayName: Install .NET Core SDK 5.0.406 - -- task: UseDotNet@2 - inputs: - version: 6.0.201 - displayName: Install .NET Core SDK 6.0.201 + version: 5.0.401 + displayName: Install .NET Core SDK 5.0.401 - script: dotnet restore displayName: Restore packages @@ -27,5 +22,5 @@ steps: displayName: Run tests 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.xunit.extensions]*" --diag:log.txt + 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) diff --git a/global.json b/global.json index 6532e5913..c07142494 100644 --- a/global.json +++ b/global.json @@ -1,6 +1,6 @@ { "sdk": { - "version": "6.0.201", + "version": "5.0.401", "rollForward": "latestMajor" } } diff --git a/test/coverlet.collector.tests/coverlet.collector.tests.csproj b/test/coverlet.collector.tests/coverlet.collector.tests.csproj index 87826ac9d..822ddda6f 100644 --- a/test/coverlet.collector.tests/coverlet.collector.tests.csproj +++ b/test/coverlet.collector.tests/coverlet.collector.tests.csproj @@ -1,8 +1,8 @@ - + - net6.0 + net5.0 false diff --git a/test/coverlet.core.performancetest/coverlet.core.performancetest.csproj b/test/coverlet.core.performancetest/coverlet.core.performancetest.csproj index 3eecd2ea5..be9cd0e08 100644 --- a/test/coverlet.core.performancetest/coverlet.core.performancetest.csproj +++ b/test/coverlet.core.performancetest/coverlet.core.performancetest.csproj @@ -2,7 +2,7 @@ - net6.0 + net5.0 false diff --git a/test/coverlet.core.tests/coverlet.core.tests.csproj b/test/coverlet.core.tests/coverlet.core.tests.csproj index 49af889d5..d5fdc3257 100644 --- a/test/coverlet.core.tests/coverlet.core.tests.csproj +++ b/test/coverlet.core.tests/coverlet.core.tests.csproj @@ -1,8 +1,8 @@ - + - net6.0 + net5.0 false $(NoWarn);CS8002 NU1702 diff --git a/test/coverlet.integration.template/coverlet.integration.template.csproj b/test/coverlet.integration.template/coverlet.integration.template.csproj index 5f65f7fa6..60bfec072 100644 --- a/test/coverlet.integration.template/coverlet.integration.template.csproj +++ b/test/coverlet.integration.template/coverlet.integration.template.csproj @@ -1,7 +1,7 @@  - net6.0 + net5.0 false coverletsamplelib.integration.template false diff --git a/test/coverlet.integration.tests/coverlet.integration.tests.csproj b/test/coverlet.integration.tests/coverlet.integration.tests.csproj index 6de30285a..b80f7c1a2 100644 --- a/test/coverlet.integration.tests/coverlet.integration.tests.csproj +++ b/test/coverlet.integration.tests/coverlet.integration.tests.csproj @@ -1,7 +1,7 @@ - + - net6.0 + net5.0 false enable diff --git a/test/coverlet.tests.projectsample.excludedbyattribute/coverlet.tests.projectsample.excludedbyattribute.csproj b/test/coverlet.tests.projectsample.excludedbyattribute/coverlet.tests.projectsample.excludedbyattribute.csproj index 4826d6f56..6acabd989 100644 --- a/test/coverlet.tests.projectsample.excludedbyattribute/coverlet.tests.projectsample.excludedbyattribute.csproj +++ b/test/coverlet.tests.projectsample.excludedbyattribute/coverlet.tests.projectsample.excludedbyattribute.csproj @@ -1,7 +1,7 @@ - net6.0 + net5.0 false false diff --git a/test/coverlet.tests.projectsample.fsharp/coverlet.tests.projectsample.fsharp.fsproj b/test/coverlet.tests.projectsample.fsharp/coverlet.tests.projectsample.fsharp.fsproj index cd7a95969..03637dad4 100644 --- a/test/coverlet.tests.projectsample.fsharp/coverlet.tests.projectsample.fsharp.fsproj +++ b/test/coverlet.tests.projectsample.fsharp/coverlet.tests.projectsample.fsharp.fsproj @@ -1,7 +1,7 @@  - net6.0 + net5.0 true false false diff --git a/test/coverlet.testsubject/coverlet.testsubject.csproj b/test/coverlet.testsubject/coverlet.testsubject.csproj index 3020bf383..6acabd989 100644 --- a/test/coverlet.testsubject/coverlet.testsubject.csproj +++ b/test/coverlet.testsubject/coverlet.testsubject.csproj @@ -1,7 +1,7 @@ - net6.0 + net5.0 false false From c363b0a751812423b1d1dc8187346892e0b4090d Mon Sep 17 00:00:00 2001 From: Marco Rossignoli Date: Sat, 21 May 2022 11:58:15 +0200 Subject: [PATCH 25/60] add blame --- eng/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eng/build.yml b/eng/build.yml index fb3a5b9c9..148afe1be 100644 --- a/eng/build.yml +++ b/eng/build.yml @@ -22,5 +22,5 @@ steps: displayName: Run tests 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.xunit.extensions]*" + 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]*" --blame-crash testRunTitle: $(Agent.JobName) From fa0dc2a9f803740e47630e89fef6600921e9ff66 Mon Sep 17 00:00:00 2001 From: Marco Rossignoli Date: Sat, 21 May 2022 12:14:01 +0200 Subject: [PATCH 26/60] updates --- eng/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eng/build.yml b/eng/build.yml index 148afe1be..5ac6f6e70 100644 --- a/eng/build.yml +++ b/eng/build.yml @@ -22,5 +22,5 @@ steps: displayName: Run tests 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.xunit.extensions]*" --blame-crash + 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]*" --filter DisplayName~CatchBlock_Issue465 --blame-crash testRunTitle: $(Agent.JobName) From cea8475534fef2d640b90fb0029b31d6d0334fca Mon Sep 17 00:00:00 2001 From: Marco Rossignoli Date: Sat, 21 May 2022 12:19:33 +0200 Subject: [PATCH 27/60] updates --- eng/azure-pipelines.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eng/azure-pipelines.yml b/eng/azure-pipelines.yml index c04323a8a..3194fc39f 100644 --- a/eng/azure-pipelines.yml +++ b/eng/azure-pipelines.yml @@ -1,6 +1,6 @@ variables: - name: System.Debug - value: true + value: false trigger: branches: From 9d81df08889cf352af382def710d3b52b17cb975 Mon Sep 17 00:00:00 2001 From: Marco Rossignoli Date: Sat, 21 May 2022 12:27:11 +0200 Subject: [PATCH 28/60] updates --- eng/build.yml | 8 ++++++++ global.json | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/eng/build.yml b/eng/build.yml index 5ac6f6e70..8c7145f46 100644 --- a/eng/build.yml +++ b/eng/build.yml @@ -9,6 +9,14 @@ steps: version: 5.0.401 displayName: Install .NET Core SDK 5.0.401 +- task: UseDotNet@2 + inputs: + version: 6.0.300 + displayName: Install .NET Core SDK 6.0.300 + +- script: dotnet --info + displayName: dotnet --info + - script: dotnet restore displayName: Restore packages diff --git a/global.json b/global.json index c07142494..0f050ba53 100644 --- a/global.json +++ b/global.json @@ -1,6 +1,6 @@ { "sdk": { - "version": "5.0.401", + "version": "6.0.300", "rollForward": "latestMajor" } } From 7f49cd8ffda0796ecbd6ecba0f0ce32c88fb37d9 Mon Sep 17 00:00:00 2001 From: Marco Rossignoli Date: Sat, 21 May 2022 12:35:45 +0200 Subject: [PATCH 29/60] updates --- test/coverlet.core.tests/Coverage/InstrumenterHelper.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/test/coverlet.core.tests/Coverage/InstrumenterHelper.cs b/test/coverlet.core.tests/Coverage/InstrumenterHelper.cs index 8cb5eca7f..f451e5106 100644 --- a/test/coverlet.core.tests/Coverage/InstrumenterHelper.cs +++ b/test/coverlet.core.tests/Coverage/InstrumenterHelper.cs @@ -124,6 +124,8 @@ public static async Task Run(Func callM s_processWideContainer.GetService(), s_processWideContainer.GetService(), s_processWideContainer.GetService(), s_processWideContainer.GetService()); CoveragePrepareResult prepareResult = coverage.PrepareModules(); + Assert.True(false, File.ReadAllText(logFile)); + Assert.Single(prepareResult.Results); // Load new assembly From 339fcf1598c6976e987b318c82b418dbef19b672 Mon Sep 17 00:00:00 2001 From: Marco Rossignoli Date: Sat, 21 May 2022 12:43:28 +0200 Subject: [PATCH 30/60] updates --- test/coverlet.core.tests/Coverage/InstrumenterHelper.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/test/coverlet.core.tests/Coverage/InstrumenterHelper.cs b/test/coverlet.core.tests/Coverage/InstrumenterHelper.cs index f451e5106..4af010536 100644 --- a/test/coverlet.core.tests/Coverage/InstrumenterHelper.cs +++ b/test/coverlet.core.tests/Coverage/InstrumenterHelper.cs @@ -124,6 +124,7 @@ public static async Task Run(Func callM s_processWideContainer.GetService(), s_processWideContainer.GetService(), s_processWideContainer.GetService(), s_processWideContainer.GetService()); CoveragePrepareResult prepareResult = coverage.PrepareModules(); + File.AppendAllText(logFile, "\nTest file:" + newPath); Assert.True(false, File.ReadAllText(logFile)); Assert.Single(prepareResult.Results); From afe95df0710d6713a009925de3649c98c36091b2 Mon Sep 17 00:00:00 2001 From: Marco Rossignoli Date: Sat, 21 May 2022 12:52:13 +0200 Subject: [PATCH 31/60] updates --- test/coverlet.core.tests/Coverage/InstrumenterHelper.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/test/coverlet.core.tests/Coverage/InstrumenterHelper.cs b/test/coverlet.core.tests/Coverage/InstrumenterHelper.cs index 4af010536..7a3a8c999 100644 --- a/test/coverlet.core.tests/Coverage/InstrumenterHelper.cs +++ b/test/coverlet.core.tests/Coverage/InstrumenterHelper.cs @@ -125,6 +125,7 @@ public static async Task Run(Func callM CoveragePrepareResult prepareResult = coverage.PrepareModules(); File.AppendAllText(logFile, "\nTest file:" + newPath); + File.AppendAllText(logFile, "\nExists:" + File.Exists(newPath)); Assert.True(false, File.ReadAllText(logFile)); Assert.Single(prepareResult.Results); From 05f6e5d81306c5690eadb322dd784ee553e4bddc Mon Sep 17 00:00:00 2001 From: Marco Rossignoli Date: Sat, 21 May 2022 12:58:17 +0200 Subject: [PATCH 32/60] updates --- src/coverlet.core/Coverage.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/coverlet.core/Coverage.cs b/src/coverlet.core/Coverage.cs index 25a415b5b..71a70b82f 100644 --- a/src/coverlet.core/Coverage.cs +++ b/src/coverlet.core/Coverage.cs @@ -125,6 +125,7 @@ public CoveragePrepareResult PrepareModules() if (instrumenter.CanInstrument()) { + _logger.LogVerbose($"Included module: '{module}'"); _instrumentationHelper.BackupOriginalModule(module, Identifier); // Guard code path and restore if instrumentation fails. From 2fa79a95107159d859b3585649f33a060eb2cde2 Mon Sep 17 00:00:00 2001 From: Marco Rossignoli Date: Sat, 21 May 2022 13:05:59 +0200 Subject: [PATCH 33/60] updates --- src/coverlet.core/Coverage.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/coverlet.core/Coverage.cs b/src/coverlet.core/Coverage.cs index 71a70b82f..3882c7cb1 100644 --- a/src/coverlet.core/Coverage.cs +++ b/src/coverlet.core/Coverage.cs @@ -114,6 +114,8 @@ public CoveragePrepareResult PrepareModules() continue; } + _logger.LogVerbose($"Included module: '{module}'"); + var instrumenter = new Instrumenter(module, Identifier, _parameters, @@ -125,7 +127,7 @@ public CoveragePrepareResult PrepareModules() if (instrumenter.CanInstrument()) { - _logger.LogVerbose($"Included module: '{module}'"); + _logger.LogVerbose($"Instrumentable module: '{module}'"); _instrumentationHelper.BackupOriginalModule(module, Identifier); // Guard code path and restore if instrumentation fails. From fda7a76c481ec9ff391217a894dde479ff57b574 Mon Sep 17 00:00:00 2001 From: Marco Rossignoli Date: Sat, 21 May 2022 15:07:53 +0200 Subject: [PATCH 34/60] updates --- eng/azure-pipelines.yml | 30 +----------------------------- 1 file changed, 1 insertion(+), 29 deletions(-) diff --git a/eng/azure-pipelines.yml b/eng/azure-pipelines.yml index 3194fc39f..d4eb35965 100644 --- a/eng/azure-pipelines.yml +++ b/eng/azure-pipelines.yml @@ -37,32 +37,4 @@ jobs: PathtoPublish: $(Build.ArtifactStagingDirectory)\Packages ArtifactName: Packages publishLocation: Container - condition: eq(variables['BuildConfiguration'], 'Release') - -- job: macOS - displayName: macOS - continueOnError: 'true' - strategy: - matrix: - Debug: - buildConfiguration: "Debug" - Release: - buildConfiguration: "Release" - pool: - vmImage: 'macOS-latest' - steps: - - template: build.yml - -- job: Linux - displayName: Linux - continueOnError: 'true' - strategy: - matrix: - Debug: - buildConfiguration: "Debug" - Release: - buildConfiguration: "Release" - pool: - vmImage: 'ubuntu-latest' - steps: - - template: build.yml + condition: eq(variables['BuildConfiguration'], 'Release') \ No newline at end of file From a8459e5755500cb3347b594d51a0651f036b3c63 Mon Sep 17 00:00:00 2001 From: Marco Rossignoli Date: Sat, 21 May 2022 15:19:15 +0200 Subject: [PATCH 35/60] updates --- eng/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eng/build.yml b/eng/build.yml index 8c7145f46..10e0e8e7a 100644 --- a/eng/build.yml +++ b/eng/build.yml @@ -30,5 +30,5 @@ steps: displayName: Run tests 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.xunit.extensions]*" --filter DisplayName~CatchBlock_Issue465 --blame-crash + 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]*" --filter DisplayName~CatchBlock_Issue465 --blame-crash --blame-hang --blame-hang-timeout 15m testRunTitle: $(Agent.JobName) From ca7f584f4b554ddf49a7a1bc7bab2945c9cb4565 Mon Sep 17 00:00:00 2001 From: Marco Rossignoli Date: Sat, 21 May 2022 16:55:43 +0200 Subject: [PATCH 36/60] updates --- eng/azure-pipelines.yml | 19 ++++++++++++++++--- eng/build.yml | 2 +- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/eng/azure-pipelines.yml b/eng/azure-pipelines.yml index d4eb35965..52479156c 100644 --- a/eng/azure-pipelines.yml +++ b/eng/azure-pipelines.yml @@ -1,6 +1,4 @@ variables: -- name: System.Debug - value: false trigger: branches: @@ -37,4 +35,19 @@ jobs: PathtoPublish: $(Build.ArtifactStagingDirectory)\Packages ArtifactName: Packages publishLocation: Container - condition: eq(variables['BuildConfiguration'], 'Release') \ No newline at end of file + condition: eq(variables['BuildConfiguration'], 'Release') + + - task: CopyFiles@2 + displayName: Collect dump + inputs: + SourceFolder: $(Agent.TempDirectory)\*\ + Contents: | + *.dmp + TargetFolder: $(Build.ArtifactStagingDirectory)\Dumps + + - task: PublishBuildArtifacts@1 + displayName: Publish dumps + inputs: + PathtoPublish: $(Build.ArtifactStagingDirectory)\Dumps + ArtifactName: Dumps + publishLocation: Container \ No newline at end of file diff --git a/eng/build.yml b/eng/build.yml index 10e0e8e7a..f74366cb7 100644 --- a/eng/build.yml +++ b/eng/build.yml @@ -30,5 +30,5 @@ steps: displayName: Run tests 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.xunit.extensions]*" --filter DisplayName~CatchBlock_Issue465 --blame-crash --blame-hang --blame-hang-timeout 15m + 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]*" --filter DisplayName~CatchBlock_Issue465 --blame-crash --blame-hang --blame-hang-timeout 1m testRunTitle: $(Agent.JobName) From 5fa57be58bdb51b13ca1515647c69327a2445920 Mon Sep 17 00:00:00 2001 From: Marco Rossignoli Date: Sat, 21 May 2022 16:58:50 +0200 Subject: [PATCH 37/60] updates --- eng/azure-pipelines.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/eng/azure-pipelines.yml b/eng/azure-pipelines.yml index 52479156c..e35bb3ae6 100644 --- a/eng/azure-pipelines.yml +++ b/eng/azure-pipelines.yml @@ -1,5 +1,3 @@ -variables: - trigger: branches: include: ["master", "*_validate"] From cf6472287a4616c15445b5d047b3f032200c844e Mon Sep 17 00:00:00 2001 From: Marco Rossignoli Date: Sat, 21 May 2022 17:00:15 +0200 Subject: [PATCH 38/60] updates --- eng/azure-pipelines.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/eng/azure-pipelines.yml b/eng/azure-pipelines.yml index e35bb3ae6..c93421c52 100644 --- a/eng/azure-pipelines.yml +++ b/eng/azure-pipelines.yml @@ -34,7 +34,6 @@ jobs: ArtifactName: Packages publishLocation: Container condition: eq(variables['BuildConfiguration'], 'Release') - - task: CopyFiles@2 displayName: Collect dump inputs: @@ -42,7 +41,6 @@ jobs: Contents: | *.dmp TargetFolder: $(Build.ArtifactStagingDirectory)\Dumps - - task: PublishBuildArtifacts@1 displayName: Publish dumps inputs: From 8a5f51a8e9aa7a00963d714bfee3ecaddb90bfa4 Mon Sep 17 00:00:00 2001 From: Marco Rossignoli Date: Sat, 21 May 2022 17:11:46 +0200 Subject: [PATCH 39/60] updates --- eng/build.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/eng/build.yml b/eng/build.yml index f74366cb7..59c7c4476 100644 --- a/eng/build.yml +++ b/eng/build.yml @@ -32,3 +32,4 @@ steps: 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.xunit.extensions]*" --filter DisplayName~CatchBlock_Issue465 --blame-crash --blame-hang --blame-hang-timeout 1m testRunTitle: $(Agent.JobName) + continueOnError: true From e2b21caf7b85474aaae2a3cdbcefa178e2e38514 Mon Sep 17 00:00:00 2001 From: Marco Rossignoli Date: Sat, 21 May 2022 17:18:57 +0200 Subject: [PATCH 40/60] updates --- eng/azure-pipelines.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/eng/azure-pipelines.yml b/eng/azure-pipelines.yml index c93421c52..d091c795b 100644 --- a/eng/azure-pipelines.yml +++ b/eng/azure-pipelines.yml @@ -41,9 +41,11 @@ jobs: Contents: | *.dmp TargetFolder: $(Build.ArtifactStagingDirectory)\Dumps + condition: always() - task: PublishBuildArtifacts@1 displayName: Publish dumps inputs: PathtoPublish: $(Build.ArtifactStagingDirectory)\Dumps ArtifactName: Dumps - publishLocation: Container \ No newline at end of file + publishLocation: Container + condition: always() \ No newline at end of file From 62a8917cee07e30d8609e60797e806769b5c5772 Mon Sep 17 00:00:00 2001 From: Marco Rossignoli Date: Sat, 21 May 2022 17:25:21 +0200 Subject: [PATCH 41/60] updates --- eng/azure-pipelines.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/eng/azure-pipelines.yml b/eng/azure-pipelines.yml index d091c795b..910ca4dd2 100644 --- a/eng/azure-pipelines.yml +++ b/eng/azure-pipelines.yml @@ -37,7 +37,6 @@ jobs: - task: CopyFiles@2 displayName: Collect dump inputs: - SourceFolder: $(Agent.TempDirectory)\*\ Contents: | *.dmp TargetFolder: $(Build.ArtifactStagingDirectory)\Dumps From 7907b63945488a1ed87774c2303a7983048a5d5f Mon Sep 17 00:00:00 2001 From: Marco Rossignoli Date: Sat, 21 May 2022 17:50:27 +0200 Subject: [PATCH 42/60] updates --- eng/azure-pipelines.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/eng/azure-pipelines.yml b/eng/azure-pipelines.yml index 910ca4dd2..13a49ef1a 100644 --- a/eng/azure-pipelines.yml +++ b/eng/azure-pipelines.yml @@ -37,6 +37,7 @@ jobs: - task: CopyFiles@2 displayName: Collect dump inputs: + SourceFolder: $(Agent.TempDirectory)\** Contents: | *.dmp TargetFolder: $(Build.ArtifactStagingDirectory)\Dumps From fa05f129b9354b856e0bf07721b12c9b5bf03d03 Mon Sep 17 00:00:00 2001 From: Marco Rossignoli Date: Sat, 21 May 2022 18:01:45 +0200 Subject: [PATCH 43/60] updates --- eng/azure-pipelines.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/eng/azure-pipelines.yml b/eng/azure-pipelines.yml index 13a49ef1a..c79c087e6 100644 --- a/eng/azure-pipelines.yml +++ b/eng/azure-pipelines.yml @@ -37,9 +37,8 @@ jobs: - task: CopyFiles@2 displayName: Collect dump inputs: - SourceFolder: $(Agent.TempDirectory)\** - Contents: | - *.dmp + SourceFolder: $(Agent.TempDirectory) + Contents: '**\*.dmp' TargetFolder: $(Build.ArtifactStagingDirectory)\Dumps condition: always() - task: PublishBuildArtifacts@1 From e0ecc6eb7e4ba28f58896757403522b245529490 Mon Sep 17 00:00:00 2001 From: Marco Rossignoli Date: Sat, 21 May 2022 18:10:03 +0200 Subject: [PATCH 44/60] updates --- eng/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eng/build.yml b/eng/build.yml index 59c7c4476..dcec287c1 100644 --- a/eng/build.yml +++ b/eng/build.yml @@ -30,6 +30,6 @@ steps: displayName: Run tests 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.xunit.extensions]*" --filter DisplayName~CatchBlock_Issue465 --blame-crash --blame-hang --blame-hang-timeout 1m + 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]*" --filter DisplayName~CatchBlock_Issue465 --blame-crash --blame-hang --blame-hang-timeout 15m testRunTitle: $(Agent.JobName) continueOnError: true From c8f95b075717a332a109a5ba9b2383fbc5a9ea55 Mon Sep 17 00:00:00 2001 From: Marco Rossignoli Date: Sat, 21 May 2022 18:13:35 +0200 Subject: [PATCH 45/60] updates --- Directory.Build.targets | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Directory.Build.targets b/Directory.Build.targets index f6cd1b61d..9d32d1c3f 100644 --- a/Directory.Build.targets +++ b/Directory.Build.targets @@ -25,7 +25,7 @@ - + From 9f584b6323d276409a23cd368562b20193214e0f Mon Sep 17 00:00:00 2001 From: Marco Rossignoli Date: Sun, 22 May 2022 20:37:56 +0200 Subject: [PATCH 46/60] updates --- .../Examples/VSTest/DeterministicBuild/HowTo.md | 4 ++-- src/coverlet.core/Coverage.cs | 3 --- test/coverlet.core.tests/Coverage/InstrumenterHelper.cs | 4 ---- test/coverlet.integration.tests/DeterministicBuild.cs | 9 ++++----- 4 files changed, 6 insertions(+), 14 deletions(-) diff --git a/Documentation/Examples/VSTest/DeterministicBuild/HowTo.md b/Documentation/Examples/VSTest/DeterministicBuild/HowTo.md index 96d94ef1b..b1002a65c 100644 --- a/Documentation/Examples/VSTest/DeterministicBuild/HowTo.md +++ b/Documentation/Examples/VSTest/DeterministicBuild/HowTo.md @@ -59,7 +59,7 @@ Add collectors package version generated to `"..\Documentation\Examples\VSTest\D Go to test project folder and run ``` C:\git\coverlet\Documentation\Examples\VSTest\DeterministicBuild (detbuilddocs -> origin) -λ dotnet test --collect:"XPlat Code Coverage" /p:DeterministicSourcePaths=true -- DataCollectionRunSettings.DataCollectors.DataCollector.Configuration.DeterministicReport=true +λ dotnet test --collect:"XPlat Code Coverage" /p:DeterministicSourcePaths=true Test run for C:\git\coverlet\Documentation\Examples\VSTest\DeterministicBuild\XUnitTestProject1\bin\Debug\netcoreapp3.1\XUnitTestProject1.dll(.NETCoreApp,Version=v3.1) Microsoft (R) Test Execution Command Line Tool Version 16.5.0 Copyright (c) Microsoft Corporation. All rights reserved. @@ -78,5 +78,5 @@ Total tests: 1 You should see on output folder the coverlet source root mapping file generated. This is the confirmation that you're running coverage on deterministic build. ``` -Documentation\Examples\VSTest\DeterministicBuild\XUnitTestProject1\bin\Debug\netcoreapp3.1\CoverletSourceRootsMapping_XUnitTestProject1 +Documentation\Examples\VSTest\DeterministicBuild\XUnitTestProject1\bin\Debug\netcoreapp3.1\CoverletSourceRootsMapping ``` \ No newline at end of file diff --git a/src/coverlet.core/Coverage.cs b/src/coverlet.core/Coverage.cs index 3882c7cb1..25a415b5b 100644 --- a/src/coverlet.core/Coverage.cs +++ b/src/coverlet.core/Coverage.cs @@ -114,8 +114,6 @@ public CoveragePrepareResult PrepareModules() continue; } - _logger.LogVerbose($"Included module: '{module}'"); - var instrumenter = new Instrumenter(module, Identifier, _parameters, @@ -127,7 +125,6 @@ public CoveragePrepareResult PrepareModules() if (instrumenter.CanInstrument()) { - _logger.LogVerbose($"Instrumentable module: '{module}'"); _instrumentationHelper.BackupOriginalModule(module, Identifier); // Guard code path and restore if instrumentation fails. diff --git a/test/coverlet.core.tests/Coverage/InstrumenterHelper.cs b/test/coverlet.core.tests/Coverage/InstrumenterHelper.cs index 7a3a8c999..8cb5eca7f 100644 --- a/test/coverlet.core.tests/Coverage/InstrumenterHelper.cs +++ b/test/coverlet.core.tests/Coverage/InstrumenterHelper.cs @@ -124,10 +124,6 @@ public static async Task Run(Func callM s_processWideContainer.GetService(), s_processWideContainer.GetService(), s_processWideContainer.GetService(), s_processWideContainer.GetService()); CoveragePrepareResult prepareResult = coverage.PrepareModules(); - File.AppendAllText(logFile, "\nTest file:" + newPath); - File.AppendAllText(logFile, "\nExists:" + File.Exists(newPath)); - Assert.True(false, File.ReadAllText(logFile)); - Assert.Single(prepareResult.Results); // Load new assembly diff --git a/test/coverlet.integration.tests/DeterministicBuild.cs b/test/coverlet.integration.tests/DeterministicBuild.cs index 9f830771d..b9f11a047 100644 --- a/test/coverlet.integration.tests/DeterministicBuild.cs +++ b/test/coverlet.integration.tests/DeterministicBuild.cs @@ -16,7 +16,6 @@ public class DeterministicBuild : BaseTest, IDisposable private readonly string _testProjectPath = Path.GetFullPath("../../../../coverlet.integration.determisticbuild"); private string? _testProjectTfm; private const string PropsFileName = "DeterministicTest.props"; - private const string ExpectedMappingFileName = "CoverletSourceRootsMapping_coverletsample.integration.determisticbuild"; private readonly string _buildConfiguration; public DeterministicBuild() @@ -76,7 +75,7 @@ public void Msbuild() CreateDeterministicTestPropsFile(); DotnetCli($"build -c {_buildConfiguration} /p:DeterministicSourcePaths=true", out string standardOutput, out string _, _testProjectPath); Assert.Contains("Build succeeded.", standardOutput); - string sourceRootMappingFilePath = Path.Combine(_testProjectPath, "bin", _buildConfiguration, _testProjectTfm!, ExpectedMappingFileName); + string sourceRootMappingFilePath = Path.Combine(_testProjectPath, "bin", _buildConfiguration, _testProjectTfm!, "CoverletSourceRootsMapping"); Assert.True(File.Exists(sourceRootMappingFilePath), sourceRootMappingFilePath); Assert.True(!string.IsNullOrEmpty(File.ReadAllText(sourceRootMappingFilePath)), "Empty CoverletSourceRootsMapping file"); Assert.Contains("=/_/", File.ReadAllText(sourceRootMappingFilePath)); @@ -99,7 +98,7 @@ public void Msbuild_SourceLink() CreateDeterministicTestPropsFile(); DotnetCli($"build -c {_buildConfiguration} /p:DeterministicSourcePaths=true", out string standardOutput, out string _, _testProjectPath); Assert.Contains("Build succeeded.", standardOutput); - string sourceRootMappingFilePath = Path.Combine(_testProjectPath, "bin", _buildConfiguration, _testProjectTfm!, ExpectedMappingFileName); + string sourceRootMappingFilePath = Path.Combine(_testProjectPath, "bin", _buildConfiguration, _testProjectTfm!, "CoverletSourceRootsMapping"); Assert.True(File.Exists(sourceRootMappingFilePath), sourceRootMappingFilePath); Assert.True(!string.IsNullOrEmpty(File.ReadAllText(sourceRootMappingFilePath)), "Empty CoverletSourceRootsMapping file"); Assert.Contains("=/_/", File.ReadAllText(sourceRootMappingFilePath)); @@ -123,7 +122,7 @@ public void Collectors() CreateDeterministicTestPropsFile(); DotnetCli($"build -c {_buildConfiguration} /p:DeterministicSourcePaths=true", out string standardOutput, out string _, _testProjectPath); Assert.Contains("Build succeeded.", standardOutput); - string sourceRootMappingFilePath = Path.Combine(_testProjectPath, "bin", GetAssemblyBuildConfiguration().ToString(), _testProjectTfm!, ExpectedMappingFileName); + string sourceRootMappingFilePath = Path.Combine(_testProjectPath, "bin", GetAssemblyBuildConfiguration().ToString(), _testProjectTfm!, "CoverletSourceRootsMapping"); Assert.True(File.Exists(sourceRootMappingFilePath), sourceRootMappingFilePath); Assert.NotEmpty(File.ReadAllText(sourceRootMappingFilePath)); Assert.Contains("=/_/", File.ReadAllText(sourceRootMappingFilePath)); @@ -151,7 +150,7 @@ public void Collectors_SourceLink() CreateDeterministicTestPropsFile(); DotnetCli($"build -c {_buildConfiguration} /p:DeterministicSourcePaths=true", out string standardOutput, out string _, _testProjectPath); Assert.Contains("Build succeeded.", standardOutput); - string sourceRootMappingFilePath = Path.Combine(_testProjectPath, "bin", GetAssemblyBuildConfiguration().ToString(), _testProjectTfm!, ExpectedMappingFileName); + string sourceRootMappingFilePath = Path.Combine(_testProjectPath, "bin", GetAssemblyBuildConfiguration().ToString(), _testProjectTfm!, "CoverletSourceRootsMapping"); Assert.True(File.Exists(sourceRootMappingFilePath), sourceRootMappingFilePath); Assert.NotEmpty(File.ReadAllText(sourceRootMappingFilePath)); Assert.Contains("=/_/", File.ReadAllText(sourceRootMappingFilePath)); From 7b47ccf0fc60b6ff21ed53e8b4a56c129a1bdde8 Mon Sep 17 00:00:00 2001 From: Marco Rossignoli Date: Sun, 22 May 2022 20:48:11 +0200 Subject: [PATCH 47/60] updates --- src/coverlet.core/Helpers/SourceRootTranslator.cs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/coverlet.core/Helpers/SourceRootTranslator.cs b/src/coverlet.core/Helpers/SourceRootTranslator.cs index 503dac449..4d50fbf81 100644 --- a/src/coverlet.core/Helpers/SourceRootTranslator.cs +++ b/src/coverlet.core/Helpers/SourceRootTranslator.cs @@ -22,7 +22,7 @@ internal class SourceRootTranslator : ISourceRootTranslator private readonly IFileSystem _fileSystem; private readonly Dictionary> _sourceRootMapping; private readonly Dictionary> _sourceToDeterministicPathMapping; - private readonly string _mappingFileName; + private const string MappingFileName = "CoverletSourceRootsMapping"; private Dictionary _resolutionCacheFiles; public SourceRootTranslator(ILogger logger, IFileSystem fileSystem) @@ -44,7 +44,6 @@ public SourceRootTranslator(string moduleTestPath, ILogger logger, IFileSystem f { throw new FileNotFoundException($"Module test path '{moduleTestPath}' not found", moduleTestPath); } - _mappingFileName = $"CoverletSourceRootsMapping_{Path.GetFileNameWithoutExtension(moduleTestPath)}"; _sourceRootMapping = LoadSourceRootMapping(Path.GetDirectoryName(moduleTestPath)); _sourceToDeterministicPathMapping = LoadSourceToDeterministicPathMapping(_sourceRootMapping); } @@ -76,7 +75,7 @@ private Dictionary> LoadSourceRootMapping(string { var mapping = new Dictionary>(); - string mappingFilePath = Path.Combine(directory, _mappingFileName); + string mappingFilePath = Path.Combine(directory, MappingFileName); if (!_fileSystem.Exists(mappingFilePath)) { return mapping; From ca98c62895f36dcae6dd934b25d39dcfc87d9340 Mon Sep 17 00:00:00 2001 From: Marco Rossignoli Date: Sun, 22 May 2022 21:01:02 +0200 Subject: [PATCH 48/60] updates --- .../build/netstandard1.0/coverlet.collector.targets | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/coverlet.collector/build/netstandard1.0/coverlet.collector.targets b/src/coverlet.collector/build/netstandard1.0/coverlet.collector.targets index 7bd7b28e7..2e4adb4c5 100644 --- a/src/coverlet.collector/build/netstandard1.0/coverlet.collector.targets +++ b/src/coverlet.collector/build/netstandard1.0/coverlet.collector.targets @@ -44,7 +44,7 @@ WARNING: DO NOT MODIFY this file unless you are knowledgeable about MSBuild and <_mapping Include="@(_byProject->'%(Identity)|%(OriginalPath)=%(MappedPath)')" /> - <_sourceRootMappingFilePath>$([MSBuild]::EnsureTrailingSlash('$(OutputPath)'))CoverletSourceRootsMapping_$(AssemblyName) + <_sourceRootMappingFilePath>$([MSBuild]::EnsureTrailingSlash('$(OutputPath)'))CoverletSourceRootsMapping Date: Sun, 22 May 2022 21:09:40 +0200 Subject: [PATCH 49/60] updates --- src/coverlet.msbuild.tasks/coverlet.msbuild.targets | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/coverlet.msbuild.tasks/coverlet.msbuild.targets b/src/coverlet.msbuild.tasks/coverlet.msbuild.targets index 96fa56a6c..c271ec2d1 100644 --- a/src/coverlet.msbuild.tasks/coverlet.msbuild.targets +++ b/src/coverlet.msbuild.tasks/coverlet.msbuild.targets @@ -24,7 +24,7 @@ <_mapping Include="@(_byProject->'%(Identity)|%(OriginalPath)=%(MappedPath)')" /> - <_sourceRootMappingFilePath>$([MSBuild]::EnsureTrailingSlash('$(OutputPath)'))CoverletSourceRootsMapping_$(AssemblyName) + <_sourceRootMappingFilePath>$([MSBuild]::EnsureTrailingSlash('$(OutputPath)'))CoverletSourceRootsMapping Date: Sun, 22 May 2022 21:17:39 +0200 Subject: [PATCH 50/60] updates --- .../Helpers/SourceRootTranslatorTests.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/coverlet.core.tests/Helpers/SourceRootTranslatorTests.cs b/test/coverlet.core.tests/Helpers/SourceRootTranslatorTests.cs index b1c2d073b..0768b9a70 100644 --- a/test/coverlet.core.tests/Helpers/SourceRootTranslatorTests.cs +++ b/test/coverlet.core.tests/Helpers/SourceRootTranslatorTests.cs @@ -21,7 +21,7 @@ public void Translate_Success() var fileSystem = new Mock(); fileSystem.Setup(f => f.Exists(It.IsAny())).Returns((string p) => { - if (p == "testLib.dll" || p == @"C:\git\coverlet\src\coverlet.core\obj\Debug\netstandard2.0\coverlet.core.pdb" || p == "CoverletSourceRootsMapping_testLib") return true; + if (p == "testLib.dll" || p == @"C:\git\coverlet\src\coverlet.core\obj\Debug\netstandard2.0\coverlet.core.pdb" || p == "CoverletSourceRootsMapping") return true; return false; }); fileSystem.Setup(f => f.ReadAllLines(It.IsAny())).Returns(File.ReadAllLines(@"TestAssets/CoverletSourceRootsMappingTest")); @@ -39,7 +39,7 @@ public void TranslatePathRoot_Success() var fileSystem = new Mock(); fileSystem.Setup(f => f.Exists(It.IsAny())).Returns((string p) => { - if (p == "testLib.dll" || p == @"C:\git\coverlet\src\coverlet.core\obj\Debug\netstandard2.0\coverlet.core.pdb" || p == "CoverletSourceRootsMapping_testLib") return true; + if (p == "testLib.dll" || p == @"C:\git\coverlet\src\coverlet.core\obj\Debug\netstandard2.0\coverlet.core.pdb" || p == "CoverletSourceRootsMapping") return true; return false; }); fileSystem.Setup(f => f.ReadAllLines(It.IsAny())).Returns(File.ReadAllLines(@"TestAssets/CoverletSourceRootsMappingTest")); @@ -71,7 +71,7 @@ public void Translate_MalformedFile() var fileSystem = new Mock(); fileSystem.Setup(f => f.Exists(It.IsAny())).Returns((string p) => { - if (p == "testLib.dll" || p == "CoverletSourceRootsMapping_testLib") return true; + if (p == "testLib.dll" || p == "CoverletSourceRootsMapping") return true; return false; }); fileSystem.Setup(f => f.ReadAllLines(It.IsAny())).Returns(new string[1] { "malformedRow" }); From 1ac4b711f49d238c53db1f4593b08e2748cd6ecb Mon Sep 17 00:00:00 2001 From: Marco Rossignoli Date: Sun, 22 May 2022 21:18:34 +0200 Subject: [PATCH 51/60] Revert "updates" This reverts commit ca98c62895f36dcae6dd934b25d39dcfc87d9340. --- .../build/netstandard1.0/coverlet.collector.targets | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/coverlet.collector/build/netstandard1.0/coverlet.collector.targets b/src/coverlet.collector/build/netstandard1.0/coverlet.collector.targets index 2e4adb4c5..7bd7b28e7 100644 --- a/src/coverlet.collector/build/netstandard1.0/coverlet.collector.targets +++ b/src/coverlet.collector/build/netstandard1.0/coverlet.collector.targets @@ -44,7 +44,7 @@ WARNING: DO NOT MODIFY this file unless you are knowledgeable about MSBuild and <_mapping Include="@(_byProject->'%(Identity)|%(OriginalPath)=%(MappedPath)')" /> - <_sourceRootMappingFilePath>$([MSBuild]::EnsureTrailingSlash('$(OutputPath)'))CoverletSourceRootsMapping + <_sourceRootMappingFilePath>$([MSBuild]::EnsureTrailingSlash('$(OutputPath)'))CoverletSourceRootsMapping_$(AssemblyName) Date: Sun, 22 May 2022 21:36:48 +0200 Subject: [PATCH 52/60] Revert "updates" This reverts commit 9438a03a52ace2f5f06796bdaab883d1218185e6. --- src/coverlet.msbuild.tasks/coverlet.msbuild.targets | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/coverlet.msbuild.tasks/coverlet.msbuild.targets b/src/coverlet.msbuild.tasks/coverlet.msbuild.targets index c271ec2d1..96fa56a6c 100644 --- a/src/coverlet.msbuild.tasks/coverlet.msbuild.targets +++ b/src/coverlet.msbuild.tasks/coverlet.msbuild.targets @@ -24,7 +24,7 @@ <_mapping Include="@(_byProject->'%(Identity)|%(OriginalPath)=%(MappedPath)')" /> - <_sourceRootMappingFilePath>$([MSBuild]::EnsureTrailingSlash('$(OutputPath)'))CoverletSourceRootsMapping + <_sourceRootMappingFilePath>$([MSBuild]::EnsureTrailingSlash('$(OutputPath)'))CoverletSourceRootsMapping_$(AssemblyName) Date: Sun, 22 May 2022 21:44:49 +0200 Subject: [PATCH 53/60] updates --- eng/azure-pipelines.yml | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/eng/azure-pipelines.yml b/eng/azure-pipelines.yml index c79c087e6..8fcbec829 100644 --- a/eng/azure-pipelines.yml +++ b/eng/azure-pipelines.yml @@ -34,17 +34,17 @@ jobs: ArtifactName: Packages publishLocation: Container condition: eq(variables['BuildConfiguration'], 'Release') - - task: CopyFiles@2 - displayName: Collect dump - inputs: - SourceFolder: $(Agent.TempDirectory) - Contents: '**\*.dmp' - TargetFolder: $(Build.ArtifactStagingDirectory)\Dumps - condition: always() - - task: PublishBuildArtifacts@1 - displayName: Publish dumps - inputs: - PathtoPublish: $(Build.ArtifactStagingDirectory)\Dumps - ArtifactName: Dumps - publishLocation: Container - condition: always() \ No newline at end of file +# - task: CopyFiles@2 +# displayName: Collect dump +# inputs: +# SourceFolder: $(Agent.TempDirectory) +# Contents: '**\*.dmp' +# TargetFolder: $(Build.ArtifactStagingDirectory)\Dumps +# condition: always() +# - task: PublishBuildArtifacts@1 +# displayName: Publish dumps +# inputs: +# PathtoPublish: $(Build.ArtifactStagingDirectory)\Dumps +# ArtifactName: Dumps +# publishLocation: Container +# condition: always() \ No newline at end of file From 4502c40b521914e023986352ada839762255a779 Mon Sep 17 00:00:00 2001 From: Marco Rossignoli Date: Sun, 22 May 2022 21:51:31 +0200 Subject: [PATCH 54/60] updates --- src/coverlet.msbuild.tasks/coverlet.msbuild.targets | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/coverlet.msbuild.tasks/coverlet.msbuild.targets b/src/coverlet.msbuild.tasks/coverlet.msbuild.targets index 96fa56a6c..c271ec2d1 100644 --- a/src/coverlet.msbuild.tasks/coverlet.msbuild.targets +++ b/src/coverlet.msbuild.tasks/coverlet.msbuild.targets @@ -24,7 +24,7 @@ <_mapping Include="@(_byProject->'%(Identity)|%(OriginalPath)=%(MappedPath)')" /> - <_sourceRootMappingFilePath>$([MSBuild]::EnsureTrailingSlash('$(OutputPath)'))CoverletSourceRootsMapping_$(AssemblyName) + <_sourceRootMappingFilePath>$([MSBuild]::EnsureTrailingSlash('$(OutputPath)'))CoverletSourceRootsMapping Date: Sun, 22 May 2022 21:58:25 +0200 Subject: [PATCH 55/60] updates --- eng/azure-pipelines.yml | 42 +++++++++++++++++++++++++++-------------- 1 file changed, 28 insertions(+), 14 deletions(-) diff --git a/eng/azure-pipelines.yml b/eng/azure-pipelines.yml index 8fcbec829..67d6bc41e 100644 --- a/eng/azure-pipelines.yml +++ b/eng/azure-pipelines.yml @@ -34,17 +34,31 @@ jobs: ArtifactName: Packages publishLocation: Container condition: eq(variables['BuildConfiguration'], 'Release') -# - task: CopyFiles@2 -# displayName: Collect dump -# inputs: -# SourceFolder: $(Agent.TempDirectory) -# Contents: '**\*.dmp' -# TargetFolder: $(Build.ArtifactStagingDirectory)\Dumps -# condition: always() -# - task: PublishBuildArtifacts@1 -# displayName: Publish dumps -# inputs: -# PathtoPublish: $(Build.ArtifactStagingDirectory)\Dumps -# ArtifactName: Dumps -# publishLocation: Container -# condition: always() \ No newline at end of file + +- job: macOS + displayName: macOS + continueOnError: 'true' + strategy: + matrix: + Debug: + buildConfiguration: "Debug" + Release: + buildConfiguration: "Release" + pool: + vmImage: 'macOS-latest' + steps: + - template: build.yml + +- job: Linux + displayName: Linux + continueOnError: 'true' + strategy: + matrix: + Debug: + buildConfiguration: "Debug" + Release: + buildConfiguration: "Release" + pool: + vmImage: 'ubuntu-latest' + steps: + - template: build.yml From 42468d170c4ab784942eae0b6c685dfaa5fc7495 Mon Sep 17 00:00:00 2001 From: Marco Rossignoli Date: Fri, 8 Apr 2022 09:21:04 +0200 Subject: [PATCH 56/60] Add project name to the CoverletSourceRootsMapping file to avoid file locking --- .../Examples/VSTest/DeterministicBuild/HowTo.md | 4 ++-- src/coverlet.core/Helpers/SourceRootTranslator.cs | 5 +++-- src/coverlet.msbuild.tasks/coverlet.msbuild.targets | 2 +- .../Helpers/SourceRootTranslatorTests.cs | 6 +++--- test/coverlet.integration.tests/DeterministicBuild.cs | 9 +++++---- 5 files changed, 14 insertions(+), 12 deletions(-) diff --git a/Documentation/Examples/VSTest/DeterministicBuild/HowTo.md b/Documentation/Examples/VSTest/DeterministicBuild/HowTo.md index b1002a65c..96d94ef1b 100644 --- a/Documentation/Examples/VSTest/DeterministicBuild/HowTo.md +++ b/Documentation/Examples/VSTest/DeterministicBuild/HowTo.md @@ -59,7 +59,7 @@ Add collectors package version generated to `"..\Documentation\Examples\VSTest\D Go to test project folder and run ``` C:\git\coverlet\Documentation\Examples\VSTest\DeterministicBuild (detbuilddocs -> origin) -λ dotnet test --collect:"XPlat Code Coverage" /p:DeterministicSourcePaths=true +λ dotnet test --collect:"XPlat Code Coverage" /p:DeterministicSourcePaths=true -- DataCollectionRunSettings.DataCollectors.DataCollector.Configuration.DeterministicReport=true Test run for C:\git\coverlet\Documentation\Examples\VSTest\DeterministicBuild\XUnitTestProject1\bin\Debug\netcoreapp3.1\XUnitTestProject1.dll(.NETCoreApp,Version=v3.1) Microsoft (R) Test Execution Command Line Tool Version 16.5.0 Copyright (c) Microsoft Corporation. All rights reserved. @@ -78,5 +78,5 @@ Total tests: 1 You should see on output folder the coverlet source root mapping file generated. This is the confirmation that you're running coverage on deterministic build. ``` -Documentation\Examples\VSTest\DeterministicBuild\XUnitTestProject1\bin\Debug\netcoreapp3.1\CoverletSourceRootsMapping +Documentation\Examples\VSTest\DeterministicBuild\XUnitTestProject1\bin\Debug\netcoreapp3.1\CoverletSourceRootsMapping_XUnitTestProject1 ``` \ No newline at end of file diff --git a/src/coverlet.core/Helpers/SourceRootTranslator.cs b/src/coverlet.core/Helpers/SourceRootTranslator.cs index 4d50fbf81..503dac449 100644 --- a/src/coverlet.core/Helpers/SourceRootTranslator.cs +++ b/src/coverlet.core/Helpers/SourceRootTranslator.cs @@ -22,7 +22,7 @@ internal class SourceRootTranslator : ISourceRootTranslator private readonly IFileSystem _fileSystem; private readonly Dictionary> _sourceRootMapping; private readonly Dictionary> _sourceToDeterministicPathMapping; - private const string MappingFileName = "CoverletSourceRootsMapping"; + private readonly string _mappingFileName; private Dictionary _resolutionCacheFiles; public SourceRootTranslator(ILogger logger, IFileSystem fileSystem) @@ -44,6 +44,7 @@ public SourceRootTranslator(string moduleTestPath, ILogger logger, IFileSystem f { throw new FileNotFoundException($"Module test path '{moduleTestPath}' not found", moduleTestPath); } + _mappingFileName = $"CoverletSourceRootsMapping_{Path.GetFileNameWithoutExtension(moduleTestPath)}"; _sourceRootMapping = LoadSourceRootMapping(Path.GetDirectoryName(moduleTestPath)); _sourceToDeterministicPathMapping = LoadSourceToDeterministicPathMapping(_sourceRootMapping); } @@ -75,7 +76,7 @@ private Dictionary> LoadSourceRootMapping(string { var mapping = new Dictionary>(); - string mappingFilePath = Path.Combine(directory, MappingFileName); + string mappingFilePath = Path.Combine(directory, _mappingFileName); if (!_fileSystem.Exists(mappingFilePath)) { return mapping; diff --git a/src/coverlet.msbuild.tasks/coverlet.msbuild.targets b/src/coverlet.msbuild.tasks/coverlet.msbuild.targets index c271ec2d1..96fa56a6c 100644 --- a/src/coverlet.msbuild.tasks/coverlet.msbuild.targets +++ b/src/coverlet.msbuild.tasks/coverlet.msbuild.targets @@ -24,7 +24,7 @@ <_mapping Include="@(_byProject->'%(Identity)|%(OriginalPath)=%(MappedPath)')" /> - <_sourceRootMappingFilePath>$([MSBuild]::EnsureTrailingSlash('$(OutputPath)'))CoverletSourceRootsMapping + <_sourceRootMappingFilePath>$([MSBuild]::EnsureTrailingSlash('$(OutputPath)'))CoverletSourceRootsMapping_$(AssemblyName) (); fileSystem.Setup(f => f.Exists(It.IsAny())).Returns((string p) => { - if (p == "testLib.dll" || p == @"C:\git\coverlet\src\coverlet.core\obj\Debug\netstandard2.0\coverlet.core.pdb" || p == "CoverletSourceRootsMapping") return true; + if (p == "testLib.dll" || p == @"C:\git\coverlet\src\coverlet.core\obj\Debug\netstandard2.0\coverlet.core.pdb" || p == "CoverletSourceRootsMapping_testLib") return true; return false; }); fileSystem.Setup(f => f.ReadAllLines(It.IsAny())).Returns(File.ReadAllLines(@"TestAssets/CoverletSourceRootsMappingTest")); @@ -39,7 +39,7 @@ public void TranslatePathRoot_Success() var fileSystem = new Mock(); fileSystem.Setup(f => f.Exists(It.IsAny())).Returns((string p) => { - if (p == "testLib.dll" || p == @"C:\git\coverlet\src\coverlet.core\obj\Debug\netstandard2.0\coverlet.core.pdb" || p == "CoverletSourceRootsMapping") return true; + if (p == "testLib.dll" || p == @"C:\git\coverlet\src\coverlet.core\obj\Debug\netstandard2.0\coverlet.core.pdb" || p == "CoverletSourceRootsMapping_testLib") return true; return false; }); fileSystem.Setup(f => f.ReadAllLines(It.IsAny())).Returns(File.ReadAllLines(@"TestAssets/CoverletSourceRootsMappingTest")); @@ -71,7 +71,7 @@ public void Translate_MalformedFile() var fileSystem = new Mock(); fileSystem.Setup(f => f.Exists(It.IsAny())).Returns((string p) => { - if (p == "testLib.dll" || p == "CoverletSourceRootsMapping") return true; + if (p == "testLib.dll" || p == "CoverletSourceRootsMapping_testLib") return true; return false; }); fileSystem.Setup(f => f.ReadAllLines(It.IsAny())).Returns(new string[1] { "malformedRow" }); diff --git a/test/coverlet.integration.tests/DeterministicBuild.cs b/test/coverlet.integration.tests/DeterministicBuild.cs index b9f11a047..9f830771d 100644 --- a/test/coverlet.integration.tests/DeterministicBuild.cs +++ b/test/coverlet.integration.tests/DeterministicBuild.cs @@ -16,6 +16,7 @@ public class DeterministicBuild : BaseTest, IDisposable private readonly string _testProjectPath = Path.GetFullPath("../../../../coverlet.integration.determisticbuild"); private string? _testProjectTfm; private const string PropsFileName = "DeterministicTest.props"; + private const string ExpectedMappingFileName = "CoverletSourceRootsMapping_coverletsample.integration.determisticbuild"; private readonly string _buildConfiguration; public DeterministicBuild() @@ -75,7 +76,7 @@ public void Msbuild() CreateDeterministicTestPropsFile(); DotnetCli($"build -c {_buildConfiguration} /p:DeterministicSourcePaths=true", out string standardOutput, out string _, _testProjectPath); Assert.Contains("Build succeeded.", standardOutput); - string sourceRootMappingFilePath = Path.Combine(_testProjectPath, "bin", _buildConfiguration, _testProjectTfm!, "CoverletSourceRootsMapping"); + string sourceRootMappingFilePath = Path.Combine(_testProjectPath, "bin", _buildConfiguration, _testProjectTfm!, ExpectedMappingFileName); Assert.True(File.Exists(sourceRootMappingFilePath), sourceRootMappingFilePath); Assert.True(!string.IsNullOrEmpty(File.ReadAllText(sourceRootMappingFilePath)), "Empty CoverletSourceRootsMapping file"); Assert.Contains("=/_/", File.ReadAllText(sourceRootMappingFilePath)); @@ -98,7 +99,7 @@ public void Msbuild_SourceLink() CreateDeterministicTestPropsFile(); DotnetCli($"build -c {_buildConfiguration} /p:DeterministicSourcePaths=true", out string standardOutput, out string _, _testProjectPath); Assert.Contains("Build succeeded.", standardOutput); - string sourceRootMappingFilePath = Path.Combine(_testProjectPath, "bin", _buildConfiguration, _testProjectTfm!, "CoverletSourceRootsMapping"); + string sourceRootMappingFilePath = Path.Combine(_testProjectPath, "bin", _buildConfiguration, _testProjectTfm!, ExpectedMappingFileName); Assert.True(File.Exists(sourceRootMappingFilePath), sourceRootMappingFilePath); Assert.True(!string.IsNullOrEmpty(File.ReadAllText(sourceRootMappingFilePath)), "Empty CoverletSourceRootsMapping file"); Assert.Contains("=/_/", File.ReadAllText(sourceRootMappingFilePath)); @@ -122,7 +123,7 @@ public void Collectors() CreateDeterministicTestPropsFile(); DotnetCli($"build -c {_buildConfiguration} /p:DeterministicSourcePaths=true", out string standardOutput, out string _, _testProjectPath); Assert.Contains("Build succeeded.", standardOutput); - string sourceRootMappingFilePath = Path.Combine(_testProjectPath, "bin", GetAssemblyBuildConfiguration().ToString(), _testProjectTfm!, "CoverletSourceRootsMapping"); + string sourceRootMappingFilePath = Path.Combine(_testProjectPath, "bin", GetAssemblyBuildConfiguration().ToString(), _testProjectTfm!, ExpectedMappingFileName); Assert.True(File.Exists(sourceRootMappingFilePath), sourceRootMappingFilePath); Assert.NotEmpty(File.ReadAllText(sourceRootMappingFilePath)); Assert.Contains("=/_/", File.ReadAllText(sourceRootMappingFilePath)); @@ -150,7 +151,7 @@ public void Collectors_SourceLink() CreateDeterministicTestPropsFile(); DotnetCli($"build -c {_buildConfiguration} /p:DeterministicSourcePaths=true", out string standardOutput, out string _, _testProjectPath); Assert.Contains("Build succeeded.", standardOutput); - string sourceRootMappingFilePath = Path.Combine(_testProjectPath, "bin", GetAssemblyBuildConfiguration().ToString(), _testProjectTfm!, "CoverletSourceRootsMapping"); + string sourceRootMappingFilePath = Path.Combine(_testProjectPath, "bin", GetAssemblyBuildConfiguration().ToString(), _testProjectTfm!, ExpectedMappingFileName); Assert.True(File.Exists(sourceRootMappingFilePath), sourceRootMappingFilePath); Assert.NotEmpty(File.ReadAllText(sourceRootMappingFilePath)); Assert.Contains("=/_/", File.ReadAllText(sourceRootMappingFilePath)); From e93cebbfa05051442a6772a7e05dd1deb99767f5 Mon Sep 17 00:00:00 2001 From: Marco Rossignoli Date: Sun, 22 May 2022 22:04:41 +0200 Subject: [PATCH 57/60] update --- src/coverlet.msbuild.tasks/coverlet.msbuild.targets | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/coverlet.msbuild.tasks/coverlet.msbuild.targets b/src/coverlet.msbuild.tasks/coverlet.msbuild.targets index 96fa56a6c..c271ec2d1 100644 --- a/src/coverlet.msbuild.tasks/coverlet.msbuild.targets +++ b/src/coverlet.msbuild.tasks/coverlet.msbuild.targets @@ -24,7 +24,7 @@ <_mapping Include="@(_byProject->'%(Identity)|%(OriginalPath)=%(MappedPath)')" /> - <_sourceRootMappingFilePath>$([MSBuild]::EnsureTrailingSlash('$(OutputPath)'))CoverletSourceRootsMapping_$(AssemblyName) + <_sourceRootMappingFilePath>$([MSBuild]::EnsureTrailingSlash('$(OutputPath)'))CoverletSourceRootsMapping Date: Sun, 22 May 2022 22:11:32 +0200 Subject: [PATCH 58/60] updates --- eng/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eng/build.yml b/eng/build.yml index dcec287c1..33d8fedcf 100644 --- a/eng/build.yml +++ b/eng/build.yml @@ -30,6 +30,6 @@ steps: displayName: Run tests 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.xunit.extensions]*" --filter DisplayName~CatchBlock_Issue465 --blame-crash --blame-hang --blame-hang-timeout 15m + 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]*" --blame-crash --blame-hang --blame-hang-timeout 15m testRunTitle: $(Agent.JobName) continueOnError: true From f1edf74994ba0d5aeeaa54cb482cc0462e08ad51 Mon Sep 17 00:00:00 2001 From: Marco Rossignoli Date: Sun, 22 May 2022 22:12:27 +0200 Subject: [PATCH 59/60] updates --- .../Helpers/SourceRootTranslatorTests.cs | 6 +++--- test/coverlet.integration.tests/DeterministicBuild.cs | 9 ++++----- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/test/coverlet.core.tests/Helpers/SourceRootTranslatorTests.cs b/test/coverlet.core.tests/Helpers/SourceRootTranslatorTests.cs index b1c2d073b..0768b9a70 100644 --- a/test/coverlet.core.tests/Helpers/SourceRootTranslatorTests.cs +++ b/test/coverlet.core.tests/Helpers/SourceRootTranslatorTests.cs @@ -21,7 +21,7 @@ public void Translate_Success() var fileSystem = new Mock(); fileSystem.Setup(f => f.Exists(It.IsAny())).Returns((string p) => { - if (p == "testLib.dll" || p == @"C:\git\coverlet\src\coverlet.core\obj\Debug\netstandard2.0\coverlet.core.pdb" || p == "CoverletSourceRootsMapping_testLib") return true; + if (p == "testLib.dll" || p == @"C:\git\coverlet\src\coverlet.core\obj\Debug\netstandard2.0\coverlet.core.pdb" || p == "CoverletSourceRootsMapping") return true; return false; }); fileSystem.Setup(f => f.ReadAllLines(It.IsAny())).Returns(File.ReadAllLines(@"TestAssets/CoverletSourceRootsMappingTest")); @@ -39,7 +39,7 @@ public void TranslatePathRoot_Success() var fileSystem = new Mock(); fileSystem.Setup(f => f.Exists(It.IsAny())).Returns((string p) => { - if (p == "testLib.dll" || p == @"C:\git\coverlet\src\coverlet.core\obj\Debug\netstandard2.0\coverlet.core.pdb" || p == "CoverletSourceRootsMapping_testLib") return true; + if (p == "testLib.dll" || p == @"C:\git\coverlet\src\coverlet.core\obj\Debug\netstandard2.0\coverlet.core.pdb" || p == "CoverletSourceRootsMapping") return true; return false; }); fileSystem.Setup(f => f.ReadAllLines(It.IsAny())).Returns(File.ReadAllLines(@"TestAssets/CoverletSourceRootsMappingTest")); @@ -71,7 +71,7 @@ public void Translate_MalformedFile() var fileSystem = new Mock(); fileSystem.Setup(f => f.Exists(It.IsAny())).Returns((string p) => { - if (p == "testLib.dll" || p == "CoverletSourceRootsMapping_testLib") return true; + if (p == "testLib.dll" || p == "CoverletSourceRootsMapping") return true; return false; }); fileSystem.Setup(f => f.ReadAllLines(It.IsAny())).Returns(new string[1] { "malformedRow" }); diff --git a/test/coverlet.integration.tests/DeterministicBuild.cs b/test/coverlet.integration.tests/DeterministicBuild.cs index 9f830771d..b9f11a047 100644 --- a/test/coverlet.integration.tests/DeterministicBuild.cs +++ b/test/coverlet.integration.tests/DeterministicBuild.cs @@ -16,7 +16,6 @@ public class DeterministicBuild : BaseTest, IDisposable private readonly string _testProjectPath = Path.GetFullPath("../../../../coverlet.integration.determisticbuild"); private string? _testProjectTfm; private const string PropsFileName = "DeterministicTest.props"; - private const string ExpectedMappingFileName = "CoverletSourceRootsMapping_coverletsample.integration.determisticbuild"; private readonly string _buildConfiguration; public DeterministicBuild() @@ -76,7 +75,7 @@ public void Msbuild() CreateDeterministicTestPropsFile(); DotnetCli($"build -c {_buildConfiguration} /p:DeterministicSourcePaths=true", out string standardOutput, out string _, _testProjectPath); Assert.Contains("Build succeeded.", standardOutput); - string sourceRootMappingFilePath = Path.Combine(_testProjectPath, "bin", _buildConfiguration, _testProjectTfm!, ExpectedMappingFileName); + string sourceRootMappingFilePath = Path.Combine(_testProjectPath, "bin", _buildConfiguration, _testProjectTfm!, "CoverletSourceRootsMapping"); Assert.True(File.Exists(sourceRootMappingFilePath), sourceRootMappingFilePath); Assert.True(!string.IsNullOrEmpty(File.ReadAllText(sourceRootMappingFilePath)), "Empty CoverletSourceRootsMapping file"); Assert.Contains("=/_/", File.ReadAllText(sourceRootMappingFilePath)); @@ -99,7 +98,7 @@ public void Msbuild_SourceLink() CreateDeterministicTestPropsFile(); DotnetCli($"build -c {_buildConfiguration} /p:DeterministicSourcePaths=true", out string standardOutput, out string _, _testProjectPath); Assert.Contains("Build succeeded.", standardOutput); - string sourceRootMappingFilePath = Path.Combine(_testProjectPath, "bin", _buildConfiguration, _testProjectTfm!, ExpectedMappingFileName); + string sourceRootMappingFilePath = Path.Combine(_testProjectPath, "bin", _buildConfiguration, _testProjectTfm!, "CoverletSourceRootsMapping"); Assert.True(File.Exists(sourceRootMappingFilePath), sourceRootMappingFilePath); Assert.True(!string.IsNullOrEmpty(File.ReadAllText(sourceRootMappingFilePath)), "Empty CoverletSourceRootsMapping file"); Assert.Contains("=/_/", File.ReadAllText(sourceRootMappingFilePath)); @@ -123,7 +122,7 @@ public void Collectors() CreateDeterministicTestPropsFile(); DotnetCli($"build -c {_buildConfiguration} /p:DeterministicSourcePaths=true", out string standardOutput, out string _, _testProjectPath); Assert.Contains("Build succeeded.", standardOutput); - string sourceRootMappingFilePath = Path.Combine(_testProjectPath, "bin", GetAssemblyBuildConfiguration().ToString(), _testProjectTfm!, ExpectedMappingFileName); + string sourceRootMappingFilePath = Path.Combine(_testProjectPath, "bin", GetAssemblyBuildConfiguration().ToString(), _testProjectTfm!, "CoverletSourceRootsMapping"); Assert.True(File.Exists(sourceRootMappingFilePath), sourceRootMappingFilePath); Assert.NotEmpty(File.ReadAllText(sourceRootMappingFilePath)); Assert.Contains("=/_/", File.ReadAllText(sourceRootMappingFilePath)); @@ -151,7 +150,7 @@ public void Collectors_SourceLink() CreateDeterministicTestPropsFile(); DotnetCli($"build -c {_buildConfiguration} /p:DeterministicSourcePaths=true", out string standardOutput, out string _, _testProjectPath); Assert.Contains("Build succeeded.", standardOutput); - string sourceRootMappingFilePath = Path.Combine(_testProjectPath, "bin", GetAssemblyBuildConfiguration().ToString(), _testProjectTfm!, ExpectedMappingFileName); + string sourceRootMappingFilePath = Path.Combine(_testProjectPath, "bin", GetAssemblyBuildConfiguration().ToString(), _testProjectTfm!, "CoverletSourceRootsMapping"); Assert.True(File.Exists(sourceRootMappingFilePath), sourceRootMappingFilePath); Assert.NotEmpty(File.ReadAllText(sourceRootMappingFilePath)); Assert.Contains("=/_/", File.ReadAllText(sourceRootMappingFilePath)); From cc8fc503da671e502c06efe58782710c0c8fd703 Mon Sep 17 00:00:00 2001 From: Marco Rossignoli Date: Sun, 22 May 2022 22:13:08 +0200 Subject: [PATCH 60/60] updates --- eng/build.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/eng/build.yml b/eng/build.yml index 33d8fedcf..8481a21b7 100644 --- a/eng/build.yml +++ b/eng/build.yml @@ -32,4 +32,3 @@ steps: 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.xunit.extensions]*" --blame-crash --blame-hang --blame-hang-timeout 15m testRunTitle: $(Agent.JobName) - continueOnError: true