From 2541feac2c6460bd14373993cec51caaf4f093da Mon Sep 17 00:00:00 2001 From: Dan Moseley Date: Tue, 4 Jan 2022 09:55:59 -0700 Subject: [PATCH 1/2] Revert "logging (#63326)" This reverts commit 312c66f1fc2f749f56612999cb1adab9ca7fde59. --- .../tests/ConsoleKeyInfoTests.cs | 29 ++++--------------- 1 file changed, 5 insertions(+), 24 deletions(-) diff --git a/src/libraries/System.Console/tests/ConsoleKeyInfoTests.cs b/src/libraries/System.Console/tests/ConsoleKeyInfoTests.cs index 43a4007708f24e..da3720a43d0159 100644 --- a/src/libraries/System.Console/tests/ConsoleKeyInfoTests.cs +++ b/src/libraries/System.Console/tests/ConsoleKeyInfoTests.cs @@ -3,19 +3,11 @@ using System.Collections.Generic; using Xunit; -using Xunit.Abstractions; namespace System.Tests { public class ConsoleKeyInfoTests { - private readonly ITestOutputHelper _output; - - public ConsoleKeyInfoTests(ITestOutputHelper output) - { - _output = output; - } - [Fact] public void Ctor_DefaultCtor_PropertiesReturnDefaults() { @@ -45,23 +37,12 @@ public void Equals_SameData(ConsoleKeyInfo cki) { ConsoleKeyInfo other = cki; // otherwise compiler warns about comparing the instance with itself - try - { - Assert.True(cki.Equals((object)other)); - Assert.True(cki.Equals(other)); - Assert.True(cki == other); - Assert.False(cki != other); - - Assert.Equal(cki.GetHashCode(), other.GetHashCode()); - } - catch - { - // Log more info in failure case to help investigate https://github.com/dotnet/runtime/issues/60240 - _output.WriteLine($"ConsoleKeyInfo had KeyChar {cki.KeyChar} Key {cki.Key} Modifiers {cki.Modifiers}"); - _output.WriteLine($"`cki.Equals(other)` gives {cki.Equals(other)} and `cki == other` gives {cki == other}"); + Assert.True(cki.Equals((object)other)); + Assert.True(cki.Equals(other)); + Assert.True(cki == other); + Assert.False(cki != other); - throw; - } + Assert.Equal(cki.GetHashCode(), other.GetHashCode()); } [Theory] From 3bd8559d76ef46d3186d949770d25cdd693c85f3 Mon Sep 17 00:00:00 2001 From: Dan Moseley Date: Tue, 4 Jan 2022 10:24:00 -0700 Subject: [PATCH 2/2] disable test for jit stress regs --- src/libraries/System.Console/tests/ConsoleKeyInfoTests.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/libraries/System.Console/tests/ConsoleKeyInfoTests.cs b/src/libraries/System.Console/tests/ConsoleKeyInfoTests.cs index da3720a43d0159..c4410457e8850f 100644 --- a/src/libraries/System.Console/tests/ConsoleKeyInfoTests.cs +++ b/src/libraries/System.Console/tests/ConsoleKeyInfoTests.cs @@ -33,6 +33,7 @@ public void Ctor_ValueCtor_ValuesPassedToProperties(bool shift, bool alt, bool c [Theory] [MemberData(nameof(SampleConsoleKeyInfos))] + [SkipOnCoreClr("https://github.com/dotnet/runtime/issues/60240", RuntimeTestModes.JitStressRegs)] public void Equals_SameData(ConsoleKeyInfo cki) { ConsoleKeyInfo other = cki; // otherwise compiler warns about comparing the instance with itself