Skip to content

Commit 9a9d7e7

Browse files
authored
Fix Mono AOT LLVM (#2539)
* Attempt at fixing Mono AOT LLVM * Ensure runtime moniker is preserved * Missed to update one spot
1 parent 63626bb commit 9a9d7e7

File tree

4 files changed

+12
-12
lines changed

4 files changed

+12
-12
lines changed

src/BenchmarkDotNet/ConsoleArguments/ConfigParser.cs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -571,19 +571,19 @@ private static Job CreateJobForGivenRuntime(Job baseJob, string runtimeId, Comma
571571
return MakeWasmJob(baseJob, options, "net9.0", runtimeMoniker);
572572

573573
case RuntimeMoniker.MonoAOTLLVM:
574-
return MakeMonoAOTLLVMJob(baseJob, options, RuntimeInformation.IsNetCore ? CoreRuntime.GetCurrentVersion().MsBuildMoniker : "net6.0");
574+
return MakeMonoAOTLLVMJob(baseJob, options, RuntimeInformation.IsNetCore ? CoreRuntime.GetCurrentVersion().MsBuildMoniker : "net6.0", runtimeMoniker);
575575

576576
case RuntimeMoniker.MonoAOTLLVMNet60:
577-
return MakeMonoAOTLLVMJob(baseJob, options, "net6.0");
577+
return MakeMonoAOTLLVMJob(baseJob, options, "net6.0", runtimeMoniker);
578578

579579
case RuntimeMoniker.MonoAOTLLVMNet70:
580-
return MakeMonoAOTLLVMJob(baseJob, options, "net7.0");
580+
return MakeMonoAOTLLVMJob(baseJob, options, "net7.0", runtimeMoniker);
581581

582582
case RuntimeMoniker.MonoAOTLLVMNet80:
583-
return MakeMonoAOTLLVMJob(baseJob, options, "net8.0");
583+
return MakeMonoAOTLLVMJob(baseJob, options, "net8.0", runtimeMoniker);
584584

585585
case RuntimeMoniker.MonoAOTLLVMNet90:
586-
return MakeMonoAOTLLVMJob(baseJob, options, "net9.0");
586+
return MakeMonoAOTLLVMJob(baseJob, options, "net9.0", runtimeMoniker);
587587

588588
case RuntimeMoniker.Mono60:
589589
return MakeMonoJob(baseJob, options, MonoRuntime.Mono60);
@@ -637,9 +637,9 @@ private static Job MakeMonoJob(Job baseJob, CommandLineOptions options, MonoRunt
637637
packagesPath: options.RestorePath?.FullName)));
638638
}
639639

640-
private static Job MakeMonoAOTLLVMJob(Job baseJob, CommandLineOptions options, string msBuildMoniker)
640+
private static Job MakeMonoAOTLLVMJob(Job baseJob, CommandLineOptions options, string msBuildMoniker, RuntimeMoniker moniker)
641641
{
642-
var monoAotLLVMRuntime = new MonoAotLLVMRuntime(aotCompilerPath: options.AOTCompilerPath, aotCompilerMode: options.AOTCompilerMode, msBuildMoniker: msBuildMoniker);
642+
var monoAotLLVMRuntime = new MonoAotLLVMRuntime(aotCompilerPath: options.AOTCompilerPath, aotCompilerMode: options.AOTCompilerMode, msBuildMoniker: msBuildMoniker, moniker: moniker);
643643

644644
var toolChain = MonoAotLLVMToolChain.From(
645645
new NetCoreAppSettings(

src/BenchmarkDotNet/Environments/Runtimes/MonoAotLLVMRuntime.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ public class MonoAotLLVMRuntime : Runtime, IEquatable<MonoAotLLVMRuntime>
2020
/// <summary>
2121
/// creates new instance of MonoAotLLVMRuntime
2222
/// </summary>
23-
public MonoAotLLVMRuntime(FileInfo aotCompilerPath, MonoAotCompilerMode aotCompilerMode, string msBuildMoniker = "net6.0", string displayName = "MonoAOTLLVM") : base(RuntimeMoniker.MonoAOTLLVM, msBuildMoniker, displayName)
23+
public MonoAotLLVMRuntime(FileInfo aotCompilerPath, MonoAotCompilerMode aotCompilerMode, string msBuildMoniker = "net6.0", string displayName = "MonoAOTLLVM", RuntimeMoniker moniker = RuntimeMoniker.MonoAOTLLVM) : base(moniker, msBuildMoniker, displayName)
2424
{
2525
if (aotCompilerPath == null)
2626
throw new ArgumentNullException(paramName: nameof(aotCompilerPath));

src/BenchmarkDotNet/Toolchains/Executor.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ private static ProcessStartInfo CreateStartInfo(BenchmarkCase benchmarkCase, Art
146146
case MonoAotLLVMRuntime _:
147147
start.FileName = exePath;
148148
start.Arguments = args;
149-
start.WorkingDirectory = artifactsPaths.BinariesDirectoryPath;
149+
start.WorkingDirectory = Path.Combine(artifactsPaths.BinariesDirectoryPath, "publish");
150150
break;
151151
case CustomRuntime _:
152152
start.FileName = exePath;

src/BenchmarkDotNet/Toolchains/MonoAotLLVM/MonoAotLLVMGenerator.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,10 +55,10 @@ protected override void GenerateProject(BuildPartition buildPartition, Artifacts
5555

5656
protected override string GetExecutablePath(string binariesDirectoryPath, string programName)
5757
=> Portability.RuntimeInformation.IsWindows()
58-
? Path.Combine(binariesDirectoryPath, $"{programName}.exe")
59-
: Path.Combine(binariesDirectoryPath, programName);
58+
? Path.Combine(binariesDirectoryPath, "publish", $"{programName}.exe")
59+
: Path.Combine(binariesDirectoryPath, "publish", programName);
6060

6161
protected override string GetBinariesDirectoryPath(string buildArtifactsDirectoryPath, string configuration)
62-
=> Path.Combine(buildArtifactsDirectoryPath, "bin", configuration, TargetFrameworkMoniker, CustomDotNetCliToolchainBuilder.GetPortableRuntimeIdentifier(), "publish");
62+
=> Path.Combine(buildArtifactsDirectoryPath, "bin", configuration, TargetFrameworkMoniker, CustomDotNetCliToolchainBuilder.GetPortableRuntimeIdentifier());
6363
}
6464
}

0 commit comments

Comments
 (0)