Skip to content

Commit

Permalink
Set output dir depending on the version and delete it after the bench…
Browse files Browse the repository at this point in the history
…marking is completed.
  • Loading branch information
VJalili committed Sep 5, 2022
1 parent 625e964 commit bb90a8d
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
2 changes: 2 additions & 0 deletions Benchmark/PerformanceTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ public static void Test(string dataDir, string resultsFilename, string version,

foreach (var syntheticRep in syntheticReps)
File.Delete(syntheticRep);
if (verInfo.OutputDir != null)
Directory.Delete(verInfo.OutputDir, true);
timer.Stop();
Console.WriteLine($"\r{msg}Done!\t(ET: {timer.Elapsed}");

Expand Down
12 changes: 11 additions & 1 deletion Benchmark/VersionInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ public ProcessStartInfo StartInfo

public Uri ReleaseUri { private set; get; }

public string? OutputDir { private set; get; } = null;


public VersionInfo(
string version,
Expand All @@ -49,11 +51,12 @@ private bool TryRunVerSpecificConfig(string version)
{
_invocation = "mspc.exe";
ReleaseUri = new Uri(ReleaseUri, $"download/{version}/mspc.zip");
SetOutputDir();
return true;
}

pattern = new Regex(@"^v2\.\d+(\.\d+)?$");
if(pattern.IsMatch(version))
if (pattern.IsMatch(version))
{
_invocation = "mspc.exe";
ReleaseUri = new Uri(ReleaseUri, $"download/{version}/v2.1.zip");
Expand Down Expand Up @@ -83,5 +86,12 @@ private async Task<(bool, string)> TryLocalize()

return (true, dir);
}

private void SetOutputDir()
{
OutputDir = Path.Combine(Path.GetTempPath(), Path.GetRandomFileName());
Directory.CreateDirectory(OutputDir);
Args += $" -o {Path.Combine(OutputDir, "tmp")}";
}
}
}

0 comments on commit bb90a8d

Please sign in to comment.