Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[RISC-V] Add riscv64 arch to tracing/eventpipe/processinfo tests #103832

Merged
merged 3 commits into from
Jun 24, 2024
Merged
Show file tree
Hide file tree
Changes from 2 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
6 changes: 4 additions & 2 deletions src/tests/tracing/eventpipe/processinfo/processinfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -224,14 +224,16 @@ public static void TestEntryPoint()
Architecture.X64 => "x64",
Architecture.Arm => "arm32",
Architecture.Arm64 => "arm64",
Architecture.RiscV64 => "riscv64",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

string expectedArchValue = RuntimeInformation.ProcessArchitecture switch
{
    Architecture.Arm => "arm32",
    // All other architectures match the enum member name
    _ => RuntimeInformation.ProcessArchitecture.ToString().ToLowerInvariant()
}

Can we make this more succinct and reduce need for updates with every new architecture?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, I've updated PR

Architecture.LoongArch64 => "loongarch64",
_ => "Unknown"
};

Utils.Assert(expectedArchValue.Equals(arch), $"OS must match current Operating System. Expected: \"{expectedArchValue}\", Received: \"{arch}\"");
Utils.Assert(expectedArchValue.Equals(arch), $"Arch must match current Architecture. Expected: \"{expectedArchValue}\", Received: \"{arch}\"");

Utils.Assert(end == totalSize, $"Full payload should have been read. Expected: {totalSize}, Received: {end}");

Logger.logger.Log($"\n{{\n\tprocessId: {processId},\n\truntimeCookie: {runtimeCookie},\n\tcommandLine: {commandLine},\n\tOS: {OS},\n\tArch: {arch}\n}}");
}
}
}
}
6 changes: 4 additions & 2 deletions src/tests/tracing/eventpipe/processinfo2/processinfo2.cs
Original file line number Diff line number Diff line change
Expand Up @@ -225,10 +225,12 @@ public static void TestEntryPoint()
Architecture.X64 => "x64",
Architecture.Arm => "arm32",
Architecture.Arm64 => "arm64",
Architecture.RiscV64 => "riscv64",
Architecture.LoongArch64 => "loongarch64",
_ => "Unknown"
};

Utils.Assert(expectedArchValue.Equals(arch), $"OS must match current Operating System. Expected: \"{expectedArchValue}\", Received: \"{arch}\"");
Utils.Assert(expectedArchValue.Equals(arch), $"Arch must match current Architecture. Expected: \"{expectedArchValue}\", Received: \"{arch}\"");

// VALIDATE ManagedEntrypointAssemblyName
start = end;
Expand Down Expand Up @@ -269,4 +271,4 @@ public static void TestEntryPoint()
Logger.logger.Log($"\n{{\n\tprocessId: {processId},\n\truntimeCookie: {runtimeCookie},\n\tcommandLine: {commandLine},\n\tOS: {OS},\n\tArch: {arch},\n\tManagedEntrypointAssemblyName: {managedEntrypointAssemblyName},\n\tClrProductVersion: {clrProductVersion}\n}}");
}
}
}
}
6 changes: 4 additions & 2 deletions src/tests/tracing/eventpipe/processinfo3/processinfo3.cs
Original file line number Diff line number Diff line change
Expand Up @@ -233,10 +233,12 @@ public static void TestEntryPoint()
Architecture.X64 => "x64",
Architecture.Arm => "arm32",
Architecture.Arm64 => "arm64",
Architecture.RiscV64 => "riscv64",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please also add loongarch64 while updating these.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've added loongarch64 too, but please note that I've not verified that test passes on it now. @shushanhf @LuckyXu-HF please take a look.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. Yes, it's funny that either that test is suppressed or it throws anyway. We have these unnecessary platform maps in too many places which add no value (just another string to update for the next platform).

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for heads up. I have verified on LA64 and these are also suitable for LA64.
LGTM, thanks very much.

Architecture.LoongArch64 => "loongarch64",
_ => "Unknown"
};

Utils.Assert(expectedArchValue.Equals(arch), $"OS must match current Operating System. Expected: \"{expectedArchValue}\", Received: \"{arch}\"");
Utils.Assert(expectedArchValue.Equals(arch), $"Arch must match current Architecture. Expected: \"{expectedArchValue}\", Received: \"{arch}\"");

// VALIDATE ManagedEntrypointAssemblyName
start = end;
Expand Down Expand Up @@ -341,4 +343,4 @@ public static void TestEntryPoint()
Logger.logger.Log($"\n{{\n\tprocessId: {processId},\n\truntimeCookie: {runtimeCookie},\n\tcommandLine: {commandLine},\n\tOS: {OS},\n\tArch: {arch},\n\tManagedEntrypointAssemblyName: {managedEntrypointAssemblyName},\n\tClrProductVersion: {clrProductVersion},\n\tPortableRid: {portableRid}\n}}");
}
}
}
}
Loading