Skip to content

Commit

Permalink
Add C library detection to processinfo3 test (#88260)
Browse files Browse the repository at this point in the history
  • Loading branch information
jander-msft committed Jul 10, 2023
1 parent 89d6fd5 commit e40d6e1
Showing 1 changed file with 23 additions and 1 deletion.
24 changes: 23 additions & 1 deletion src/tests/tracing/eventpipe/processinfo3/processinfo3.cs
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,29 @@ public static int Main()
}
else if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
{
expectedPortableRidOs = "linux";
// Check process modules for C library type indication to determine
// which linux RID OS is applicable.
Logger.logger.Log("Begin checking process modules to determine C library type.");
for (int i = 0; i < currentProcess.Modules.Count; i++)
{
ProcessModule module = currentProcess.Modules[i];
Logger.logger.Log($"- {module.ModuleName}");

if (module.ModuleName.StartsWith("libc.", StringComparison.Ordinal) ||
module.ModuleName.StartsWith("libc-", StringComparison.Ordinal))
{
Logger.logger.Log("Found gnu libc indicator.");
expectedPortableRidOs = "linux";
break;
}
else if (module.ModuleName.StartsWith("ld-musl-", StringComparison.Ordinal))
{
Logger.logger.Log("Found musl libc indicator.");
expectedPortableRidOs = "linux-musl";
break;
}
}
Logger.logger.Log("Finished checking process modules.");
}

Utils.Assert(!string.IsNullOrEmpty(expectedPortableRidOs), $"Unable to calculate expected portable RID OS.");
Expand Down

0 comments on commit e40d6e1

Please sign in to comment.