Browse Source

In `PrettyTestRunner`, when a test case fails, prioritize using a folder without a numbered suffix for the output directory.

pull/3598/head
sonyps5201314 5 months ago
parent
commit
5a67d15e0f
  1. 19
      ICSharpCode.Decompiler.Tests/PrettyTestRunner.cs

19
ICSharpCode.Decompiler.Tests/PrettyTestRunner.cs

@ -877,6 +877,8 @@ namespace ICSharpCode.Decompiler.Tests @@ -877,6 +877,8 @@ namespace ICSharpCode.Decompiler.Tests
string baseTempName = testName + Tester.GetSuffix(cscOptions);
string tempDir = Path.Combine(Path.GetTempPath(), "ICSharpCode.Decompiler.Tests", baseTempName);
if (Directory.Exists(tempDir))
{
void PrepareNewDirName()
{
int idx = 2;
string newDir;
@ -891,6 +893,23 @@ namespace ICSharpCode.Decompiler.Tests @@ -891,6 +893,23 @@ namespace ICSharpCode.Decompiler.Tests
idx++;
}
}
const bool preferOverwrite = true;
if (preferOverwrite)
{
try
{
Tester.RepeatOnIOError(() => Directory.Delete(tempDir, true));
}
catch
{
PrepareNewDirName();
}
}
else
{
PrepareNewDirName();
}
}
Directory.CreateDirectory(tempDir);
string originalIl = Path.Combine(tempDir, Path.GetFileNameWithoutExtension(exeFile) + ".original.il");

Loading…
Cancel
Save