Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
27 changes: 25 additions & 2 deletions src/native/managed/cdac/tests/DumpTests/DumpTestBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,14 @@ public static IEnumerable<object[]> TestConfigurations
{
get
{
string? dumpSource = GetDumpSource();
foreach (string r2rMode in GetR2RModes())
{
if (!IsVersionSkipped("local"))
yield return [new TestConfiguration("local", r2rMode)];
yield return [new TestConfiguration("local", r2rMode, dumpSource)];

if (!IsVersionSkipped("net10.0"))
yield return [new TestConfiguration("net10.0", r2rMode)];
yield return [new TestConfiguration("net10.0", r2rMode, dumpSource)];
}
}
}
Expand Down Expand Up @@ -176,6 +177,28 @@ private static string GetDumpRoot()
return Path.Combine(repoRoot, "artifacts", "dumps", "cdac");
}

/// <summary>
/// Returns the dump source platform from dump-info.json (e.g., "windows_x64"),
/// or null for local runs where CDAC_DUMP_ROOT is not set.
/// </summary>
private static string? GetDumpSource()
{
string? dumpRoot = Environment.GetEnvironmentVariable("CDAC_DUMP_ROOT");
if (string.IsNullOrEmpty(dumpRoot))
return null;

// Try loading dump-info.json from any version directory to get OS/Arch
foreach (string versionDir in new[] { "local", "net10.0" })
Comment thread
max-charlamb marked this conversation as resolved.
{
DumpInfo? info = DumpInfo.TryLoad(Path.Combine(dumpRoot, versionDir));
if (info is not null)
return $"{info.Os}_{info.Arch}";
}
Comment thread
max-charlamb marked this conversation as resolved.
Comment thread
max-charlamb marked this conversation as resolved.

// Fall back to the directory name if dump-info.json isn't available
return Path.GetFileName(dumpRoot.TrimEnd(Path.DirectorySeparatorChar, Path.AltDirectorySeparatorChar));
}

/// <summary>
/// Returns the R2R modes to test against. Both modes are always tested;
/// dumps that don't exist for a given mode are skipped via <see cref="SkipTestException"/>.
Expand Down
14 changes: 12 additions & 2 deletions src/native/managed/cdac/tests/DumpTests/TestConfiguration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,25 +26,35 @@ public sealed class TestConfiguration : IXunitSerializable
/// </summary>
public string R2RMode { get; set; } = "r2r";

/// <summary>
/// The platform that produced the dump (e.g., "windows_x64", "linux_arm64").
/// Null for local runs where the host and dump source are the same.
/// </summary>
public string? DumpSource { get; set; }
Comment thread
max-charlamb marked this conversation as resolved.

public TestConfiguration() { }

public TestConfiguration(string runtimeVersion, string r2rMode)
public TestConfiguration(string runtimeVersion, string r2rMode, string? dumpSource = null)
{
RuntimeVersion = runtimeVersion;
R2RMode = r2rMode;
DumpSource = dumpSource;
}

public override string ToString() => $"{RuntimeVersion}/{R2RMode}";
public override string ToString() =>
DumpSource is not null ? $"{RuntimeVersion}/{R2RMode} ({DumpSource})" : $"{RuntimeVersion}/{R2RMode}";

public void Serialize(IXunitSerializationInfo info)
{
info.AddValue(nameof(RuntimeVersion), RuntimeVersion);
info.AddValue(nameof(R2RMode), R2RMode);
info.AddValue(nameof(DumpSource), DumpSource, typeof(string));
}

public void Deserialize(IXunitSerializationInfo info)
{
RuntimeVersion = info.GetValue<string>(nameof(RuntimeVersion));
R2RMode = info.GetValue<string>(nameof(R2RMode));
DumpSource = info.GetValue<string>(nameof(DumpSource));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
TestHostPayload — Path to testhost shared framework directory
DumpTestsPayload — Path to payload directory (tests/ + dumps/)
TargetOS — Target OS (windows, linux, osx)
TargetArchitecture — Target architecture (x64, x86, arm64, arm)
SourcePlatforms — Semicolon-separated source platform names
(e.g. "windows_x64;linux_x64;osx_arm64")
-->
Expand Down Expand Up @@ -97,7 +98,7 @@
<WriteLinesToFile File="$(_HelixCommandFile)" Lines="@(_HelixCommandLines)" Overwrite="true" />

<ItemGroup>
<HelixWorkItem Include="CdacXPlatDumpTests_%(_SourcePlatform.Identity)">
<HelixWorkItem Include="CdacXPlatDumpTests_host_$(TargetOS)_$(TargetArchitecture)_dumps_%(_SourcePlatform.Identity)">
<PayloadDirectory>$(DumpTestsPayload)</PayloadDirectory>
Comment thread
max-charlamb marked this conversation as resolved.
<Command>$([System.IO.File]::ReadAllText('$(_HelixCommandFile)'))</Command>
Comment thread
max-charlamb marked this conversation as resolved.
<Timeout>$(WorkItemTimeout)</Timeout>
Expand Down