Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 17 additions & 11 deletions tests/BenchmarkDotNet.IntegrationTests/MonoAotLlvmTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
using System.Linq;
using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Configs;
using BenchmarkDotNet.Detectors;
using BenchmarkDotNet.Environments;
using BenchmarkDotNet.IntegrationTests.Diagnosers;
using BenchmarkDotNet.IntegrationTests.Xunit;
Expand All @@ -18,9 +17,19 @@
namespace BenchmarkDotNet.IntegrationTests
{
/// <summary>
/// In order to run MonoAotLlvmTests locally, the following prerequisites are required:
/// * Have MonoAOT workload installed
/// * Have the Mono AOT compiler available at the path specified by MONOAOTLLVM_COMPILER_PATH environment variable
/// Running these tests locally requires building the mono runtime from the dotnet/runtime repository,
/// since the AOT compiler isn't distributed as a standalone package.
///
/// To set up:
/// 1. Clone https://github.com/dotnet/runtime
/// 2. Build the mono runtime with libs:
/// Windows: build.cmd -subset mono+libs -c Release
/// Unix: ./build.sh -subset mono+libs -c Release
/// 3. Set the MONOAOTLLVM_COMPILER_PATH environment variable to the compiler binary:
/// Windows: artifacts\bin\mono\windows.x64.Release\mono-sgen.exe
/// Unix: artifacts/bin/mono/[os].x64.Release/mono-sgen
///
/// The runtime pack ends up at artifacts/bin/microsoft.netcore.app.runtime.[os]-x64/Release/
/// </summary>
public class MonoAotLlvmTests(ITestOutputHelper output) : BenchmarkTestExecutor(output)
{
Expand Down Expand Up @@ -57,20 +66,17 @@ private ManualConfig GetConfig(MonoAotCompilerMode mode = MonoAotCompilerMode.ll

private static bool GetShouldRunTest()
{
// MonoAOTLLVM is only supported on non-Windows platforms with a 64-bit architecture
// MonoAOTLLVM requires a 64-bit platform
if (!RuntimeInformation.Is64BitPlatform())
return false;

if (OsDetector.IsWindows())
return false;

if (!IsAotCompilerAvailable())
return false;

return true;
}

[FactEnvSpecific("MonoAOTLLVM is only supported on Unix", EnvRequirement.NonWindows)]
[Fact]
public void MonoAotLlvmIsSupported()
{
if (!GetShouldRunTest())
Expand All @@ -92,7 +98,7 @@ public void MonoAotLlvmIsSupported()
}
}

[FactEnvSpecific("MonoAOTLLVM is only supported on Unix", EnvRequirement.NonWindows)]
[Fact]
public void MonoAotLlvmSupportsInProcessDiagnosers()
{
if (!GetShouldRunTest())
Expand Down Expand Up @@ -129,7 +135,7 @@ public void MonoAotLlvmSupportsInProcessDiagnosers()
}
}

[FactEnvSpecific("MonoAOTLLVM is only supported on Unix", EnvRequirement.NonWindows)]
[Fact]
public void MonoAotLlvmMiniModeIsSupported()
{
if (!GetShouldRunTest())
Expand Down