Skip to content
This repository was archived by the owner on Jan 23, 2023. It is now read-only.

Commit 64b5ddd

Browse files
authored
Fix running JitBench on Linux (#24248)
* Fix running JitBench on Linux * Bump to head of aspnet/JitBench:rel/2.0.0
1 parent b7fc495 commit 64b5ddd

File tree

4 files changed

+12
-12
lines changed

4 files changed

+12
-12
lines changed

tests/src/performance/Scenario/JitBench/Benchmarks/WebAppBenchmarks.cs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
using System.IO;
44
using System.Text.RegularExpressions;
55
using System.Threading.Tasks;
6+
using System.Runtime.InteropServices;
67
using Microsoft.Xunit.Performance.Api;
78

89
namespace JitBench
@@ -99,11 +100,12 @@ async Task ExecuteGitCommand(string arguments, ITestOutputHelper output, string
99100
private async Task CreateStore(DotNetInstallation dotNetInstall, string outputDir, ITestOutputHelper output)
100101
{
101102
string tfm = DotNetSetup.GetTargetFrameworkMonikerForFrameworkVersion(dotNetInstall.FrameworkVersion);
102-
string rid = $"win7-{dotNetInstall.Architecture}";
103103
string storeDirName = ".store";
104-
await new ProcessRunner("powershell.exe", $".\\AspNet-GenerateStore.ps1 -InstallDir {storeDirName} -Architecture {dotNetInstall.Architecture} -Runtime {rid}")
104+
await (RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ?
105+
new ProcessRunner("powershell.exe", $".\\AspNet-GenerateStore.ps1 -InstallDir {storeDirName} -Architecture {dotNetInstall.Architecture} -Runtime win7-{dotNetInstall.Architecture}") :
106+
new ProcessRunner("bash", $"./aspnet-generatestore.sh --install-dir {storeDirName} --architecture {dotNetInstall.Architecture} --runtime-id linux-{dotNetInstall.Architecture} -f {tfm} --fx-version {dotNetInstall.FrameworkVersion}"))
105107
.WithWorkingDirectory(GetJitBenchRepoRootDir(outputDir))
106-
.WithEnvironmentVariable("PATH", $"{dotNetInstall.DotNetDir};{Environment.GetEnvironmentVariable("PATH")}")
108+
.WithEnvironmentVariable("PATH", $"{dotNetInstall.DotNetDir}{Path.PathSeparator}{Environment.GetEnvironmentVariable("PATH")}")
107109
.WithEnvironmentVariable("DOTNET_MULTILEVEL_LOOKUP", "0")
108110
.WithEnvironmentVariable("JITBENCH_TARGET_FRAMEWORK_MONIKER", tfm)
109111
.WithEnvironmentVariable("JITBENCH_FRAMEWORK_VERSION", dotNetInstall.FrameworkVersion)
@@ -273,7 +275,7 @@ string GetWebAppStoreDir(string outputDir)
273275
}
274276

275277
private const string JitBenchRepoUrl = "https://github.com/aspnet/JitBench";
276-
private const string JitBenchCommitSha1Id = "6bee730486f272d31f23f1033225090511f856f3";
278+
private const string JitBenchCommitSha1Id = "e863c5f9543b4101c41fdd04730ca30684d1f913";
277279
private const string StoreDirName = ".store";
278280
private readonly Metric StartupMetric = new Metric("Startup", "ms");
279281
private readonly Metric FirstRequestMetric = new Metric("First Request", "ms");

tests/src/performance/Scenario/JitBench/Runner/Benchmark.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using System;
1+
using System;
22
using System.Collections.Generic;
33
using System.Diagnostics;
44
using System.IO;
@@ -142,7 +142,7 @@ BenchmarkRunResult MeasureIterations(TestRun run, BenchmarkConfiguration config,
142142
string[] args = new string[] { "--perf:collect", string.Join("+", run.MetricNames), "--perf:outputdir", run.OutputDir, "--perf:runid", run.BenchviewRunId };
143143
using (var harness = new XunitPerformanceHarness(args))
144144
{
145-
ProcessStartInfo startInfo = new ProcessStartInfo(run.DotNetInstallation.DotNetExe, (ExePath + " " + CommandLineArguments).Trim());
145+
ProcessStartInfo startInfo = new ProcessStartInfo(run.DotNetInstallation.DotNetExe, $"{ExePath} {CommandLineArguments}");
146146
startInfo.WorkingDirectory = WorkingDirPath;
147147
startInfo.RedirectStandardError = true;
148148
startInfo.RedirectStandardOutput = true;

tests/src/performance/Scenario/JitBench/Utilities/DotNetSetup.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ public static string GetFrameworkDownloadLink(string azureFeed, string version,
215215

216216
public static string GetRuntimeDownloadLink(string azureFeed, string version, string os, string arch)
217217
{
218-
return string.Format("{0}/Runtime/{1}/dotnet-runtime-{1}-{2}-{3}.zip", azureFeed, version, os, arch);
218+
return string.Format("{0}/Runtime/{1}/dotnet-runtime-{1}-{2}-{3}.{4}", azureFeed, version, os, arch, RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? "zip" : "tar.gz");
219219
}
220220

221221
public static string GetSDKDownloadLink(string version, Architecture arch)
@@ -230,7 +230,7 @@ public static string GetSDKDownloadLink(string azureFeed, string version, OSPlat
230230

231231
public static string GetSDKDownloadLink(string azureFeed, string version, string os, string arch)
232232
{
233-
return string.Format("{0}/Sdk/{1}/dotnet-sdk-{1}-{2}-{3}.zip", azureFeed, version, os, arch);
233+
return string.Format("{0}/Sdk/{1}/dotnet-sdk-{1}-{2}-{3}.{4}", azureFeed, version, os, arch, RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? "zip" : "tar.gz");
234234
}
235235

236236
public static string GetTargetFrameworkMonikerForFrameworkVersion(string runtimeVersion)

tests/src/performance/Scenario/JitBench/Utilities/FileTasks.cs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,7 @@ public static class FileTasks
1515
{
1616
public async static Task DownloadAndUnzip(string remotePath, string localExpandedDirPath, ITestOutputHelper output, bool deleteTempFiles=true)
1717
{
18-
string tempFileNameBase = Guid.NewGuid().ToString();
19-
string tempDownloadPath = Path.Combine(Path.GetTempPath(), tempFileNameBase + Path.GetExtension(remotePath));
18+
string tempDownloadPath = Path.Combine(Path.GetTempPath(), Path.GetFileName(remotePath));
2019
Download(remotePath, tempDownloadPath, output);
2120
await Unzip(tempDownloadPath, localExpandedDirPath, output, true);
2221
}
@@ -51,8 +50,7 @@ public static async Task Unzip(string zipPath, string expandedDirPath, ITestOutp
5150
bool deleteTar = deleteZippedFiles;
5251
if(tempTarPath == null)
5352
{
54-
string tempFileNameBase = Guid.NewGuid().ToString();
55-
tempTarPath = Path.Combine(Path.GetTempPath(), tempFileNameBase + ".tar");
53+
tempTarPath = Path.Combine(Path.GetTempPath(), zipPath.Substring(0, zipPath.Length - ".gz".Length));
5654
deleteTar = true;
5755
}
5856
await UnGZip(zipPath, tempTarPath, output);

0 commit comments

Comments
 (0)