Skip to content

Commit 68c5436

Browse files
committed
Add wasm compiler mode tests.
1 parent 3a12396 commit 68c5436

File tree

1 file changed

+13
-8
lines changed

1 file changed

+13
-8
lines changed

tests/BenchmarkDotNet.IntegrationTests/WasmTests.cs

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
using BenchmarkDotNet.Tests.Loggers;
1212
using BenchmarkDotNet.Tests.XUnit;
1313
using BenchmarkDotNet.Toolchains.DotNetCli;
14+
using BenchmarkDotNet.Toolchains.MonoAotLLVM;
1415
using BenchmarkDotNet.Toolchains.MonoWasm;
1516
using Xunit;
1617
using Xunit.Abstractions;
@@ -27,11 +28,11 @@ namespace BenchmarkDotNet.IntegrationTests
2728
/// </summary>
2829
public class WasmTests(ITestOutputHelper output) : BenchmarkTestExecutor(output)
2930
{
30-
private ManualConfig GetConfig()
31+
private ManualConfig GetConfig(MonoAotCompilerMode aotCompilerMode)
3132
{
3233
var dotnetVersion = "net8.0";
3334
var logger = new OutputLogger(Output);
34-
var netCoreAppSettings = new NetCoreAppSettings(dotnetVersion, null, "Wasm");
35+
var netCoreAppSettings = new NetCoreAppSettings(dotnetVersion, null, "Wasm", aotCompilerMode: aotCompilerMode);
3536
var mainJsPath = Path.Combine(AppContext.BaseDirectory, "AppBundle", "test-main.js");
3637

3738
return ManualConfig.CreateEmpty()
@@ -44,20 +45,24 @@ private ManualConfig GetConfig()
4445
.WithOption(ConfigOptions.GenerateMSBuildBinLog, true);
4546
}
4647

47-
[FactEnvSpecific("WASM is only supported on Unix", EnvRequirement.NonWindows)]
48-
public void WasmIsSupported()
48+
[TheoryEnvSpecific("WASM is only supported on Unix", EnvRequirement.NonWindows)]
49+
[InlineData(MonoAotCompilerMode.mini)]
50+
[InlineData(MonoAotCompilerMode.wasm)]
51+
public void WasmIsSupported(MonoAotCompilerMode aotCompilerMode)
4952
{
5053
// Test fails on Linux non-x64.
5154
if (OsDetector.IsLinux() && RuntimeInformation.GetCurrentPlatform() != Platform.X64)
5255
{
5356
return;
5457
}
5558

56-
CanExecute<WasmBenchmark>(GetConfig());
59+
CanExecute<WasmBenchmark>(GetConfig(aotCompilerMode));
5760
}
5861

59-
[FactEnvSpecific("WASM is only supported on Unix", EnvRequirement.NonWindows)]
60-
public void WasmSupportsInProcessDiagnosers()
62+
[TheoryEnvSpecific("WASM is only supported on Unix", EnvRequirement.NonWindows)]
63+
[InlineData(MonoAotCompilerMode.mini)]
64+
[InlineData(MonoAotCompilerMode.wasm)]
65+
public void WasmSupportsInProcessDiagnosers(MonoAotCompilerMode aotCompilerMode)
6166
{
6267
// Test fails on Linux non-x64.
6368
if (OsDetector.IsLinux() && RuntimeInformation.GetCurrentPlatform() != Platform.X64)
@@ -68,7 +73,7 @@ public void WasmSupportsInProcessDiagnosers()
6873
try
6974
{
7075
var diagnoser = new MockInProcessDiagnoser1(BenchmarkDotNet.Diagnosers.RunMode.NoOverhead);
71-
var config = GetConfig().AddDiagnoser(diagnoser);
76+
var config = GetConfig(aotCompilerMode).AddDiagnoser(diagnoser);
7277

7378
CanExecute<WasmBenchmark>(config);
7479

0 commit comments

Comments
 (0)