From 1fee6e893ed972cc5041bd94171b28a015dd57ea Mon Sep 17 00:00:00 2001 From: Justin Anderson Date: Wed, 22 Sep 2021 12:19:27 -0700 Subject: [PATCH] Validate ProcessInfo is same (except entrypoint) before and after resume. (#2603) --- .../GetProcessInfoTests.cs | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/tests/Microsoft.Diagnostics.NETCore.Client/GetProcessInfoTests.cs b/src/tests/Microsoft.Diagnostics.NETCore.Client/GetProcessInfoTests.cs index 868890489c..53b514b1e4 100644 --- a/src/tests/Microsoft.Diagnostics.NETCore.Client/GetProcessInfoTests.cs +++ b/src/tests/Microsoft.Diagnostics.NETCore.Client/GetProcessInfoTests.cs @@ -56,9 +56,10 @@ private async Task BasicProcessInfoTestCore(bool useAsync, bool suspend) DiagnosticsClientApiShim clientShim = new DiagnosticsClientApiShim(new DiagnosticsClient(runner.Pid), useAsync); // While suspended, the runtime will not provide entrypoint information. + ProcessInfo processInfoBeforeResume = null; if (suspend) { - ProcessInfo processInfoBeforeResume = await clientShim.GetProcessInfo(); + processInfoBeforeResume = await clientShim.GetProcessInfo(); ValidateProcessInfo(runner.Pid, processInfoBeforeResume); Assert.True(string.IsNullOrEmpty(processInfoBeforeResume.ManagedEntrypointAssemblyName)); @@ -70,6 +71,17 @@ private async Task BasicProcessInfoTestCore(bool useAsync, bool suspend) ProcessInfo processInfo = await GetProcessInfoWithEntrypointAsync(clientShim); ValidateProcessInfo(runner.Pid, processInfo); Assert.Equal("Tracee", processInfo.ManagedEntrypointAssemblyName); + + // Validate values before resume (except for entrypoint) are the same after resume. + if (suspend) + { + Assert.Equal(processInfoBeforeResume.ProcessId, processInfo.ProcessId); + Assert.Equal(processInfoBeforeResume.RuntimeInstanceCookie, processInfo.RuntimeInstanceCookie); + Assert.Equal(processInfoBeforeResume.CommandLine, processInfo.CommandLine); + Assert.Equal(processInfoBeforeResume.OperatingSystem, processInfo.OperatingSystem); + Assert.Equal(processInfoBeforeResume.ProcessArchitecture, processInfo.ProcessArchitecture); + Assert.Equal(processInfoBeforeResume.ClrProductVersionString, processInfo.ClrProductVersionString); + } } finally {