|
8 | 8 | using System.Xml.Linq;
|
9 | 9 | using Coverlet.Core;
|
10 | 10 | using Coverlet.Tests.Utils;
|
11 |
| -using Coverlet.Tests.Xunit.Extensions; |
12 | 11 | using Newtonsoft.Json;
|
13 | 12 | using Xunit;
|
14 | 13 | using Xunit.Abstractions;
|
@@ -127,14 +126,10 @@ public void Msbuild()
|
127 | 126 | Assert.True(File.Exists(testResultFile));
|
128 | 127 | AssertCoverage(standardOutput);
|
129 | 128 |
|
130 |
| - // Process exits hang on clean seem that process doesn't close, maybe some msbuild node reuse? btw manually tested |
131 |
| - DotnetCli("clean", out standardOutput, out standardError, _testProjectPath); |
132 |
| - // Assert.False(File.Exists(sourceRootMappingFilePath)); |
133 |
| - // RunCommand("git", "clean -fdx", out _, out _, _testProjectPath); |
| 129 | + CleanupBuildOutput(); |
134 | 130 | }
|
135 | 131 |
|
136 |
| - [ConditionalFact] |
137 |
| - [SkipOnOS(OS.Linux, "Hung up on Linux")] |
| 132 | + [Fact] |
138 | 133 | public void Msbuild_SourceLink()
|
139 | 134 | {
|
140 | 135 | string testResultPath = Path.Join(_testResultsPath, ((ITest)_testMember!.GetValue(_output)!).DisplayName);
|
@@ -176,17 +171,14 @@ public void Msbuild_SourceLink()
|
176 | 171 | Assert.Contains("raw.githubusercontent.com", File.ReadAllText(testResultFile));
|
177 | 172 | AssertCoverage(standardOutput, checkDeterministicReport: false);
|
178 | 173 |
|
179 |
| - // Process exits hang on clean seem that process doesn't close, maybe some msbuild node reuse? btw manually tested |
180 |
| - DotnetCli("clean", out standardOutput, out standardError, _testProjectPath); |
181 |
| - // Assert.False(File.Exists(sourceRootMappingFilePath)); |
182 |
| - // RunCommand("git", "clean -fdx", out _, out _, _testProjectPath); |
| 174 | + CleanupBuildOutput(); |
183 | 175 | }
|
184 | 176 |
|
185 | 177 | [Fact]
|
186 | 178 | public void Collectors()
|
187 | 179 | {
|
188 | 180 | string testResultPath = Path.Join(_testResultsPath, ((ITest)_testMember!.GetValue(_output)!).DisplayName);
|
189 |
| - string testLogFilesPath = Path.Join(_testBinaryPath, ((ITest)_testMember!.GetValue(_output)!).DisplayName); |
| 181 | + string testLogFilesPath = Path.Join(_testResultsPath, ((ITest)_testMember!.GetValue(_output)!).DisplayName, "log"); |
190 | 182 | string logFilename = string.Concat(((ITest)_testMember!.GetValue(_output)!).DisplayName, ".binlog");
|
191 | 183 |
|
192 | 184 | CreateDeterministicTestPropsFile();
|
@@ -234,17 +226,14 @@ public void Collectors()
|
234 | 226 | Assert.Contains("[coverlet]Initialize CoverletInProcDataCollector", File.ReadAllText(Directory.GetFiles(testLogFilesPath, "log.host.*.txt").Single()));
|
235 | 227 | Assert.Contains("[coverlet]Mapping resolved", dataCollectorLogContent);
|
236 | 228 |
|
237 |
| - // Process exits hang on clean seem that process doesn't close, maybe some msbuild node reuse? btw manually tested |
238 |
| - DotnetCli("clean", out standardOutput, out standardError, _testProjectPath); |
239 |
| - // Assert.False(File.Exists(sourceRootMappingFilePath)); |
240 |
| - // RunCommand("git", "clean -fdx", out _, out _, _testProjectPath); |
| 229 | + CleanupBuildOutput(); |
241 | 230 | }
|
242 | 231 |
|
243 | 232 | [Fact]
|
244 | 233 | public void Collectors_SourceLink()
|
245 | 234 | {
|
246 | 235 | string testResultPath = Path.Join(_testResultsPath, ((ITest)_testMember!.GetValue(_output)!).DisplayName);
|
247 |
| - string testLogFilesPath = Path.Join(_testBinaryPath, ((ITest)_testMember!.GetValue(_output)!).DisplayName); |
| 236 | + string testLogFilesPath = Path.Join(_testResultsPath, ((ITest)_testMember!.GetValue(_output)!).DisplayName, "log"); |
248 | 237 | string logFilename = string.Concat(((ITest)_testMember!.GetValue(_output)!).DisplayName, ".binlog");
|
249 | 238 |
|
250 | 239 | CreateDeterministicTestPropsFile();
|
@@ -305,10 +294,7 @@ public void Collectors_SourceLink()
|
305 | 294 | Assert.Contains("[coverlet]Initialize CoverletInProcDataCollector", File.ReadAllText(Directory.GetFiles(testLogFilesPath, "log.host.*.txt").Single()));
|
306 | 295 | Assert.Contains("[coverlet]Mapping resolved", dataCollectorLogContent);
|
307 | 296 |
|
308 |
| - // Process exits hang on clean seem that process doesn't close, maybe some msbuild node reuse? btw manually tested |
309 |
| - DotnetCli("clean", out standardOutput, out standardError, _testProjectPath); |
310 |
| - // Assert.False(File.Exists(sourceRootMappingFilePath)); |
311 |
| - // RunCommand("git", "clean -fdx", out _, out _, _testProjectPath); |
| 297 | + CleanupBuildOutput(); |
312 | 298 | }
|
313 | 299 |
|
314 | 300 | private static void DeleteTestIntermediateFiles(string testResultsPath)
|
@@ -342,6 +328,19 @@ private static void DeleteLogFiles(string directory)
|
342 | 328 | }
|
343 | 329 |
|
344 | 330 | }
|
| 331 | + private void CleanupBuildOutput() |
| 332 | + { |
| 333 | + if (Directory.Exists(_testBinaryPath)) |
| 334 | + { |
| 335 | + Directory.Delete(_testBinaryPath, recursive: true); |
| 336 | + } |
| 337 | + |
| 338 | + string intermediateBuildOutput = _testBinaryPath.Replace("bin", "obj"); |
| 339 | + if (Directory.Exists(intermediateBuildOutput)) |
| 340 | + { |
| 341 | + Directory.Delete(intermediateBuildOutput, recursive: true); |
| 342 | + } |
| 343 | + } |
345 | 344 | private static void DeleteCoverageFiles(string directory)
|
346 | 345 | {
|
347 | 346 | if (Directory.Exists(directory))
|
|
0 commit comments