From 481e60f0ba15a14adf20afd7aabe0189097a1f43 Mon Sep 17 00:00:00 2001 From: pavelsavara Date: Sun, 21 Jan 2024 11:50:52 +0100 Subject: [PATCH 01/25] test --- .../ConsoleFormatterTests.cs | 4 -- .../ConsoleLoggerTest.cs | 41 ------------------- .../SimpleConsoleFormatterTests.cs | 3 -- .../tests/ProducerConsumerCollectionTests.cs | 1 - .../tests/PipeWriterTests.cs | 1 - .../tests/ExchangeTests.cs | 1 - .../Tests/AsyncReaderLateInitTests.cs | 3 -- .../XmlSchemaValidatorApi/ValidateMisc.cs | 1 - .../System/Random.cs | 1 - .../CancellationTokenTests.cs | 1 - .../MethodCoverage.cs | 2 - ...syncEnumerableToBlockingEnumerableTests.cs | 3 -- .../Task/TaskContinueWithTests.cs | 1 - .../tests/ParallelForTests.cs | 2 - .../tests/ParallelLoopResultTests.cs | 1 - .../tests/RangePartitioner1Chunk.cs | 2 - .../tests/RangePartitionerTests.cs | 1 - .../System.Threading/tests/MutexTests.cs | 1 - .../tests/SemaphoreSlimTests.cs | 4 -- 19 files changed, 74 deletions(-) diff --git a/src/libraries/Microsoft.Extensions.Logging.Console/tests/Microsoft.Extensions.Logging.Console.Tests/ConsoleFormatterTests.cs b/src/libraries/Microsoft.Extensions.Logging.Console/tests/Microsoft.Extensions.Logging.Console.Tests/ConsoleFormatterTests.cs index 573006673d8889..6da081c4e86ab0 100644 --- a/src/libraries/Microsoft.Extensions.Logging.Console/tests/Microsoft.Extensions.Logging.Console.Tests/ConsoleFormatterTests.cs +++ b/src/libraries/Microsoft.Extensions.Logging.Console/tests/Microsoft.Extensions.Logging.Console.Tests/ConsoleFormatterTests.cs @@ -74,7 +74,6 @@ internal static (ConsoleLogger Logger, ConsoleSink Sink, ConsoleSink ErrorSink, } [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))] - [ActiveIssue("https://github.com/dotnet/runtime/issues/91538", typeof(PlatformDetection), nameof(PlatformDetection.IsWasmThreadingSupported))] public void ConsoleLoggerOptions_TimeStampFormat_IsReloaded() { // Arrange @@ -88,7 +87,6 @@ public void ConsoleLoggerOptions_TimeStampFormat_IsReloaded() } [ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))] - [ActiveIssue("https://github.com/dotnet/runtime/issues/91538", typeof(PlatformDetection), nameof(PlatformDetection.IsWasmThreadingSupported))] [MemberData(nameof(FormatterNames))] public void InvalidLogLevel_Throws(string formatterName) { @@ -103,7 +101,6 @@ public void InvalidLogLevel_Throws(string formatterName) } [ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))] - [ActiveIssue("https://github.com/dotnet/runtime/issues/91538", typeof(PlatformDetection), nameof(PlatformDetection.IsWasmThreadingSupported))] [MemberData(nameof(FormatterNamesAndLevels))] public void NoMessageOrException_Noop(string formatterName, LogLevel level) { @@ -123,7 +120,6 @@ public void NoMessageOrException_Noop(string formatterName, LogLevel level) } [ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))] - [ActiveIssue("https://github.com/dotnet/runtime/issues/91538", typeof(PlatformDetection), nameof(PlatformDetection.IsWasmThreadingSupported))] [MemberData(nameof(FormatterNamesAndLevels))] public void Log_LogsCorrectTimestamp(string formatterName, LogLevel level) { diff --git a/src/libraries/Microsoft.Extensions.Logging.Console/tests/Microsoft.Extensions.Logging.Console.Tests/ConsoleLoggerTest.cs b/src/libraries/Microsoft.Extensions.Logging.Console/tests/Microsoft.Extensions.Logging.Console.Tests/ConsoleLoggerTest.cs index f0ef3d6cd7e1d1..0994980590122b 100644 --- a/src/libraries/Microsoft.Extensions.Logging.Console/tests/Microsoft.Extensions.Logging.Console.Tests/ConsoleLoggerTest.cs +++ b/src/libraries/Microsoft.Extensions.Logging.Console/tests/Microsoft.Extensions.Logging.Console.Tests/ConsoleLoggerTest.cs @@ -174,7 +174,6 @@ internal static string GetJsonLogLevelString(LogLevel logLevel) } [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))] - [ActiveIssue("https://github.com/dotnet/runtime/issues/91538", typeof(PlatformDetection), nameof(PlatformDetection.IsWasmThreadingSupported))] public void LogsWhenMessageIsNotProvided() { // Arrange @@ -207,7 +206,6 @@ public void LogsWhenMessageIsNotProvided() } [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))] - [ActiveIssue("https://github.com/dotnet/runtime/issues/91538", typeof(PlatformDetection), nameof(PlatformDetection.IsWasmThreadingSupported))] public void DoesNotLog_NewLine_WhenNoExceptionIsProvided() { // Arrange @@ -236,7 +234,6 @@ public void DoesNotLog_NewLine_WhenNoExceptionIsProvided() } [ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))] - [ActiveIssue("https://github.com/dotnet/runtime/issues/91538", typeof(PlatformDetection), nameof(PlatformDetection.IsWasmThreadingSupported))] [InlineData(null, 0)] [InlineData(null, 1)] [InlineData("missingFormatter", 0)] @@ -279,7 +276,6 @@ public void Options_FormatterNameNull_UsesDeprecatedProperties(string formatterN } [ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))] - [ActiveIssue("https://github.com/dotnet/runtime/issues/91538", typeof(PlatformDetection), nameof(PlatformDetection.IsWasmThreadingSupported))] [InlineData("Route with name 'Simple' was not found.")] public void Writes_NewLine_WhenExceptionIsProvided(string message) { @@ -304,7 +300,6 @@ public void Writes_NewLine_WhenExceptionIsProvided(string message) } [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))] - [ActiveIssue("https://github.com/dotnet/runtime/issues/91538", typeof(PlatformDetection), nameof(PlatformDetection.IsWasmThreadingSupported))] public void ThrowsException_WhenNoFormatterIsProvided() { // Arrange @@ -316,7 +311,6 @@ public void ThrowsException_WhenNoFormatterIsProvided() } [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))] - [ActiveIssue("https://github.com/dotnet/runtime/issues/91538", typeof(PlatformDetection), nameof(PlatformDetection.IsWasmThreadingSupported))] public void LogsWhenNullFilterGiven() { // Arrange @@ -338,7 +332,6 @@ public void LogsWhenNullFilterGiven() } [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))] - [ActiveIssue("https://github.com/dotnet/runtime/issues/91538", typeof(PlatformDetection), nameof(PlatformDetection.IsWasmThreadingSupported))] public void WriteCritical_LogsCorrectColors() { // Arrange @@ -360,7 +353,6 @@ public void WriteCritical_LogsCorrectColors() } [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))] - [ActiveIssue("https://github.com/dotnet/runtime/issues/91538", typeof(PlatformDetection), nameof(PlatformDetection.IsWasmThreadingSupported))] public void WriteError_LogsCorrectColors() { // Arrange @@ -382,7 +374,6 @@ public void WriteError_LogsCorrectColors() } [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))] - [ActiveIssue("https://github.com/dotnet/runtime/issues/91538", typeof(PlatformDetection), nameof(PlatformDetection.IsWasmThreadingSupported))] public void WriteWarning_LogsCorrectColors() { // Arrange @@ -404,7 +395,6 @@ public void WriteWarning_LogsCorrectColors() } [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))] - [ActiveIssue("https://github.com/dotnet/runtime/issues/91538", typeof(PlatformDetection), nameof(PlatformDetection.IsWasmThreadingSupported))] public void WriteInformation_LogsCorrectColors() { // Arrange @@ -456,7 +446,6 @@ public void AddConsole_IsOutputRedirected_ColorDisabled() } [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))] - [ActiveIssue("https://github.com/dotnet/runtime/issues/91538", typeof(PlatformDetection), nameof(PlatformDetection.IsWasmThreadingSupported))] public void WriteDebug_LogsCorrectColors() { // Arrange @@ -478,7 +467,6 @@ public void WriteDebug_LogsCorrectColors() } [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))] - [ActiveIssue("https://github.com/dotnet/runtime/issues/91538", typeof(PlatformDetection), nameof(PlatformDetection.IsWasmThreadingSupported))] public void WriteTrace_LogsCorrectColors() { // Arrange @@ -500,7 +488,6 @@ public void WriteTrace_LogsCorrectColors() } [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))] - [ActiveIssue("https://github.com/dotnet/runtime/issues/91538", typeof(PlatformDetection), nameof(PlatformDetection.IsWasmThreadingSupported))] public void WriteAllLevelsDisabledColors_LogsNoColors() { // Arrange @@ -525,7 +512,6 @@ public void WriteAllLevelsDisabledColors_LogsNoColors() } [ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))] - [ActiveIssue("https://github.com/dotnet/runtime/issues/91538", typeof(PlatformDetection), nameof(PlatformDetection.IsWasmThreadingSupported))] [MemberData(nameof(FormatsAndLevels))] public void Log_LogsCorrectTimestamp(ConsoleLoggerFormat format, LogLevel level) { @@ -567,7 +553,6 @@ public void Log_LogsCorrectTimestamp(ConsoleLoggerFormat format, LogLevel level) } [ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))] - [ActiveIssue("https://github.com/dotnet/runtime/issues/91538", typeof(PlatformDetection), nameof(PlatformDetection.IsWasmThreadingSupported))] [MemberData(nameof(FormatsAndLevels))] public void WriteCore_LogsCorrectTimestampInUtc(ConsoleLoggerFormat format, LogLevel level) { @@ -609,7 +594,6 @@ public void WriteCore_LogsCorrectTimestampInUtc(ConsoleLoggerFormat format, LogL } [ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))] - [ActiveIssue("https://github.com/dotnet/runtime/issues/91538", typeof(PlatformDetection), nameof(PlatformDetection.IsWasmThreadingSupported))] [MemberData(nameof(FormatsAndLevels))] public void WriteCore_LogsCorrectMessages(ConsoleLoggerFormat format, LogLevel level) { @@ -654,7 +638,6 @@ public void WriteCore_LogsCorrectMessages(ConsoleLoggerFormat format, LogLevel l } [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))] - [ActiveIssue("https://github.com/dotnet/runtime/issues/91538", typeof(PlatformDetection), nameof(PlatformDetection.IsWasmThreadingSupported))] public void NoLogScope_DoesNotWriteAnyScopeContentToOutput() { // Arrange @@ -676,7 +659,6 @@ public void NoLogScope_DoesNotWriteAnyScopeContentToOutput() } [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))] - [ActiveIssue("https://github.com/dotnet/runtime/issues/91538", typeof(PlatformDetection), nameof(PlatformDetection.IsWasmThreadingSupported))] public void WritingScopes_LogsWithCorrectColors() { // Arrange @@ -703,7 +685,6 @@ public void WritingScopes_LogsWithCorrectColors() } [ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))] - [ActiveIssue("https://github.com/dotnet/runtime/issues/91538", typeof(PlatformDetection), nameof(PlatformDetection.IsWasmThreadingSupported))] [MemberData(nameof(Formats))] public void WritingScopes_LogsExpectedMessage(ConsoleLoggerFormat format) { @@ -755,7 +736,6 @@ public void WritingScopes_LogsExpectedMessage(ConsoleLoggerFormat format) } [ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))] - [ActiveIssue("https://github.com/dotnet/runtime/issues/91538", typeof(PlatformDetection), nameof(PlatformDetection.IsWasmThreadingSupported))] [MemberData(nameof(Formats))] public void WritingNestedScope_LogsNullScopeName(ConsoleLoggerFormat format) { @@ -805,7 +785,6 @@ public void WritingNestedScope_LogsNullScopeName(ConsoleLoggerFormat format) } [ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))] - [ActiveIssue("https://github.com/dotnet/runtime/issues/91538", typeof(PlatformDetection), nameof(PlatformDetection.IsWasmThreadingSupported))] [MemberData(nameof(Formats))] public void WritingNestedScopes_LogsExpectedMessage(ConsoleLoggerFormat format) { @@ -864,7 +843,6 @@ public void WritingNestedScopes_LogsExpectedMessage(ConsoleLoggerFormat format) } [ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))] - [ActiveIssue("https://github.com/dotnet/runtime/issues/91538", typeof(PlatformDetection), nameof(PlatformDetection.IsWasmThreadingSupported))] [MemberData(nameof(Formats))] public void WritingMultipleScopes_LogsExpectedMessage(ConsoleLoggerFormat format) { @@ -934,7 +912,6 @@ public void WritingMultipleScopes_LogsExpectedMessage(ConsoleLoggerFormat format } [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))] - [ActiveIssue("https://github.com/dotnet/runtime/issues/91538", typeof(PlatformDetection), nameof(PlatformDetection.IsWasmThreadingSupported))] public void CallingBeginScopeOnLogger_AlwaysReturnsNewDisposableInstance() { // Arrange @@ -953,7 +930,6 @@ public void CallingBeginScopeOnLogger_AlwaysReturnsNewDisposableInstance() } [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))] - [ActiveIssue("https://github.com/dotnet/runtime/issues/91538", typeof(PlatformDetection), nameof(PlatformDetection.IsWasmThreadingSupported))] public void CallingBeginScopeOnLogger_ReturnsNonNullableInstance() { // Arrange @@ -969,7 +945,6 @@ public void CallingBeginScopeOnLogger_ReturnsNonNullableInstance() } [ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))] - [ActiveIssue("https://github.com/dotnet/runtime/issues/91538", typeof(PlatformDetection), nameof(PlatformDetection.IsWasmThreadingSupported))] [MemberData(nameof(Formats))] public void ConsoleLoggerLogsToError_WhenOverErrorLevel(ConsoleLoggerFormat format) { @@ -1020,7 +995,6 @@ public void ConsoleLoggerLogsToError_WhenOverErrorLevel(ConsoleLoggerFormat form } [ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))] - [ActiveIssue("https://github.com/dotnet/runtime/issues/91538", typeof(PlatformDetection), nameof(PlatformDetection.IsWasmThreadingSupported))] [MemberData(nameof(FormatsAndLevels))] public void WriteCore_NullMessageWithException(ConsoleLoggerFormat format, LogLevel level) { @@ -1065,7 +1039,6 @@ public void WriteCore_NullMessageWithException(ConsoleLoggerFormat format, LogLe } [ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))] - [ActiveIssue("https://github.com/dotnet/runtime/issues/91538", typeof(PlatformDetection), nameof(PlatformDetection.IsWasmThreadingSupported))] [MemberData(nameof(FormatsAndLevels))] public void WriteCore_EmptyMessageWithException(ConsoleLoggerFormat format, LogLevel level) { @@ -1109,7 +1082,6 @@ public void WriteCore_EmptyMessageWithException(ConsoleLoggerFormat format, LogL } [ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))] - [ActiveIssue("https://github.com/dotnet/runtime/issues/91538", typeof(PlatformDetection), nameof(PlatformDetection.IsWasmThreadingSupported))] [MemberData(nameof(FormatsAndLevels))] public void WriteCore_MessageWithNullException(ConsoleLoggerFormat format, LogLevel level) { @@ -1150,7 +1122,6 @@ public void WriteCore_MessageWithNullException(ConsoleLoggerFormat format, LogLe } [ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))] - [ActiveIssue("https://github.com/dotnet/runtime/issues/91538", typeof(PlatformDetection), nameof(PlatformDetection.IsWasmThreadingSupported))] [MemberData(nameof(Levels))] public void WriteCore_NullMessageWithNullException(LogLevel level) { @@ -1169,7 +1140,6 @@ public void WriteCore_NullMessageWithNullException(LogLevel level) } [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))] - [ActiveIssue("https://github.com/dotnet/runtime/issues/91538", typeof(PlatformDetection), nameof(PlatformDetection.IsWasmThreadingSupported))] public static void IsEnabledReturnsCorrectValue() { var logger = SetUp().Logger; @@ -1184,7 +1154,6 @@ public static void IsEnabledReturnsCorrectValue() } [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))] - [ActiveIssue("https://github.com/dotnet/runtime/issues/91538", typeof(PlatformDetection), nameof(PlatformDetection.IsWasmThreadingSupported))] public void ConsoleLoggerOptions_DisableColors_IsAppliedToLoggers() { // Arrange @@ -1219,7 +1188,6 @@ public void ConsoleLoggerOptions_SetInvalidBufferMode_Throws() } [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))] - [ActiveIssue("https://github.com/dotnet/runtime/issues/91538", typeof(PlatformDetection), nameof(PlatformDetection.IsWasmThreadingSupported))] public void ConsoleLoggerOptions_DisableColors_IsReadFromLoggingConfiguration() { var configuration = new ConfigurationBuilder().AddInMemoryCollection(new[] { new KeyValuePair("Console:DisableColors", "true") }).Build(); @@ -1237,7 +1205,6 @@ public void ConsoleLoggerOptions_DisableColors_IsReadFromLoggingConfiguration() } [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))] - [ActiveIssue("https://github.com/dotnet/runtime/issues/91538", typeof(PlatformDetection), nameof(PlatformDetection.IsWasmThreadingSupported))] public void ConsoleLoggerOptions_TimeStampFormat_IsReloaded() { // Arrange @@ -1252,7 +1219,6 @@ public void ConsoleLoggerOptions_TimeStampFormat_IsReloaded() } [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))] - [ActiveIssue("https://github.com/dotnet/runtime/issues/91538", typeof(PlatformDetection), nameof(PlatformDetection.IsWasmThreadingSupported))] public void ConsoleLoggerOptions_TimeStampFormat_IsReadFromLoggingConfiguration() { var configuration = new ConfigurationBuilder().AddInMemoryCollection(new[] { new KeyValuePair("Console:TimeStampFormat", "yyyyMMddHHmmss") }).Build(); @@ -1270,7 +1236,6 @@ public void ConsoleLoggerOptions_TimeStampFormat_IsReadFromLoggingConfiguration( } [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))] - [ActiveIssue("https://github.com/dotnet/runtime/issues/91538", typeof(PlatformDetection), nameof(PlatformDetection.IsWasmThreadingSupported))] public void ConsoleLoggerOptions_TimeStampFormat_MultipleReloads() { var monitor = new TestOptionsMonitor(new ConsoleLoggerOptions()); @@ -1285,7 +1250,6 @@ public void ConsoleLoggerOptions_TimeStampFormat_MultipleReloads() } [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))] - [ActiveIssue("https://github.com/dotnet/runtime/issues/91538", typeof(PlatformDetection), nameof(PlatformDetection.IsWasmThreadingSupported))] public void ConsoleLoggerOptions_IncludeScopes_IsAppliedToLoggers() { // Arrange @@ -1300,7 +1264,6 @@ public void ConsoleLoggerOptions_IncludeScopes_IsAppliedToLoggers() } [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))] - [ActiveIssue("https://github.com/dotnet/runtime/issues/91538", typeof(PlatformDetection), nameof(PlatformDetection.IsWasmThreadingSupported))] public void ConsoleLoggerOptions_LogAsErrorLevel_IsReadFromLoggingConfiguration() { var configuration = new ConfigurationBuilder().AddInMemoryCollection(new[] { new KeyValuePair("Console:LogToStandardErrorThreshold", "Warning") }).Build(); @@ -1318,7 +1281,6 @@ public void ConsoleLoggerOptions_LogAsErrorLevel_IsReadFromLoggingConfiguration( } [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))] - [ActiveIssue("https://github.com/dotnet/runtime/issues/91538", typeof(PlatformDetection), nameof(PlatformDetection.IsWasmThreadingSupported))] public void ConsoleLoggerOptions_LogAsErrorLevel_IsAppliedToLoggers() { // Arrange @@ -1333,7 +1295,6 @@ public void ConsoleLoggerOptions_LogAsErrorLevel_IsAppliedToLoggers() } [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))] - [ActiveIssue("https://github.com/dotnet/runtime/issues/91538", typeof(PlatformDetection), nameof(PlatformDetection.IsWasmThreadingSupported))] public void ConsoleLoggerOptions_UpdateQueueOptions_UpdatesConsoleLoggerProcessorProperties() { // Arrange @@ -1353,7 +1314,6 @@ public void ConsoleLoggerOptions_UpdateQueueOptions_UpdatesConsoleLoggerProcesso } [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))] - [ActiveIssue("https://github.com/dotnet/runtime/issues/91538", typeof(PlatformDetection), nameof(PlatformDetection.IsWasmThreadingSupported))] public void ConsoleLoggerOptions_UseUtcTimestamp_IsAppliedToLoggers() { // Arrange @@ -1368,7 +1328,6 @@ public void ConsoleLoggerOptions_UseUtcTimestamp_IsAppliedToLoggers() } [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))] - [ActiveIssue("https://github.com/dotnet/runtime/issues/91538", typeof(PlatformDetection), nameof(PlatformDetection.IsWasmThreadingSupported))] public void ConsoleLoggerOptions_IncludeScopes_IsReadFromLoggingConfiguration() { var configuration = new ConfigurationBuilder().AddInMemoryCollection(new[] { new KeyValuePair("Console:IncludeScopes", "true") }).Build(); diff --git a/src/libraries/Microsoft.Extensions.Logging.Console/tests/Microsoft.Extensions.Logging.Console.Tests/SimpleConsoleFormatterTests.cs b/src/libraries/Microsoft.Extensions.Logging.Console/tests/Microsoft.Extensions.Logging.Console.Tests/SimpleConsoleFormatterTests.cs index 26bd40775bb371..3bb1fa491ecea0 100644 --- a/src/libraries/Microsoft.Extensions.Logging.Console/tests/Microsoft.Extensions.Logging.Console.Tests/SimpleConsoleFormatterTests.cs +++ b/src/libraries/Microsoft.Extensions.Logging.Console/tests/Microsoft.Extensions.Logging.Console.Tests/SimpleConsoleFormatterTests.cs @@ -10,7 +10,6 @@ namespace Microsoft.Extensions.Logging.Console.Test public class SimpleConsoleFormatterTests : ConsoleFormatterTests { [ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))] - [ActiveIssue("https://github.com/dotnet/runtime/issues/91538", typeof(PlatformDetection), nameof(PlatformDetection.IsWasmThreadingSupported))] [InlineData(LoggerColorBehavior.Default)] [InlineData(LoggerColorBehavior.Enabled)] [InlineData(LoggerColorBehavior.Disabled)] @@ -55,7 +54,6 @@ public void Log_WritingScopes_LogsWithCorrectColorsWhenColorEnabled(LoggerColorB } [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))] - [ActiveIssue("https://github.com/dotnet/runtime/issues/91538", typeof(PlatformDetection), nameof(PlatformDetection.IsWasmThreadingSupported))] public void Log_NoLogScope_DoesNotWriteAnyScopeContentToOutput() { // Arrange @@ -111,7 +109,6 @@ public void Log_SingleLine_LogsWhenMessageIsNotProvided() } [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))] - [ActiveIssue("https://github.com/dotnet/runtime/issues/91538", typeof(PlatformDetection), nameof(PlatformDetection.IsWasmThreadingSupported))] public void Log_SingleLine_LogsWhenBothMessageAndExceptionProvided() { // Arrange diff --git a/src/libraries/System.Collections.Concurrent/tests/ProducerConsumerCollectionTests.cs b/src/libraries/System.Collections.Concurrent/tests/ProducerConsumerCollectionTests.cs index f7a9c219aceb56..7aae42fcae3eca 100644 --- a/src/libraries/System.Collections.Concurrent/tests/ProducerConsumerCollectionTests.cs +++ b/src/libraries/System.Collections.Concurrent/tests/ProducerConsumerCollectionTests.cs @@ -483,7 +483,6 @@ public void ICollectionCopyTo_InvalidArgs_Throws() [ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))] [InlineData(100, 1, 10)] [InlineData(4, 100000, 10)] - [ActiveIssue("https://github.com/dotnet/runtime/issues/91538", typeof(PlatformDetection), nameof(PlatformDetection.IsWasmThreadingSupported))] public void BlockingCollection_WrappingCollection_ExpectedElementsTransferred(int numThreadsPerConsumerProducer, int numItemsPerThread, int producerSpin) { var bc = new BlockingCollection(CreateProducerConsumerCollection()); diff --git a/src/libraries/System.IO.Pipelines/tests/PipeWriterTests.cs b/src/libraries/System.IO.Pipelines/tests/PipeWriterTests.cs index 2913efbe3cdf6c..85070e1534a8ee 100644 --- a/src/libraries/System.IO.Pipelines/tests/PipeWriterTests.cs +++ b/src/libraries/System.IO.Pipelines/tests/PipeWriterTests.cs @@ -294,7 +294,6 @@ public async Task WritesUsingGetMemoryWorks() } [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))] - [ActiveIssue("https://github.com/dotnet/runtime/issues/91547", typeof(PlatformDetection), nameof(PlatformDetection.IsWasmThreadingSupported))] public async Task CompleteWithLargeWriteThrows() { var completeDelay = TimeSpan.FromMilliseconds(10); diff --git a/src/libraries/System.Linq.Parallel/tests/ExchangeTests.cs b/src/libraries/System.Linq.Parallel/tests/ExchangeTests.cs index 5c36f46c5d2073..6dcaffbf60a5a5 100644 --- a/src/libraries/System.Linq.Parallel/tests/ExchangeTests.cs +++ b/src/libraries/System.Linq.Parallel/tests/ExchangeTests.cs @@ -90,7 +90,6 @@ public static IEnumerable AllMergeOptions_Multiple() [ConditionalTheory] [MemberData(nameof(PartitioningData), new[] { 0, 1, 2, 16, 1024 })] - [ActiveIssue("https://github.com/dotnet/runtime/issues/91541", typeof(PlatformDetection), nameof(PlatformDetection.IsWasmThreadingSupported))] public static void Partitioning_Default(Labeled> labeled, int count, int partitions) { if (partitions > 1 && !PlatformDetection.IsThreadingSupported) diff --git a/src/libraries/System.Private.Xml/tests/XmlReader/Tests/AsyncReaderLateInitTests.cs b/src/libraries/System.Private.Xml/tests/XmlReader/Tests/AsyncReaderLateInitTests.cs index 05fd83798861d7..85f2fd9fdf7f10 100644 --- a/src/libraries/System.Private.Xml/tests/XmlReader/Tests/AsyncReaderLateInitTests.cs +++ b/src/libraries/System.Private.Xml/tests/XmlReader/Tests/AsyncReaderLateInitTests.cs @@ -69,7 +69,6 @@ public static void ReadAfterInitializationWithTextReaderOnAsyncReaderDoesNotThro } [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))] - [ActiveIssue("https://github.com/dotnet/runtime/issues/91541", typeof(PlatformDetection), nameof(PlatformDetection.IsWasmThreadingSupported))] public static void ReadAsyncAfterInitializationWithUriThrows() { using (XmlReader reader = XmlReader.Create("http://test.test/test.html", new XmlReaderSettings() { Async = true })) @@ -79,7 +78,6 @@ public static void ReadAsyncAfterInitializationWithUriThrows() } [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))] - [ActiveIssue("https://github.com/dotnet/runtime/issues/91541", typeof(PlatformDetection), nameof(PlatformDetection.IsWasmThreadingSupported))] public static void ReadAfterInitializationWithUriOnAsyncReaderTrows() { using (XmlReader reader = XmlReader.Create("http://test.test/test.html", new XmlReaderSettings() { Async = true })) @@ -89,7 +87,6 @@ public static void ReadAfterInitializationWithUriOnAsyncReaderTrows() } [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))] - [ActiveIssue("https://github.com/dotnet/runtime/issues/91541", typeof(PlatformDetection), nameof(PlatformDetection.IsWasmThreadingSupported))] public static void InitializationWithUriOnNonAsyncReaderThrows() { Assert.Throws(() => XmlReader.Create("http://test.test/test.html", new XmlReaderSettings() { Async = false })); diff --git a/src/libraries/System.Private.Xml/tests/XmlSchema/XmlSchemaValidatorApi/ValidateMisc.cs b/src/libraries/System.Private.Xml/tests/XmlSchema/XmlSchemaValidatorApi/ValidateMisc.cs index c594669aaaec60..1e9fb3a25599a9 100644 --- a/src/libraries/System.Private.Xml/tests/XmlSchema/XmlSchemaValidatorApi/ValidateMisc.cs +++ b/src/libraries/System.Private.Xml/tests/XmlSchema/XmlSchemaValidatorApi/ValidateMisc.cs @@ -419,7 +419,6 @@ public TCValidateAfterAddInvalidSchema(ITestOutputHelper output) : base(output) [InlineData("SCHEMA", "schB1_a.xsd", 1, 3, 3)] [InlineData("SCHEMA", "schM2_a.xsd", 1, 3, 3)] [InlineData("SCHEMA", "schH2_a.xsd", 1, 3, 3)] - [ActiveIssue("https://github.com/dotnet/runtime/issues/75132", typeof(PlatformDetection), nameof(PlatformDetection.IsWasmThreadingSupported))] public void AddValid_Import_Include_Redefine(string testDir, string testFile, int expCount, int expCountGT, int expCountGE) { string xsd = Path.Combine(path, testDir, testFile); diff --git a/src/libraries/System.Runtime/tests/System.Runtime.Extensions.Tests/System/Random.cs b/src/libraries/System.Runtime/tests/System.Runtime.Extensions.Tests/System/Random.cs index 648a85ae8fc2cf..16c3a9a2353b7e 100644 --- a/src/libraries/System.Runtime/tests/System.Runtime.Extensions.Tests/System/Random.cs +++ b/src/libraries/System.Runtime/tests/System.Runtime.Extensions.Tests/System/Random.cs @@ -516,7 +516,6 @@ public void Shared_IsSingleton() } [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))] - [ActiveIssue("https://github.com/dotnet/runtime/issues/91538", typeof(PlatformDetection), nameof(PlatformDetection.IsWasmThreadingSupported))] public void Shared_ParallelUsage() { using var barrier = new Barrier(2); diff --git a/src/libraries/System.Runtime/tests/System.Threading.Tasks.Tests/CancellationTokenTests.cs b/src/libraries/System.Runtime/tests/System.Threading.Tasks.Tests/CancellationTokenTests.cs index 5759199752ad66..72df26fa4c9886 100644 --- a/src/libraries/System.Runtime/tests/System.Threading.Tasks.Tests/CancellationTokenTests.cs +++ b/src/libraries/System.Runtime/tests/System.Threading.Tasks.Tests/CancellationTokenTests.cs @@ -874,7 +874,6 @@ static void FinalizeHelper(DisposeTracker disposeTracker) // Several tests for deriving custom user types from CancellationTokenSource [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))] - [ActiveIssue("https://github.com/dotnet/runtime/issues/94486", typeof(PlatformDetection), nameof(PlatformDetection.IsWasmThreadingSupported))] public static void DerivedCancellationTokenSource() { // Verify that a derived CTS is functional diff --git a/src/libraries/System.Runtime/tests/System.Threading.Tasks.Tests/MethodCoverage.cs b/src/libraries/System.Runtime/tests/System.Threading.Tasks.Tests/MethodCoverage.cs index 88ec6cdca29481..923875f6e43cee 100644 --- a/src/libraries/System.Runtime/tests/System.Threading.Tasks.Tests/MethodCoverage.cs +++ b/src/libraries/System.Runtime/tests/System.Threading.Tasks.Tests/MethodCoverage.cs @@ -279,7 +279,6 @@ public static async Task Task_WhenAny_TwoTasks_WakesOnFirstCompletion() } [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))] - [ActiveIssue("https://github.com/dotnet/runtime/issues/91541", typeof(PlatformDetection), nameof(PlatformDetection.IsWasmThreadingSupported))] public static void CancellationTokenRegitration() { ManualResetEvent mre = new ManualResetEvent(false); @@ -297,7 +296,6 @@ public static void CancellationTokenRegitration() /// verify that the taskawaiter.UnsafeOnCompleted is invoked /// [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))] - [ActiveIssue("https://github.com/dotnet/runtime/issues/91541", typeof(PlatformDetection), nameof(PlatformDetection.IsWasmThreadingSupported))] public static void TaskAwaiter() { ManualResetEvent mre = new ManualResetEvent(false); diff --git a/src/libraries/System.Runtime/tests/System.Threading.Tasks.Tests/Task/AsyncEnumerableToBlockingEnumerableTests.cs b/src/libraries/System.Runtime/tests/System.Threading.Tasks.Tests/Task/AsyncEnumerableToBlockingEnumerableTests.cs index 7f7aca4a8611fb..0692aedb514f9e 100644 --- a/src/libraries/System.Runtime/tests/System.Threading.Tasks.Tests/Task/AsyncEnumerableToBlockingEnumerableTests.cs +++ b/src/libraries/System.Runtime/tests/System.Threading.Tasks.Tests/Task/AsyncEnumerableToBlockingEnumerableTests.cs @@ -70,7 +70,6 @@ static async IAsyncEnumerable CreateSourceEnumerable() } [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))] - [ActiveIssue("https://github.com/dotnet/runtime/issues/91538", typeof(PlatformDetection), nameof(PlatformDetection.IsWasmThreadingSupported))] public static void AsyncEnumerableWithDelays() { var source = new InstrumentedAsyncEnumerable(CreateSourceEnumerable()); @@ -105,7 +104,6 @@ static async IAsyncEnumerable CreateSourceEnumerable() } [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))] - [ActiveIssue("https://github.com/dotnet/runtime/issues/91538", typeof(PlatformDetection), nameof(PlatformDetection.IsWasmThreadingSupported))] public static void AsyncEnumerableWithException() { var source = new InstrumentedAsyncEnumerable(CreateSourceEnumerable()); @@ -134,7 +132,6 @@ static async IAsyncEnumerable CreateSourceEnumerable() } [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))] - [ActiveIssue("https://github.com/dotnet/runtime/issues/91538", typeof(PlatformDetection), nameof(PlatformDetection.IsWasmThreadingSupported))] public static void AsyncEnumerableWithCancellation() { var source = new InstrumentedAsyncEnumerable(CreateSourceEnumerable()); diff --git a/src/libraries/System.Runtime/tests/System.Threading.Tasks.Tests/Task/TaskContinueWithTests.cs b/src/libraries/System.Runtime/tests/System.Threading.Tasks.Tests/Task/TaskContinueWithTests.cs index af2b79e07b2c3a..b426a576d982be 100644 --- a/src/libraries/System.Runtime/tests/System.Threading.Tasks.Tests/Task/TaskContinueWithTests.cs +++ b/src/libraries/System.Runtime/tests/System.Threading.Tasks.Tests/Task/TaskContinueWithTests.cs @@ -1255,7 +1255,6 @@ public static void LongContinuationChain_Unwrap_DoesNotStackOverflow() } [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))] - [ActiveIssue("https://github.com/dotnet/runtime/issues/91541", typeof(PlatformDetection), nameof(PlatformDetection.IsWasmThreadingSupported))] public static void LongContinuationChain_Await_DoesNotStackOverflow() { const int DiveDepth = 12_000; diff --git a/src/libraries/System.Threading.Tasks.Parallel/tests/ParallelForTests.cs b/src/libraries/System.Threading.Tasks.Parallel/tests/ParallelForTests.cs index 0c740c8b0ee706..399ba8c63f5e27 100644 --- a/src/libraries/System.Threading.Tasks.Parallel/tests/ParallelForTests.cs +++ b/src/libraries/System.Threading.Tasks.Parallel/tests/ParallelForTests.cs @@ -885,7 +885,6 @@ public static void TestParallelForPaths_Exceptions() } [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))] - [ActiveIssue("https://github.com/dotnet/runtime/issues/91582", typeof(PlatformDetection), nameof(PlatformDetection.IsWasmThreadingSupported))] public static void TestParallelScheduler() { ParallelOptions parallelOptions = new ParallelOptions(); @@ -993,7 +992,6 @@ public static void TestParallelScheduler() } [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))] - [ActiveIssue("https://github.com/dotnet/runtime/issues/91541", typeof(PlatformDetection), nameof(PlatformDetection.IsWasmThreadingSupported))] public static void TestInvokeDOPAndCancel() { ParallelOptions parallelOptions = null; diff --git a/src/libraries/System.Threading.Tasks.Parallel/tests/ParallelLoopResultTests.cs b/src/libraries/System.Threading.Tasks.Parallel/tests/ParallelLoopResultTests.cs index 9006ee9469fc6e..430eabdfa01bb7 100644 --- a/src/libraries/System.Threading.Tasks.Parallel/tests/ParallelLoopResultTests.cs +++ b/src/libraries/System.Threading.Tasks.Parallel/tests/ParallelLoopResultTests.cs @@ -373,7 +373,6 @@ private static void OrderablePartitionerForEachPLRTest( // Perform tests on various combinations of Stop()/Break() [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))] - [ActiveIssue("https://github.com/dotnet/runtime/issues/91579", typeof(PlatformDetection), nameof(PlatformDetection.IsWasmThreadingSupported))] public static void SimultaneousStopBreakTests() { // diff --git a/src/libraries/System.Threading.Tasks.Parallel/tests/RangePartitioner1Chunk.cs b/src/libraries/System.Threading.Tasks.Parallel/tests/RangePartitioner1Chunk.cs index 02695b75242409..b7eece1c2de61d 100644 --- a/src/libraries/System.Threading.Tasks.Parallel/tests/RangePartitioner1Chunk.cs +++ b/src/libraries/System.Threading.Tasks.Parallel/tests/RangePartitioner1Chunk.cs @@ -101,7 +101,6 @@ static void oneMoveNext(int length, bool isOrderable) /// /// [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))] - [ActiveIssue("https://github.com/dotnet/runtime/issues/91541", typeof(PlatformDetection), nameof(PlatformDetection.IsWasmThreadingSupported))] public static void IterationsWithDependency() { static void iterationsWithDependency(int length, int dependencyIndex) @@ -167,7 +166,6 @@ public static void PFEDisposeEnum() /// Exception is expected and the enumerators are disposed /// [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))] - [ActiveIssue("https://github.com/dotnet/runtime/issues/91581", typeof(PlatformDetection), nameof(PlatformDetection.IsWasmThreadingSupported))] public static void ExceptionOnMoveNext() { static void exceptionOnMoveNext(int length, int indexToThrow, bool isOrderable) diff --git a/src/libraries/System.Threading.Tasks.Parallel/tests/RangePartitionerTests.cs b/src/libraries/System.Threading.Tasks.Parallel/tests/RangePartitionerTests.cs index 3302c9b3b73831..87e427d0837ece 100644 --- a/src/libraries/System.Threading.Tasks.Parallel/tests/RangePartitionerTests.cs +++ b/src/libraries/System.Threading.Tasks.Parallel/tests/RangePartitionerTests.cs @@ -10,7 +10,6 @@ namespace System.Threading.Tasks.Tests public static class RangePartitionerTests { [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))] - [ActiveIssue("https://github.com/dotnet/runtime/issues/91541", typeof(PlatformDetection), nameof(PlatformDetection.IsWasmThreadingSupported))] public static void RunPartitionerStaticTest_SingleChunking() { CountdownEvent cde = new CountdownEvent(2); diff --git a/src/libraries/System.Threading/tests/MutexTests.cs b/src/libraries/System.Threading/tests/MutexTests.cs index ab2527db0f16df..6b06baeb760344 100644 --- a/src/libraries/System.Threading/tests/MutexTests.cs +++ b/src/libraries/System.Threading/tests/MutexTests.cs @@ -421,7 +421,6 @@ public static IEnumerable AbandonExisting_MemberData() } [ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))] - [ActiveIssue("https://github.com/dotnet/runtime/issues/91547", typeof(PlatformDetection), nameof(PlatformDetection.IsWasmThreadingSupported))] [MemberData(nameof(AbandonExisting_MemberData))] public void AbandonExisting( string name, diff --git a/src/libraries/System.Threading/tests/SemaphoreSlimTests.cs b/src/libraries/System.Threading/tests/SemaphoreSlimTests.cs index 4c2c5cc53a5249..7aabd01c39f1e2 100644 --- a/src/libraries/System.Threading/tests/SemaphoreSlimTests.cs +++ b/src/libraries/System.Threading/tests/SemaphoreSlimTests.cs @@ -72,7 +72,6 @@ public static void RunSemaphoreSlimTest1_Wait_NegativeCases() } [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))] - [ActiveIssue("https://github.com/dotnet/runtime/issues/91541", typeof(PlatformDetection), nameof(PlatformDetection.IsWasmThreadingSupported))] public static void RunSemaphoreSlimTest1_WaitAsync() { // Infinite timeout @@ -91,7 +90,6 @@ public static void RunSemaphoreSlimTest1_WaitAsync() } [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))] - [ActiveIssue("https://github.com/dotnet/runtime/issues/91541", typeof(PlatformDetection), nameof(PlatformDetection.IsWasmThreadingSupported))] public static void RunSemaphoreSlimTest1_WaitAsync_NegativeCases() { // Invalid timeout @@ -464,7 +462,6 @@ private static void RunSemaphoreSlimTest7_AvailableWaitHandle_Helper(int initial /// The final semaphore count /// True if the test succeeded, false otherwise [ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))] - [ActiveIssue("https://github.com/dotnet/runtime/issues/91538", typeof(PlatformDetection), nameof(PlatformDetection.IsWasmThreadingSupported))] [InlineData(5, 1000, 50, 50, 50, 0, 5, 1000)] [InlineData(0, 1000, 50, 25, 25, 25, 0, 500)] [InlineData(0, 1000, 50, 0, 0, 50, 0, 100)] @@ -531,7 +528,6 @@ public static void RunSemaphoreSlimTest8_ConcWaitAndRelease(int initial, int max /// The final semaphore count /// True if the test succeeded, false otherwise [ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))] - [ActiveIssue("https://github.com/dotnet/runtime/issues/91541", typeof(PlatformDetection), nameof(PlatformDetection.IsWasmThreadingSupported))] [InlineData(5, 1000, 50, 50, 50, 0, 5, 500)] [InlineData(0, 1000, 50, 25, 25, 25, 0, 500)] [InlineData(0, 1000, 50, 0, 0, 50, 0, 100)] From 5f1c43f280a6a3c14f2dd25179ce69b652850407 Mon Sep 17 00:00:00 2001 From: pavelsavara Date: Sun, 21 Jan 2024 11:53:55 +0100 Subject: [PATCH 02/25] tests --- src/libraries/tests.proj | 9 --------- 1 file changed, 9 deletions(-) diff --git a/src/libraries/tests.proj b/src/libraries/tests.proj index 2595b93e91b4b8..773b4ff58851c0 100644 --- a/src/libraries/tests.proj +++ b/src/libraries/tests.proj @@ -391,10 +391,6 @@ - - - - @@ -601,14 +597,9 @@ - - + $(WasmXHarnessMonoArgs) --setenv=XHARNESS_LOG_TEST_START=true + diff --git a/src/libraries/System.Threading.Tasks.Parallel/tests/System.Threading.Tasks.Parallel.Tests.csproj b/src/libraries/System.Threading.Tasks.Parallel/tests/System.Threading.Tasks.Parallel.Tests.csproj index 4be608cc6847ac..b9a8c7825067a0 100644 --- a/src/libraries/System.Threading.Tasks.Parallel/tests/System.Threading.Tasks.Parallel.Tests.csproj +++ b/src/libraries/System.Threading.Tasks.Parallel/tests/System.Threading.Tasks.Parallel.Tests.csproj @@ -6,6 +6,10 @@ + + + $(WasmXHarnessMonoArgs) --setenv=XHARNESS_LOG_TEST_START=true + From c3beb352d9923ff8c08036079d8935e0b24e87ff Mon Sep 17 00:00:00 2001 From: pavelsavara Date: Sun, 21 Jan 2024 18:02:49 +0100 Subject: [PATCH 04/25] cancel hanging JSWebWorker --- .../InteropServices/JavaScript/WebWorkerTest.cs | 2 ++ .../browser/runtime/pthreads/browser/index.ts | 9 +++++++++ .../pthreads/shared/emscripten-internals.ts | 9 ++++++--- src/mono/browser/runtime/startup.ts | 17 +++++++++++++---- 4 files changed, 30 insertions(+), 7 deletions(-) diff --git a/src/libraries/System.Runtime.InteropServices.JavaScript/tests/System.Runtime.InteropServices.JavaScript.UnitTests/System/Runtime/InteropServices/JavaScript/WebWorkerTest.cs b/src/libraries/System.Runtime.InteropServices.JavaScript/tests/System.Runtime.InteropServices.JavaScript.UnitTests/System/Runtime/InteropServices/JavaScript/WebWorkerTest.cs index 6b107f4b5b1c95..9e364a1400212c 100644 --- a/src/libraries/System.Runtime.InteropServices.JavaScript/tests/System.Runtime.InteropServices.JavaScript.UnitTests/System/Runtime/InteropServices/JavaScript/WebWorkerTest.cs +++ b/src/libraries/System.Runtime.InteropServices.JavaScript/tests/System.Runtime.InteropServices.JavaScript.UnitTests/System/Runtime/InteropServices/JavaScript/WebWorkerTest.cs @@ -248,6 +248,7 @@ public async Task JSSynchronizationContext_Send_Post_To_Canceled() } [Fact] + // this will say something like `JSSynchronizationContext is still installed on worker 0x4ff0030.` in the console during shutdown. public async Task JSWebWorker_Abandon_Running() { var cts = new CancellationTokenSource(); @@ -273,6 +274,7 @@ public async Task JSWebWorker_Abandon_Running() } [Fact] + // this will say something like `JSSynchronizationContext is still installed on worker 0x4ff0030.` in the console during shutdown. public async Task JSWebWorker_Abandon_Running_JS() { var cts = new CancellationTokenSource(); diff --git a/src/mono/browser/runtime/pthreads/browser/index.ts b/src/mono/browser/runtime/pthreads/browser/index.ts index 2ff00afe4eda9f..a50bab785afc18 100644 --- a/src/mono/browser/runtime/pthreads/browser/index.ts +++ b/src/mono/browser/runtime/pthreads/browser/index.ts @@ -165,3 +165,12 @@ export async function instantiateWasmPThreadWorkerPool(): Promise { await Promise.all(promises); } } + +export function cancelThreads() { + const workers: PThreadWorker[] = Internals.getRunningWorkers(); + for (const worker of workers) { + if (worker.interopInstalled) { + worker.postMessage({ cmd: "cancel" }); + } + } +} \ No newline at end of file diff --git a/src/mono/browser/runtime/pthreads/shared/emscripten-internals.ts b/src/mono/browser/runtime/pthreads/shared/emscripten-internals.ts index 0341a16ffc0c67..b7f9fe9935b99b 100644 --- a/src/mono/browser/runtime/pthreads/shared/emscripten-internals.ts +++ b/src/mono/browser/runtime/pthreads/shared/emscripten-internals.ts @@ -45,7 +45,7 @@ function isRunningPThreadWorker(w: Worker): w is PThreadWorker { } /// These utility functions dig into Emscripten internals -export const Internals = !MonoWasmThreads ? null as any : { +export const Internals = !MonoWasmThreads ? (null as any) : { get modulePThread(): PThreadLibrary { return (Module).PThread as PThreadLibrary; }, @@ -65,10 +65,13 @@ export const Internals = !MonoWasmThreads ? null as any : { /// It's called when the pool of workers is empty and a new thread is created. Internals.modulePThread.allocateUnusedWorker(); }, - getUnusedWorkerPool: (): Worker[] => { + getUnusedWorkerPool: (): PThreadWorker[] => { return Internals.modulePThread.unusedWorkers; }, - loadWasmModuleToWorker: (worker: Worker): Promise => { + getRunningWorkers: (): PThreadWorker[] => { + return Internals.modulePThread.runningWorkers; + }, + loadWasmModuleToWorker: (worker: PThreadWorker): Promise => { return Internals.modulePThread.loadWasmModuleToWorker(worker); } }; diff --git a/src/mono/browser/runtime/startup.ts b/src/mono/browser/runtime/startup.ts index 55088f67fe72a0..bda57615bfda64 100644 --- a/src/mono/browser/runtime/startup.ts +++ b/src/mono/browser/runtime/startup.ts @@ -25,9 +25,9 @@ import { interp_pgo_load_data, interp_pgo_save_data } from "./interp-pgo"; import { mono_log_debug, mono_log_error, mono_log_warn, mono_set_thread_name } from "./logging"; // threads -import { preAllocatePThreadWorkerPool, instantiateWasmPThreadWorkerPool } from "./pthreads/browser"; +import { preAllocatePThreadWorkerPool, instantiateWasmPThreadWorkerPool, cancelThreads } from "./pthreads/browser"; import { currentWorkerThreadEvents, dotnetPthreadCreated, initWorkerThreadEvents } from "./pthreads/worker"; -import { mono_wasm_main_thread_ptr } from "./pthreads/shared"; +import { mono_wasm_main_thread_ptr, mono_wasm_pthread_ptr } from "./pthreads/shared"; import { jiterpreter_allocate_tables } from "./jiterpreter-support"; import { localHeapViewU8 } from "./memory"; import { assertNoProxies } from "./gc-handles"; @@ -216,7 +216,10 @@ async function onRuntimeInitializedAsync(userOnRuntimeInitialized: () => void) { await runtimeHelpers.afterPreRun.promise; mono_log_debug("onRuntimeInitialized"); - runtimeHelpers.mono_wasm_exit = cwraps.mono_wasm_exit; + runtimeHelpers.mono_wasm_exit = !MonoWasmThreads ? cwraps.mono_wasm_exit : (code) => { + cancelThreads(); + cwraps.mono_wasm_exit(code); + }; runtimeHelpers.abort = (reason: any) => { loaderHelpers.exitReason = reason; if (!loaderHelpers.is_exited()) { @@ -344,7 +347,13 @@ async function postRunAsync(userpostRun: (() => void)[]) { } export function postRunWorker() { - assertNoProxies(); + if (runtimeHelpers.proxy_context_gc_handle) { + const pthread_ptr = mono_wasm_pthread_ptr(); + mono_log_warn(`JSSynchronizationContext is still installed on worker 0x${pthread_ptr.toString(16)}.`); + } else { + assertNoProxies(); + } + // signal next stage runtimeHelpers.runtimeReady = false; runtimeHelpers.afterPreRun = createPromiseController(); From eeab702586058fdfffe9971022fe5f302870f042 Mon Sep 17 00:00:00 2001 From: pavelsavara Date: Sun, 21 Jan 2024 20:19:33 +0100 Subject: [PATCH 05/25] wip --- .../browser/runtime/pthreads/shared/emscripten-internals.ts | 1 + .../runtime/pthreads/shared/emscripten-replacements.ts | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/mono/browser/runtime/pthreads/shared/emscripten-internals.ts b/src/mono/browser/runtime/pthreads/shared/emscripten-internals.ts index b7f9fe9935b99b..84d9fedb14c741 100644 --- a/src/mono/browser/runtime/pthreads/shared/emscripten-internals.ts +++ b/src/mono/browser/runtime/pthreads/shared/emscripten-internals.ts @@ -15,6 +15,7 @@ import MonoWasmThreads from "consts:monoWasmThreads"; // This is what we know about the Emscripten PThread library export interface PThreadLibrary { unusedWorkers: PThreadWorker[]; + runningWorkers: PThreadWorker[]; pthreads: PThreadInfoMap; allocateUnusedWorker: () => void; loadWasmModuleToWorker: (worker: Worker) => Promise; diff --git a/src/mono/browser/runtime/pthreads/shared/emscripten-replacements.ts b/src/mono/browser/runtime/pthreads/shared/emscripten-replacements.ts index 30e150df221339..c16f457ea177ec 100644 --- a/src/mono/browser/runtime/pthreads/shared/emscripten-replacements.ts +++ b/src/mono/browser/runtime/pthreads/shared/emscripten-replacements.ts @@ -62,7 +62,7 @@ function getNewWorker(modulePThread: PThreadLibrary): PThreadWorker { if (!MonoWasmThreads) return null as any; if (modulePThread.unusedWorkers.length == 0) { - mono_log_warn("Failed to find unused WebWorker, this may deadlock. Please increase the pthreadPoolSize."); + mono_log_warn(`Failed to find unused WebWorker, this may deadlock. Please increase the pthreadPoolSize. Running threads ${modulePThread.runningWorkers.length}. Loading workers: ${modulePThread.unusedWorkers.length}`); const worker = allocateUnusedWorker(); modulePThread.loadWasmModuleToWorker(worker); availableThreadCount--; @@ -83,7 +83,7 @@ function getNewWorker(modulePThread: PThreadLibrary): PThreadWorker { return worker; } } - mono_log_warn("Failed to find loaded WebWorker, this may deadlock. Please increase the pthreadPoolSize."); + mono_log_warn(`Failed to find unused WebWorker, this may deadlock. Please increase the pthreadPoolSize. Running threads ${modulePThread.runningWorkers.length}. Loading workers: ${modulePThread.unusedWorkers.length}`); availableThreadCount--; // negative value return modulePThread.unusedWorkers.pop()!; } From 16d766c856360fb7b2c7a2b247220d2b73506cd7 Mon Sep 17 00:00:00 2001 From: pavelsavara Date: Sun, 21 Jan 2024 20:19:44 +0100 Subject: [PATCH 06/25] wip --- .../tests/System.Runtime.Extensions.Tests/System/Random.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/libraries/System.Runtime/tests/System.Runtime.Extensions.Tests/System/Random.cs b/src/libraries/System.Runtime/tests/System.Runtime.Extensions.Tests/System/Random.cs index 16c3a9a2353b7e..648a85ae8fc2cf 100644 --- a/src/libraries/System.Runtime/tests/System.Runtime.Extensions.Tests/System/Random.cs +++ b/src/libraries/System.Runtime/tests/System.Runtime.Extensions.Tests/System/Random.cs @@ -516,6 +516,7 @@ public void Shared_IsSingleton() } [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))] + [ActiveIssue("https://github.com/dotnet/runtime/issues/91538", typeof(PlatformDetection), nameof(PlatformDetection.IsWasmThreadingSupported))] public void Shared_ParallelUsage() { using var barrier = new Barrier(2); From 0f3b4ddc456b1ef5becdf92131740dc1f2df9bfc Mon Sep 17 00:00:00 2001 From: pavelsavara Date: Sun, 21 Jan 2024 20:24:29 +0100 Subject: [PATCH 07/25] wip --- .../System/Runtime/InteropServices/JavaScript/WebWorkerTest.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libraries/System.Runtime.InteropServices.JavaScript/tests/System.Runtime.InteropServices.JavaScript.UnitTests/System/Runtime/InteropServices/JavaScript/WebWorkerTest.cs b/src/libraries/System.Runtime.InteropServices.JavaScript/tests/System.Runtime.InteropServices.JavaScript.UnitTests/System/Runtime/InteropServices/JavaScript/WebWorkerTest.cs index 9e364a1400212c..e546898e3adae2 100644 --- a/src/libraries/System.Runtime.InteropServices.JavaScript/tests/System.Runtime.InteropServices.JavaScript.UnitTests/System/Runtime/InteropServices/JavaScript/WebWorkerTest.cs +++ b/src/libraries/System.Runtime.InteropServices.JavaScript/tests/System.Runtime.InteropServices.JavaScript.UnitTests/System/Runtime/InteropServices/JavaScript/WebWorkerTest.cs @@ -652,7 +652,7 @@ await executor.Execute(async () => private Task HttpClient_ActionInDifferentThread(string url, Executor executor1, Executor executor2, Func e2Job) { - using var cts = CreateTestCaseTimeoutSource(); + var cts = CreateTestCaseTimeoutSource(); var e1Job = async (Task e2done, TaskCompletionSource e1State) => { From 9bc0e89bfb324e9671a39e04626dab15ee0d4edf Mon Sep 17 00:00:00 2001 From: pavelsavara Date: Mon, 22 Jan 2024 09:51:24 +0100 Subject: [PATCH 08/25] fix --- .../System/Runtime/InteropServices/JavaScript/WebWorkerTest.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libraries/System.Runtime.InteropServices.JavaScript/tests/System.Runtime.InteropServices.JavaScript.UnitTests/System/Runtime/InteropServices/JavaScript/WebWorkerTest.cs b/src/libraries/System.Runtime.InteropServices.JavaScript/tests/System.Runtime.InteropServices.JavaScript.UnitTests/System/Runtime/InteropServices/JavaScript/WebWorkerTest.cs index e546898e3adae2..46bbe496e6a350 100644 --- a/src/libraries/System.Runtime.InteropServices.JavaScript/tests/System.Runtime.InteropServices.JavaScript.UnitTests/System/Runtime/InteropServices/JavaScript/WebWorkerTest.cs +++ b/src/libraries/System.Runtime.InteropServices.JavaScript/tests/System.Runtime.InteropServices.JavaScript.UnitTests/System/Runtime/InteropServices/JavaScript/WebWorkerTest.cs @@ -560,7 +560,7 @@ await executor.Execute(async () => [Theory, MemberData(nameof(GetTargetThreads2x))] public Task WebSocketClient_ResponseCloseInDifferentThread(Executor executor1, Executor executor2) { - using var cts = CreateTestCaseTimeoutSource(); + var cts = CreateTestCaseTimeoutSource(); var uri = new Uri(WebWorkerTestHelper.LocalWsEcho + "?guid=" + Guid.NewGuid()); var message = "hello"; From d091d0449a2aaee06228a08824ae965edf1d8361 Mon Sep 17 00:00:00 2001 From: pavelsavara Date: Mon, 22 Jan 2024 10:53:42 +0100 Subject: [PATCH 09/25] fix --- .../System.Threading.Tasks.Parallel/tests/ParallelForTests.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/libraries/System.Threading.Tasks.Parallel/tests/ParallelForTests.cs b/src/libraries/System.Threading.Tasks.Parallel/tests/ParallelForTests.cs index 399ba8c63f5e27..1f00689ec73204 100644 --- a/src/libraries/System.Threading.Tasks.Parallel/tests/ParallelForTests.cs +++ b/src/libraries/System.Threading.Tasks.Parallel/tests/ParallelForTests.cs @@ -884,6 +884,7 @@ public static void TestParallelForPaths_Exceptions() Assert.Throws(() => Parallel.ForEach(mop, delegate (int item, ParallelLoopState state, long index) { })); } + [ActiveIssue("https://github.com/dotnet/runtime/issues/91582", typeof(PlatformDetection), nameof(PlatformDetection.IsWasmThreadingSupported))] [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))] public static void TestParallelScheduler() { From 66dea9a45d9ae47a2ca19f831e3bdc3397e1cac5 Mon Sep 17 00:00:00 2001 From: pavelsavara Date: Mon, 22 Jan 2024 11:53:56 +0100 Subject: [PATCH 10/25] wip --- .../JavaScript/WebWorkerTest.cs | 41 +++++++++++++++---- 1 file changed, 32 insertions(+), 9 deletions(-) diff --git a/src/libraries/System.Runtime.InteropServices.JavaScript/tests/System.Runtime.InteropServices.JavaScript.UnitTests/System/Runtime/InteropServices/JavaScript/WebWorkerTest.cs b/src/libraries/System.Runtime.InteropServices.JavaScript/tests/System.Runtime.InteropServices.JavaScript.UnitTests/System/Runtime/InteropServices/JavaScript/WebWorkerTest.cs index 46bbe496e6a350..03874be56be9ae 100644 --- a/src/libraries/System.Runtime.InteropServices.JavaScript/tests/System.Runtime.InteropServices.JavaScript.UnitTests/System/Runtime/InteropServices/JavaScript/WebWorkerTest.cs +++ b/src/libraries/System.Runtime.InteropServices.JavaScript/tests/System.Runtime.InteropServices.JavaScript.UnitTests/System/Runtime/InteropServices/JavaScript/WebWorkerTest.cs @@ -465,23 +465,37 @@ private async Task ActionsInDifferentThreads(Executor executor1, Executor exe { TaskCompletionSource readyTCS = new TaskCompletionSource(TaskCreationOptions.RunContinuationsAsynchronously); TaskCompletionSource doneTCS = new TaskCompletionSource(TaskCreationOptions.RunContinuationsAsynchronously); - + var e1Done = false; + var e2Done = false; var e1 = executor1.Execute(async () => { - await e1Job(doneTCS.Task, readyTCS); - if (!readyTCS.Task.IsCompleted) + try + { + await e1Job(doneTCS.Task, readyTCS); + if (!readyTCS.Task.IsCompleted) + { + readyTCS.SetResult(default); + } + await doneTCS.Task; + } + finally { - readyTCS.SetResult(default); + e1Done = true; } - await doneTCS.Task; }, cts.Token); var r1 = await readyTCS.Task.ConfigureAwait(true); var e2 = executor2.Execute(async () => { - await e2Job(r1); - + try + { + await e2Job(r1); + } + finally + { + e2Done = true; + } }, cts.Token); try @@ -490,9 +504,18 @@ private async Task ActionsInDifferentThreads(Executor executor1, Executor exe doneTCS.SetResult(); await e1; } - catch (Exception) + catch (Exception ex) { - cts.Cancel(); + if (ex is OperationCanceledException oce && cts.Token.IsCancellationRequested) + { + throw; + } + Console.WriteLine("ActionsInDifferentThreads failed with: \n" + ex); + if (!e1Done || !e2Done) + { + Console.WriteLine("ActionsInDifferentThreads canceling!"); + cts.Cancel(); + } throw; } } From ee574108a86f2fa9a89de1ae6862ea42b819efa4 Mon Sep 17 00:00:00 2001 From: pavelsavara Date: Mon, 22 Jan 2024 12:27:15 +0100 Subject: [PATCH 11/25] wip --- eng/pipelines/extra-platforms/runtime-extra-platforms-wasm.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/eng/pipelines/extra-platforms/runtime-extra-platforms-wasm.yml b/eng/pipelines/extra-platforms/runtime-extra-platforms-wasm.yml index 12981837609c36..6e9adb3aac7c5a 100644 --- a/eng/pipelines/extra-platforms/runtime-extra-platforms-wasm.yml +++ b/eng/pipelines/extra-platforms/runtime-extra-platforms-wasm.yml @@ -130,8 +130,6 @@ jobs: # Always run for runtime-wasm because tests are not run in runtime alwaysRun: ${{ parameters.isWasmOnlyBuild }} - # NOTE - Since threading is experimental, we don't want to block mainline work - shouldContinueOnError: true scenarios: - WasmTestOnBrowser #- WasmTestOnNodeJS - this is not supported yet, https://github.com/dotnet/runtime/issues/85592 From 3a7466a17771322c0dbb57df1426807d9f4e0e8e Mon Sep 17 00:00:00 2001 From: pavelsavara Date: Mon, 22 Jan 2024 12:35:20 +0100 Subject: [PATCH 12/25] wip --- .../browser/runtime/pthreads/shared/emscripten-replacements.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mono/browser/runtime/pthreads/shared/emscripten-replacements.ts b/src/mono/browser/runtime/pthreads/shared/emscripten-replacements.ts index c16f457ea177ec..a66daa72254b21 100644 --- a/src/mono/browser/runtime/pthreads/shared/emscripten-replacements.ts +++ b/src/mono/browser/runtime/pthreads/shared/emscripten-replacements.ts @@ -83,7 +83,7 @@ function getNewWorker(modulePThread: PThreadLibrary): PThreadWorker { return worker; } } - mono_log_warn(`Failed to find unused WebWorker, this may deadlock. Please increase the pthreadPoolSize. Running threads ${modulePThread.runningWorkers.length}. Loading workers: ${modulePThread.unusedWorkers.length}`); + mono_log_warn(`Failed to find loaded WebWorker, this may deadlock. Please increase the pthreadPoolSize. Running threads ${modulePThread.runningWorkers.length}. Loading workers: ${modulePThread.unusedWorkers.length}`); availableThreadCount--; // negative value return modulePThread.unusedWorkers.pop()!; } From 53db0f2653911dc2d75ece1e531fd11e83c2b1f7 Mon Sep 17 00:00:00 2001 From: pavelsavara Date: Mon, 22 Jan 2024 15:06:38 +0100 Subject: [PATCH 13/25] browser target --- .../Microsoft.Extensions.Logging.Console.Tests.csproj | 5 +++++ .../tests/System.IO.Compression.ZipFile.Tests.csproj | 1 + .../tests/System.IO.Compression.Tests.csproj | 1 + .../tests/System.IO.FileSystem.DriveInfo.Tests.csproj | 1 + .../tests/System.IO.MemoryMappedFiles.Tests.csproj | 1 + .../PalTests/System.Net.NameResolution.Pal.Tests.csproj | 1 + .../tests/PalTests/System.Net.Primitives.Pal.Tests.csproj | 1 + .../UnitTests/System.Net.Primitives.UnitTests.Tests.csproj | 1 + .../System.Net.WebProxy/src/System.Net.WebProxy.csproj | 1 + .../System.Runtime.InteropServices.JavaScript.Tests.csproj | 1 - .../System.Runtime.InteropServices.Tests.csproj | 1 + .../System.IO.FileSystem.Tests.csproj | 1 + .../tests/System.Runtime.Tests/System.Runtime.Tests.csproj | 1 + .../tests/System.Threading.Tasks.Parallel.Tests.csproj | 1 + .../ref/System.Threading.Thread.csproj | 1 + src/libraries/System.Threading/ref/System.Threading.csproj | 1 + 16 files changed, 19 insertions(+), 1 deletion(-) diff --git a/src/libraries/Microsoft.Extensions.Logging.Console/tests/Microsoft.Extensions.Logging.Console.Tests/Microsoft.Extensions.Logging.Console.Tests.csproj b/src/libraries/Microsoft.Extensions.Logging.Console/tests/Microsoft.Extensions.Logging.Console.Tests/Microsoft.Extensions.Logging.Console.Tests.csproj index c38ae483cf00de..d3edc63c9ea9a3 100644 --- a/src/libraries/Microsoft.Extensions.Logging.Console/tests/Microsoft.Extensions.Logging.Console.Tests/Microsoft.Extensions.Logging.Console.Tests.csproj +++ b/src/libraries/Microsoft.Extensions.Logging.Console/tests/Microsoft.Extensions.Logging.Console.Tests/Microsoft.Extensions.Logging.Console.Tests.csproj @@ -5,6 +5,11 @@ true true true + $([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) + + + + $(WasmXHarnessMonoArgs) --setenv=XHARNESS_LOG_TEST_START=true diff --git a/src/libraries/System.IO.Compression.ZipFile/tests/System.IO.Compression.ZipFile.Tests.csproj b/src/libraries/System.IO.Compression.ZipFile/tests/System.IO.Compression.ZipFile.Tests.csproj index e07ea71438a4fd..69e4dbd3294c69 100644 --- a/src/libraries/System.IO.Compression.ZipFile/tests/System.IO.Compression.ZipFile.Tests.csproj +++ b/src/libraries/System.IO.Compression.ZipFile/tests/System.IO.Compression.ZipFile.Tests.csproj @@ -3,6 +3,7 @@ true true $(NetCoreAppCurrent)-windows;$(NetCoreAppCurrent)-unix;$(NetCoreAppCurrent)-browser + $([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) diff --git a/src/libraries/System.IO.Compression/tests/System.IO.Compression.Tests.csproj b/src/libraries/System.IO.Compression/tests/System.IO.Compression.Tests.csproj index 7715606fcfdd4d..aaf09ff3af9f04 100644 --- a/src/libraries/System.IO.Compression/tests/System.IO.Compression.Tests.csproj +++ b/src/libraries/System.IO.Compression/tests/System.IO.Compression.Tests.csproj @@ -3,6 +3,7 @@ $(NetCoreAppCurrent)-windows;$(NetCoreAppCurrent)-unix;$(NetCoreAppCurrent)-browser true true + $([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) diff --git a/src/libraries/System.IO.FileSystem.DriveInfo/tests/System.IO.FileSystem.DriveInfo.Tests.csproj b/src/libraries/System.IO.FileSystem.DriveInfo/tests/System.IO.FileSystem.DriveInfo.Tests.csproj index cc4756c4483abe..b5fdcf1902884e 100644 --- a/src/libraries/System.IO.FileSystem.DriveInfo/tests/System.IO.FileSystem.DriveInfo.Tests.csproj +++ b/src/libraries/System.IO.FileSystem.DriveInfo/tests/System.IO.FileSystem.DriveInfo.Tests.csproj @@ -1,6 +1,7 @@ $(NetCoreAppCurrent)-windows;$(NetCoreAppCurrent)-unix;$(NetCoreAppCurrent)-browser + $([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) diff --git a/src/libraries/System.IO.MemoryMappedFiles/tests/System.IO.MemoryMappedFiles.Tests.csproj b/src/libraries/System.IO.MemoryMappedFiles/tests/System.IO.MemoryMappedFiles.Tests.csproj index 15406d7bdf6227..7eda1233a40190 100644 --- a/src/libraries/System.IO.MemoryMappedFiles/tests/System.IO.MemoryMappedFiles.Tests.csproj +++ b/src/libraries/System.IO.MemoryMappedFiles/tests/System.IO.MemoryMappedFiles.Tests.csproj @@ -3,6 +3,7 @@ true true $(NetCoreAppCurrent)-windows;$(NetCoreAppCurrent)-unix;$(NetCoreAppCurrent)-browser + $([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) diff --git a/src/libraries/System.Net.NameResolution/tests/PalTests/System.Net.NameResolution.Pal.Tests.csproj b/src/libraries/System.Net.NameResolution/tests/PalTests/System.Net.NameResolution.Pal.Tests.csproj index 6e08a5f973e096..1c9361f593a407 100644 --- a/src/libraries/System.Net.NameResolution/tests/PalTests/System.Net.NameResolution.Pal.Tests.csproj +++ b/src/libraries/System.Net.NameResolution/tests/PalTests/System.Net.NameResolution.Pal.Tests.csproj @@ -4,6 +4,7 @@ ../../src/Resources/Strings.resx $(NetCoreAppCurrent)-windows;$(NetCoreAppCurrent)-unix;$(NetCoreAppCurrent)-browser true + $([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) diff --git a/src/libraries/System.Net.Primitives/tests/PalTests/System.Net.Primitives.Pal.Tests.csproj b/src/libraries/System.Net.Primitives/tests/PalTests/System.Net.Primitives.Pal.Tests.csproj index 90fbc1e3d31bab..71f45ac2e64fb9 100644 --- a/src/libraries/System.Net.Primitives/tests/PalTests/System.Net.Primitives.Pal.Tests.csproj +++ b/src/libraries/System.Net.Primitives/tests/PalTests/System.Net.Primitives.Pal.Tests.csproj @@ -3,6 +3,7 @@ true ../../src/Resources/Strings.resx $(NetCoreAppCurrent)-windows;$(NetCoreAppCurrent)-unix;$(NetCoreAppCurrent)-browser + $([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) false - $(WasmXHarnessMonoArgs) --setenv=XHARNESS_LOG_TEST_START=true diff --git a/src/libraries/System.Runtime.InteropServices/tests/System.Runtime.InteropServices.UnitTests/System.Runtime.InteropServices.Tests.csproj b/src/libraries/System.Runtime.InteropServices/tests/System.Runtime.InteropServices.UnitTests/System.Runtime.InteropServices.Tests.csproj index 31369aaca2a4a3..9ffc16e149c68b 100644 --- a/src/libraries/System.Runtime.InteropServices/tests/System.Runtime.InteropServices.UnitTests/System.Runtime.InteropServices.Tests.csproj +++ b/src/libraries/System.Runtime.InteropServices/tests/System.Runtime.InteropServices.UnitTests/System.Runtime.InteropServices.Tests.csproj @@ -4,6 +4,7 @@ $(NetCoreAppCurrent)-windows;$(NetCoreAppCurrent)-unix;$(NetCoreAppCurrent)-browser true true + $([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) diff --git a/src/libraries/System.Runtime/tests/System.IO.FileSystem.Tests/System.IO.FileSystem.Tests.csproj b/src/libraries/System.Runtime/tests/System.IO.FileSystem.Tests/System.IO.FileSystem.Tests.csproj index 738960903f5045..4a17a866e5d7b3 100644 --- a/src/libraries/System.Runtime/tests/System.IO.FileSystem.Tests/System.IO.FileSystem.Tests.csproj +++ b/src/libraries/System.Runtime/tests/System.IO.FileSystem.Tests/System.IO.FileSystem.Tests.csproj @@ -3,6 +3,7 @@ true true $(NetCoreAppCurrent)-windows;$(NetCoreAppCurrent)-unix;$(NetCoreAppCurrent)-browser + $([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) --working-dir=/test-dir diff --git a/src/libraries/System.Runtime/tests/System.Runtime.Tests/System.Runtime.Tests.csproj b/src/libraries/System.Runtime/tests/System.Runtime.Tests/System.Runtime.Tests.csproj index 6514d08c8f284f..88b4507b2812e4 100644 --- a/src/libraries/System.Runtime/tests/System.Runtime.Tests/System.Runtime.Tests.csproj +++ b/src/libraries/System.Runtime/tests/System.Runtime.Tests/System.Runtime.Tests.csproj @@ -16,6 +16,7 @@ true true + $([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) $(WasmXHarnessMonoArgs) --setenv=XHARNESS_LOG_TEST_START=true diff --git a/src/libraries/System.Threading.Tasks.Parallel/tests/System.Threading.Tasks.Parallel.Tests.csproj b/src/libraries/System.Threading.Tasks.Parallel/tests/System.Threading.Tasks.Parallel.Tests.csproj index b1d50f97a30a4e..19b41f8f80b8e9 100644 --- a/src/libraries/System.Threading.Tasks.Parallel/tests/System.Threading.Tasks.Parallel.Tests.csproj +++ b/src/libraries/System.Threading.Tasks.Parallel/tests/System.Threading.Tasks.Parallel.Tests.csproj @@ -2,12 +2,11 @@ true $(NetCoreAppCurrent) - $([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) - + $(WasmXHarnessMonoArgs) --setenv=XHARNESS_LOG_TEST_START=true From 6013a5bf89dc54facc0d9a8f7e28baab0e62699c Mon Sep 17 00:00:00 2001 From: pavelsavara Date: Mon, 22 Jan 2024 22:24:25 +0100 Subject: [PATCH 16/25] more --- .../ConsoleFormatterTests.cs | 48 +++++++- .../ConsoleLoggerTest.cs | 113 ++++++++++++------ .../JsonConsoleFormatterTests.cs | 18 +-- .../SimpleConsoleFormatterTests.cs | 8 +- .../tests/ParallelForTests.cs | 1 + 5 files changed, 130 insertions(+), 58 deletions(-) diff --git a/src/libraries/Microsoft.Extensions.Logging.Console/tests/Microsoft.Extensions.Logging.Console.Tests/ConsoleFormatterTests.cs b/src/libraries/Microsoft.Extensions.Logging.Console/tests/Microsoft.Extensions.Logging.Console.Tests/ConsoleFormatterTests.cs index 6da081c4e86ab0..10b2c6432d6c75 100644 --- a/src/libraries/Microsoft.Extensions.Logging.Console/tests/Microsoft.Extensions.Logging.Console.Tests/ConsoleFormatterTests.cs +++ b/src/libraries/Microsoft.Extensions.Logging.Console/tests/Microsoft.Extensions.Logging.Console.Tests/ConsoleFormatterTests.cs @@ -27,7 +27,43 @@ protected string GetMessage(List contexts) return string.Join("", contexts.Select(c => c.Message)); } - internal static (ConsoleLogger Logger, ConsoleSink Sink, ConsoleSink ErrorSink, Func GetLevelPrefix, int WritesPerMsg) SetUp( + internal class SetupDisposeHelper : IDisposable + { + public ConsoleLogger Logger; + public ConsoleSink Sink; + public ConsoleSink ErrorSink; + public Func GetLevelPrefix; + public int WritesPerMsg; + public TestLoggerProcessor LoggerProcessor; + public SetupDisposeHelper(ConsoleLogger logger, ConsoleSink sink, ConsoleSink errorSink, Func getLevelPrefix, int writesPerMsg, TestLoggerProcessor loggerProcessor) + { + Logger = logger; + Sink = sink; + ErrorSink = errorSink; + GetLevelPrefix = getLevelPrefix; + WritesPerMsg = writesPerMsg; + LoggerProcessor = loggerProcessor; + } + + private bool _isDisposed; + + protected virtual void Dispose(bool disposing) + { + if (!_isDisposed) + { + LoggerProcessor.Dispose(); + _isDisposed = true; + } + } + + public void Dispose() + { + Dispose(disposing: true); + GC.SuppressFinalize(this); + } + } + + internal static SetupDisposeHelper SetUp( ConsoleLoggerOptions options = null, SimpleConsoleFormatterOptions simpleOptions = null, ConsoleFormatterOptions systemdOptions = null, @@ -70,7 +106,7 @@ internal static (ConsoleLogger Logger, ConsoleSink Sink, ConsoleSink ErrorSink, } var logger = new ConsoleLogger(_loggerName, consoleLoggerProcessor, formatter, new LoggerExternalScopeProvider(), loggerOptions); - return (logger, sink, errorSink, levelAsString, writesPerMsg); + return new SetupDisposeHelper(logger, sink, errorSink, levelAsString, writesPerMsg, consoleLoggerProcessor); } [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))] @@ -78,7 +114,7 @@ public void ConsoleLoggerOptions_TimeStampFormat_IsReloaded() { // Arrange var monitor = new TestOptionsMonitor(new ConsoleLoggerOptions() { FormatterName = "NonExistentFormatter" }); - var loggerProvider = new ConsoleLoggerProvider(monitor, ConsoleLoggerTest.GetFormatters()); + using var loggerProvider = new ConsoleLoggerProvider(monitor, ConsoleLoggerTest.GetFormatters()); var logger = (ConsoleLogger)loggerProvider.CreateLogger("Name"); // Act & Assert @@ -91,7 +127,7 @@ public void ConsoleLoggerOptions_TimeStampFormat_IsReloaded() public void InvalidLogLevel_Throws(string formatterName) { // Arrange - var t = SetUp( + using var t = SetUp( new ConsoleLoggerOptions { FormatterName = formatterName } ); var logger = (ILogger)t.Logger; @@ -105,7 +141,7 @@ public void InvalidLogLevel_Throws(string formatterName) public void NoMessageOrException_Noop(string formatterName, LogLevel level) { // Arrange - var t = SetUp(new ConsoleLoggerOptions { FormatterName = formatterName }); + using var t = SetUp(new ConsoleLoggerOptions { FormatterName = formatterName }); var levelPrefix = t.GetLevelPrefix(level); var logger = t.Logger; var sink = t.Sink; @@ -124,7 +160,7 @@ public void NoMessageOrException_Noop(string formatterName, LogLevel level) public void Log_LogsCorrectTimestamp(string formatterName, LogLevel level) { // Arrange - var t = SetUp( + using var t = SetUp( new ConsoleLoggerOptions { FormatterName = formatterName }, new SimpleConsoleFormatterOptions { TimestampFormat = "yyyy-MM-ddTHH:mm:sszz ", UseUtcTimestamp = false, ColorBehavior = LoggerColorBehavior.Enabled }, new ConsoleFormatterOptions { TimestampFormat = "yyyy-MM-ddTHH:mm:sszz ", UseUtcTimestamp = false }, diff --git a/src/libraries/Microsoft.Extensions.Logging.Console/tests/Microsoft.Extensions.Logging.Console.Tests/ConsoleLoggerTest.cs b/src/libraries/Microsoft.Extensions.Logging.Console/tests/Microsoft.Extensions.Logging.Console.Tests/ConsoleLoggerTest.cs index 0994980590122b..c960c1dbb90baf 100644 --- a/src/libraries/Microsoft.Extensions.Logging.Console/tests/Microsoft.Extensions.Logging.Console.Tests/ConsoleLoggerTest.cs +++ b/src/libraries/Microsoft.Extensions.Logging.Console/tests/Microsoft.Extensions.Logging.Console.Tests/ConsoleLoggerTest.cs @@ -40,7 +40,43 @@ internal static IEnumerable GetFormatters( return formatters; } - private static (ConsoleLogger Logger, ConsoleSink Sink, ConsoleSink ErrorSink, Func GetLevelPrefix, int WritesPerMsg) SetUp(ConsoleLoggerOptions options = null) + internal class SetupDisposeHelper : IDisposable + { + public ConsoleLogger Logger; + public ConsoleSink Sink; + public ConsoleSink ErrorSink; + public Func GetLevelPrefix; + public int WritesPerMsg; + public TestLoggerProcessor LoggerProcessor; + public SetupDisposeHelper(ConsoleLogger logger, ConsoleSink sink, ConsoleSink errorSink, Func getLevelPrefix, int writesPerMsg, TestLoggerProcessor loggerProcessor) + { + Logger= logger; + Sink= sink; + ErrorSink= errorSink; + GetLevelPrefix = getLevelPrefix; + WritesPerMsg = writesPerMsg; + LoggerProcessor = loggerProcessor; + } + + private bool _isDisposed; + + protected virtual void Dispose(bool disposing) + { + if (!_isDisposed) + { + LoggerProcessor.Dispose(); + _isDisposed = true; + } + } + + public void Dispose() + { + Dispose(disposing: true); + GC.SuppressFinalize(this); + } + } + + private static SetupDisposeHelper SetUp(ConsoleLoggerOptions options = null) { // Arrange var sink = new ConsoleSink(); @@ -74,7 +110,7 @@ private static (ConsoleLogger Logger, ConsoleSink Sink, ConsoleSink ErrorSink, F UpdateFormatterOptions(logger.Formatter, logger.Options); VerifyDeprecatedPropertiesUsedOnNullFormatterName(logger); - return (logger, sink, errorSink, levelAsString, writesPerMsg); + return new SetupDisposeHelper(logger, sink, errorSink, levelAsString, writesPerMsg, consoleLoggerProcessor); } private static void VerifyDeprecatedPropertiesUsedOnNullFormatterName(ConsoleLogger logger) @@ -177,7 +213,7 @@ internal static string GetJsonLogLevelString(LogLevel logLevel) public void LogsWhenMessageIsNotProvided() { // Arrange - var t = SetUp(); + using var t = SetUp(); var logger = (ILogger)t.Logger; var sink = t.Sink; var exception = new InvalidOperationException("Invalid value"); @@ -209,7 +245,7 @@ public void LogsWhenMessageIsNotProvided() public void DoesNotLog_NewLine_WhenNoExceptionIsProvided() { // Arrange - var t = SetUp(); + using var t = SetUp(); var logger = (ILogger)t.Logger; var sink = t.Sink; var logMessage = "Route with name 'Simple' was not found."; @@ -244,7 +280,7 @@ public void Options_FormatterNameNull_UsesDeprecatedProperties(string formatterN ConsoleLoggerFormat format = (ConsoleLoggerFormat)formatNumber; var options = new ConsoleLoggerOptions() { FormatterName = formatterName }; var monitor = new TestOptionsMonitor(options); - var loggerProvider = new ConsoleLoggerProvider(monitor, GetFormatters()); + using var loggerProvider = new ConsoleLoggerProvider(monitor, GetFormatters()); var logger = (ConsoleLogger)loggerProvider.CreateLogger("Name"); // Act @@ -272,7 +308,6 @@ public void Options_FormatterNameNull_UsesDeprecatedProperties(string formatterN default: throw new ArgumentOutOfRangeException(nameof(format)); } - loggerProvider?.Dispose(); } [ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))] @@ -280,7 +315,7 @@ public void Options_FormatterNameNull_UsesDeprecatedProperties(string formatterN public void Writes_NewLine_WhenExceptionIsProvided(string message) { // Arrange - var t = SetUp(); + using var t = SetUp(); var logger = (ILogger)t.Logger; var sink = t.Sink; var eventId = 10; @@ -303,7 +338,7 @@ public void Writes_NewLine_WhenExceptionIsProvided(string message) public void ThrowsException_WhenNoFormatterIsProvided() { // Arrange - var t = SetUp(); + using var t = SetUp(); var logger = (ILogger)t.Logger; // Act & Assert @@ -314,7 +349,7 @@ public void ThrowsException_WhenNoFormatterIsProvided() public void LogsWhenNullFilterGiven() { // Arrange - var t = SetUp(); + using var t = SetUp(); var logger = t.Logger; var sink = t.Sink; var expectedHeader = CreateHeader(ConsoleLoggerFormat.Default) + Environment.NewLine; @@ -335,7 +370,7 @@ public void LogsWhenNullFilterGiven() public void WriteCritical_LogsCorrectColors() { // Arrange - var t = SetUp(); + using var t = SetUp(); var logger = t.Logger; var sink = t.Sink; @@ -356,7 +391,7 @@ public void WriteCritical_LogsCorrectColors() public void WriteError_LogsCorrectColors() { // Arrange - var t = SetUp(); + using var t = SetUp(); var logger = t.Logger; var sink = t.Sink; @@ -377,7 +412,7 @@ public void WriteError_LogsCorrectColors() public void WriteWarning_LogsCorrectColors() { // Arrange - var t = SetUp(); + using var t = SetUp(); var logger = t.Logger; var sink = t.Sink; @@ -398,7 +433,7 @@ public void WriteWarning_LogsCorrectColors() public void WriteInformation_LogsCorrectColors() { // Arrange - var t = SetUp(); + using var t = SetUp(); var logger = t.Logger; var sink = t.Sink; @@ -449,7 +484,7 @@ public void AddConsole_IsOutputRedirected_ColorDisabled() public void WriteDebug_LogsCorrectColors() { // Arrange - var t = SetUp(); + using var t = SetUp(); var logger = t.Logger; var sink = t.Sink; @@ -470,7 +505,7 @@ public void WriteDebug_LogsCorrectColors() public void WriteTrace_LogsCorrectColors() { // Arrange - var t = SetUp(); + using var t = SetUp(); var logger = t.Logger; var sink = t.Sink; @@ -491,7 +526,7 @@ public void WriteTrace_LogsCorrectColors() public void WriteAllLevelsDisabledColors_LogsNoColors() { // Arrange - var t = SetUp(new ConsoleLoggerOptions { DisableColors = true }); + using var t = SetUp(new ConsoleLoggerOptions { DisableColors = true }); var logger = t.Logger; var sink = t.Sink; @@ -516,7 +551,7 @@ public void WriteAllLevelsDisabledColors_LogsNoColors() public void Log_LogsCorrectTimestamp(ConsoleLoggerFormat format, LogLevel level) { // Arrange - var t = SetUp(new ConsoleLoggerOptions { TimestampFormat = "yyyy-MM-ddTHH:mm:sszz ", Format = format, UseUtcTimestamp = false }); + using var t = SetUp(new ConsoleLoggerOptions { TimestampFormat = "yyyy-MM-ddTHH:mm:sszz ", Format = format, UseUtcTimestamp = false }); var levelPrefix = t.GetLevelPrefix(level); var logger = t.Logger; var sink = t.Sink; @@ -557,7 +592,7 @@ public void Log_LogsCorrectTimestamp(ConsoleLoggerFormat format, LogLevel level) public void WriteCore_LogsCorrectTimestampInUtc(ConsoleLoggerFormat format, LogLevel level) { // Arrange - var t = SetUp(new ConsoleLoggerOptions { TimestampFormat = "yyyy-MM-ddTHH:mm:sszz ", Format = format, UseUtcTimestamp = true }); + using var t = SetUp(new ConsoleLoggerOptions { TimestampFormat = "yyyy-MM-ddTHH:mm:sszz ", Format = format, UseUtcTimestamp = true }); var levelPrefix = t.GetLevelPrefix(level); var logger = t.Logger; var sink = t.Sink; @@ -598,7 +633,7 @@ public void WriteCore_LogsCorrectTimestampInUtc(ConsoleLoggerFormat format, LogL public void WriteCore_LogsCorrectMessages(ConsoleLoggerFormat format, LogLevel level) { // Arrange - var t = SetUp(new ConsoleLoggerOptions { Format = format }); + using var t = SetUp(new ConsoleLoggerOptions { Format = format }); var levelPrefix = t.GetLevelPrefix(level); var logger = t.Logger; var sink = t.Sink; @@ -641,7 +676,7 @@ public void WriteCore_LogsCorrectMessages(ConsoleLoggerFormat format, LogLevel l public void NoLogScope_DoesNotWriteAnyScopeContentToOutput() { // Arrange - var t = SetUp(new ConsoleLoggerOptions { IncludeScopes = true }); + using var t = SetUp(new ConsoleLoggerOptions { IncludeScopes = true }); var logger = t.Logger; var sink = t.Sink; @@ -662,7 +697,7 @@ public void NoLogScope_DoesNotWriteAnyScopeContentToOutput() public void WritingScopes_LogsWithCorrectColors() { // Arrange - var t = SetUp(new ConsoleLoggerOptions { IncludeScopes = true }); + using var t = SetUp(new ConsoleLoggerOptions { IncludeScopes = true }); var logger = t.Logger; var sink = t.Sink; var id = Guid.NewGuid(); @@ -689,7 +724,7 @@ public void WritingScopes_LogsWithCorrectColors() public void WritingScopes_LogsExpectedMessage(ConsoleLoggerFormat format) { // Arrange - var t = SetUp(new ConsoleLoggerOptions { IncludeScopes = true, Format = format }); + using var t = SetUp(new ConsoleLoggerOptions { IncludeScopes = true, Format = format }); var logger = t.Logger; var sink = t.Sink; var level = LogLevel.Information; @@ -740,7 +775,7 @@ public void WritingScopes_LogsExpectedMessage(ConsoleLoggerFormat format) public void WritingNestedScope_LogsNullScopeName(ConsoleLoggerFormat format) { // Arrange - var t = SetUp(new ConsoleLoggerOptions { IncludeScopes = true, Format = format }); + using var t = SetUp(new ConsoleLoggerOptions { IncludeScopes = true, Format = format }); var logger = t.Logger; var sink = t.Sink; var level = LogLevel.Information; @@ -789,7 +824,7 @@ public void WritingNestedScope_LogsNullScopeName(ConsoleLoggerFormat format) public void WritingNestedScopes_LogsExpectedMessage(ConsoleLoggerFormat format) { // Arrange - var t = SetUp(new ConsoleLoggerOptions { IncludeScopes = true, Format = format }); + using var t = SetUp(new ConsoleLoggerOptions { IncludeScopes = true, Format = format }); var logger = t.Logger; var sink = t.Sink; var level = LogLevel.Information; @@ -847,7 +882,7 @@ public void WritingNestedScopes_LogsExpectedMessage(ConsoleLoggerFormat format) public void WritingMultipleScopes_LogsExpectedMessage(ConsoleLoggerFormat format) { // Arrange - var t = SetUp(new ConsoleLoggerOptions { IncludeScopes = true, Format = format }); + using var t = SetUp(new ConsoleLoggerOptions { IncludeScopes = true, Format = format }); var logger = t.Logger; var sink = t.Sink; var level = LogLevel.Information; @@ -915,7 +950,7 @@ public void WritingMultipleScopes_LogsExpectedMessage(ConsoleLoggerFormat format public void CallingBeginScopeOnLogger_AlwaysReturnsNewDisposableInstance() { // Arrange - var t = SetUp(new ConsoleLoggerOptions { IncludeScopes = true }); + using var t = SetUp(new ConsoleLoggerOptions { IncludeScopes = true }); var logger = t.Logger; var sink = t.Sink; @@ -933,7 +968,7 @@ public void CallingBeginScopeOnLogger_AlwaysReturnsNewDisposableInstance() public void CallingBeginScopeOnLogger_ReturnsNonNullableInstance() { // Arrange - var t = SetUp(); + using var t = SetUp(); var logger = t.Logger; var sink = t.Sink; @@ -949,7 +984,7 @@ public void CallingBeginScopeOnLogger_ReturnsNonNullableInstance() public void ConsoleLoggerLogsToError_WhenOverErrorLevel(ConsoleLoggerFormat format) { // Arrange - var t = SetUp(new ConsoleLoggerOptions { LogToStandardErrorThreshold = LogLevel.Warning, Format = format }); + using var t = SetUp(new ConsoleLoggerOptions { LogToStandardErrorThreshold = LogLevel.Warning, Format = format }); var logger = t.Logger; var sink = t.Sink; var errorSink = t.ErrorSink; @@ -999,7 +1034,7 @@ public void ConsoleLoggerLogsToError_WhenOverErrorLevel(ConsoleLoggerFormat form public void WriteCore_NullMessageWithException(ConsoleLoggerFormat format, LogLevel level) { // Arrange - var t = SetUp(new ConsoleLoggerOptions { Format = format }); + using var t = SetUp(new ConsoleLoggerOptions { Format = format }); var levelPrefix = t.GetLevelPrefix(level); var logger = t.Logger; var sink = t.Sink; @@ -1043,7 +1078,7 @@ public void WriteCore_NullMessageWithException(ConsoleLoggerFormat format, LogLe public void WriteCore_EmptyMessageWithException(ConsoleLoggerFormat format, LogLevel level) { // Arrange - var t = SetUp(new ConsoleLoggerOptions { Format = format }); + using var t = SetUp(new ConsoleLoggerOptions { Format = format }); var levelPrefix = t.GetLevelPrefix(level); var logger = t.Logger; var sink = t.Sink; @@ -1086,7 +1121,7 @@ public void WriteCore_EmptyMessageWithException(ConsoleLoggerFormat format, LogL public void WriteCore_MessageWithNullException(ConsoleLoggerFormat format, LogLevel level) { // Arrange - var t = SetUp(new ConsoleLoggerOptions { Format = format }); + using var t = SetUp(new ConsoleLoggerOptions { Format = format }); var levelPrefix = t.GetLevelPrefix(level); var logger = t.Logger; var sink = t.Sink; @@ -1126,7 +1161,7 @@ public void WriteCore_MessageWithNullException(ConsoleLoggerFormat format, LogLe public void WriteCore_NullMessageWithNullException(LogLevel level) { // Arrange - var t = SetUp(); + using var t = SetUp(); var logger = t.Logger; var sink = t.Sink; Exception ex = null; @@ -1158,7 +1193,7 @@ public void ConsoleLoggerOptions_DisableColors_IsAppliedToLoggers() { // Arrange var monitor = new TestOptionsMonitor(new ConsoleLoggerOptions() { DisableColors = true }); - var loggerProvider = new ConsoleLoggerProvider(monitor); + using var loggerProvider = new ConsoleLoggerProvider(monitor); var logger = (ConsoleLogger)loggerProvider.CreateLogger("Name"); // Act & Assert @@ -1209,7 +1244,7 @@ public void ConsoleLoggerOptions_TimeStampFormat_IsReloaded() { // Arrange var monitor = new TestOptionsMonitor(new ConsoleLoggerOptions()); - var loggerProvider = new ConsoleLoggerProvider(monitor); + using var loggerProvider = new ConsoleLoggerProvider(monitor); var logger = (ConsoleLogger)loggerProvider.CreateLogger("Name"); // Act & Assert @@ -1239,7 +1274,7 @@ public void ConsoleLoggerOptions_TimeStampFormat_IsReadFromLoggingConfiguration( public void ConsoleLoggerOptions_TimeStampFormat_MultipleReloads() { var monitor = new TestOptionsMonitor(new ConsoleLoggerOptions()); - var loggerProvider = new ConsoleLoggerProvider(monitor); + using var loggerProvider = new ConsoleLoggerProvider(monitor); var logger = (ConsoleLogger)loggerProvider.CreateLogger("Name"); Assert.Null(logger.Options.TimestampFormat); @@ -1254,7 +1289,7 @@ public void ConsoleLoggerOptions_IncludeScopes_IsAppliedToLoggers() { // Arrange var monitor = new TestOptionsMonitor(new ConsoleLoggerOptions() { IncludeScopes = true }); - var loggerProvider = new ConsoleLoggerProvider(monitor); + using var loggerProvider = new ConsoleLoggerProvider(monitor); var logger = (ConsoleLogger)loggerProvider.CreateLogger("Name"); // Act & Assert @@ -1285,7 +1320,7 @@ public void ConsoleLoggerOptions_LogAsErrorLevel_IsAppliedToLoggers() { // Arrange var monitor = new TestOptionsMonitor(new ConsoleLoggerOptions()); - var loggerProvider = new ConsoleLoggerProvider(monitor); + using var loggerProvider = new ConsoleLoggerProvider(monitor); var logger = (ConsoleLogger)loggerProvider.CreateLogger("Name"); // Act & Assert @@ -1299,7 +1334,7 @@ public void ConsoleLoggerOptions_UpdateQueueOptions_UpdatesConsoleLoggerProcesso { // Arrange var monitor = new TestOptionsMonitor(new ConsoleLoggerOptions()); - var loggerProvider = new ConsoleLoggerProvider(monitor); + using var loggerProvider = new ConsoleLoggerProvider(monitor); var logger = (ConsoleLogger)loggerProvider.CreateLogger("Name"); // Act & Assert @@ -1318,7 +1353,7 @@ public void ConsoleLoggerOptions_UseUtcTimestamp_IsAppliedToLoggers() { // Arrange var monitor = new TestOptionsMonitor(new ConsoleLoggerOptions()); - var loggerProvider = new ConsoleLoggerProvider(monitor); + using var loggerProvider = new ConsoleLoggerProvider(monitor); var logger = (ConsoleLogger)loggerProvider.CreateLogger("Name"); // Act & Assert diff --git a/src/libraries/Microsoft.Extensions.Logging.Console/tests/Microsoft.Extensions.Logging.Console.Tests/JsonConsoleFormatterTests.cs b/src/libraries/Microsoft.Extensions.Logging.Console/tests/Microsoft.Extensions.Logging.Console.Tests/JsonConsoleFormatterTests.cs index 0ef491abbc1723..de4703bf0ffcd2 100644 --- a/src/libraries/Microsoft.Extensions.Logging.Console/tests/Microsoft.Extensions.Logging.Console.Tests/JsonConsoleFormatterTests.cs +++ b/src/libraries/Microsoft.Extensions.Logging.Console/tests/Microsoft.Extensions.Logging.Console.Tests/JsonConsoleFormatterTests.cs @@ -55,7 +55,7 @@ public void NoLogScope_DoesNotWriteAnyScopeContentToOutput_Json() public void Log_TimestampFormatSet_ContainsTimestamp() { // Arrange - var t = SetUp( + using var t = SetUp( new ConsoleLoggerOptions { FormatterName = ConsoleFormatterNames.Json }, simpleOptions: null, systemdOptions: null, @@ -82,7 +82,7 @@ public void Log_TimestampFormatSet_ContainsTimestamp() public void Log_NullMessage_LogsWhenMessageIsNotProvided() { // Arrange - var t = SetUp( + using var t = SetUp( new ConsoleLoggerOptions { FormatterName = ConsoleFormatterNames.Json }, simpleOptions: null, systemdOptions: null, @@ -126,7 +126,7 @@ public void Log_NullMessage_LogsWhenMessageIsNotProvided() public void Log_ExceptionWithMessage_ExtractsInfo() { // Arrange - var t = SetUp( + using var t = SetUp( new ConsoleLoggerOptions { FormatterName = ConsoleFormatterNames.Json }, simpleOptions: null, systemdOptions: null, @@ -180,7 +180,7 @@ public void Log_ExceptionWithMessage_ExtractsInfo() public void Log_IncludeScopes_ContainsDuplicateNamedPropertiesInScope_AcceptableJson() { // Arrange - var t = SetUp( + using var t = SetUp( new ConsoleLoggerOptions { FormatterName = ConsoleFormatterNames.Json }, simpleOptions: null, systemdOptions: null, @@ -213,7 +213,7 @@ public void Log_IncludeScopes_ContainsDuplicateNamedPropertiesInScope_Acceptable public void Log_StateAndScopeAreCollections_IncludesMessageAndCollectionValues() { // Arrange - var t = SetUp( + using var t = SetUp( new ConsoleLoggerOptions { FormatterName = ConsoleFormatterNames.Json }, simpleOptions: null, systemdOptions: null, @@ -249,7 +249,7 @@ public void Log_StateAndScopeAreCollections_IncludesMessageAndCollectionValues() public void Log_StateAndScopeContainsSpecialCaseValue_SerializesValueAsExpected(object value, string expectedJsonValue) { // Arrange - var t = SetUp( + using var t = SetUp( new ConsoleLoggerOptions { FormatterName = ConsoleFormatterNames.Json }, simpleOptions: null, systemdOptions: null, @@ -279,7 +279,7 @@ public void Log_StateAndScopeContainsSpecialCaseValue_SerializesValueAsExpected( public void Log_StateAndScopeContainsFloatingPointType_SerializesValue(object value) { // Arrange - var t = SetUp( + using var t = SetUp( new ConsoleLoggerOptions { FormatterName = ConsoleFormatterNames.Json }, simpleOptions: null, systemdOptions: null, @@ -317,7 +317,7 @@ static void AssertMessageValue(string message, string propertyName) public void Log_StateAndScopeContainsNullValue_SerializesNull() { // Arrange - var t = SetUp( + using var t = SetUp( new ConsoleLoggerOptions { FormatterName = ConsoleFormatterNames.Json }, simpleOptions: null, systemdOptions: null, @@ -346,7 +346,7 @@ public void Log_StateAndScopeContainsNullValue_SerializesNull() public void Log_ScopeIsIEnumerable_SerializesKeyValuePair() { // Arrange - var t = SetUp( + using var t = SetUp( new ConsoleLoggerOptions { FormatterName = ConsoleFormatterNames.Json }, simpleOptions: null, systemdOptions: null, diff --git a/src/libraries/Microsoft.Extensions.Logging.Console/tests/Microsoft.Extensions.Logging.Console.Tests/SimpleConsoleFormatterTests.cs b/src/libraries/Microsoft.Extensions.Logging.Console/tests/Microsoft.Extensions.Logging.Console.Tests/SimpleConsoleFormatterTests.cs index 3bb1fa491ecea0..a11254b489eb4b 100644 --- a/src/libraries/Microsoft.Extensions.Logging.Console/tests/Microsoft.Extensions.Logging.Console.Tests/SimpleConsoleFormatterTests.cs +++ b/src/libraries/Microsoft.Extensions.Logging.Console/tests/Microsoft.Extensions.Logging.Console.Tests/SimpleConsoleFormatterTests.cs @@ -16,7 +16,7 @@ public class SimpleConsoleFormatterTests : ConsoleFormatterTests public void Log_WritingScopes_LogsWithCorrectColorsWhenColorEnabled(LoggerColorBehavior colorBehavior) { // Arrange - var t = SetUp( + using var t = SetUp( new ConsoleLoggerOptions { FormatterName = ConsoleFormatterNames.Simple }, new SimpleConsoleFormatterOptions { IncludeScopes = true, ColorBehavior = colorBehavior } ); @@ -57,7 +57,7 @@ public void Log_WritingScopes_LogsWithCorrectColorsWhenColorEnabled(LoggerColorB public void Log_NoLogScope_DoesNotWriteAnyScopeContentToOutput() { // Arrange - var t = SetUp( + using var t = SetUp( new ConsoleLoggerOptions { FormatterName = ConsoleFormatterNames.Simple }, new SimpleConsoleFormatterOptions { IncludeScopes = true, ColorBehavior = LoggerColorBehavior.Enabled } ); @@ -81,7 +81,7 @@ public void Log_NoLogScope_DoesNotWriteAnyScopeContentToOutput() public void Log_SingleLine_LogsWhenMessageIsNotProvided() { // Arrange - var t = SetUp( + using var t = SetUp( new ConsoleLoggerOptions { FormatterName = ConsoleFormatterNames.Simple }, new SimpleConsoleFormatterOptions { SingleLine = true, ColorBehavior = LoggerColorBehavior.Enabled } ); @@ -112,7 +112,7 @@ public void Log_SingleLine_LogsWhenMessageIsNotProvided() public void Log_SingleLine_LogsWhenBothMessageAndExceptionProvided() { // Arrange - var t = SetUp( + using var t = SetUp( new ConsoleLoggerOptions { FormatterName = ConsoleFormatterNames.Simple }, new SimpleConsoleFormatterOptions { SingleLine = true, ColorBehavior = LoggerColorBehavior.Enabled } ); diff --git a/src/libraries/System.Threading.Tasks.Parallel/tests/ParallelForTests.cs b/src/libraries/System.Threading.Tasks.Parallel/tests/ParallelForTests.cs index 1f00689ec73204..c251b93fcfbb08 100644 --- a/src/libraries/System.Threading.Tasks.Parallel/tests/ParallelForTests.cs +++ b/src/libraries/System.Threading.Tasks.Parallel/tests/ParallelForTests.cs @@ -993,6 +993,7 @@ public static void TestParallelScheduler() } [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))] + [ActiveIssue("https://github.com/dotnet/runtime/issues/91541", typeof(PlatformDetection), nameof(PlatformDetection.IsWasmThreadingSupported))] public static void TestInvokeDOPAndCancel() { ParallelOptions parallelOptions = null; From da9b2033df9557b964c6977ed0c748bbe3ae796c Mon Sep 17 00:00:00 2001 From: pavelsavara Date: Tue, 23 Jan 2024 14:03:58 +0100 Subject: [PATCH 17/25] more --- .../SimpleConsoleFormatterTests.cs | 1 + .../System.Threading.Tasks.Parallel/tests/ParallelForTests.cs | 1 + .../tests/ParallelLoopResultTests.cs | 1 + src/libraries/System.Threading/tests/MonitorTests.cs | 1 + .../System.Threading/tests/ReaderWriterLockSlimTests.cs | 2 ++ .../System.Threading/tests/System.Threading.Tests.csproj | 4 ++++ 6 files changed, 10 insertions(+) diff --git a/src/libraries/Microsoft.Extensions.Logging.Console/tests/Microsoft.Extensions.Logging.Console.Tests/SimpleConsoleFormatterTests.cs b/src/libraries/Microsoft.Extensions.Logging.Console/tests/Microsoft.Extensions.Logging.Console.Tests/SimpleConsoleFormatterTests.cs index a11254b489eb4b..5e5c03839f0bc6 100644 --- a/src/libraries/Microsoft.Extensions.Logging.Console/tests/Microsoft.Extensions.Logging.Console.Tests/SimpleConsoleFormatterTests.cs +++ b/src/libraries/Microsoft.Extensions.Logging.Console/tests/Microsoft.Extensions.Logging.Console.Tests/SimpleConsoleFormatterTests.cs @@ -13,6 +13,7 @@ public class SimpleConsoleFormatterTests : ConsoleFormatterTests [InlineData(LoggerColorBehavior.Default)] [InlineData(LoggerColorBehavior.Enabled)] [InlineData(LoggerColorBehavior.Disabled)] + [ActiveIssue("https://github.com/dotnet/runtime/issues/97382", typeof(PlatformDetection), nameof(PlatformDetection.IsWasmThreadingSupported))] public void Log_WritingScopes_LogsWithCorrectColorsWhenColorEnabled(LoggerColorBehavior colorBehavior) { // Arrange diff --git a/src/libraries/System.Threading.Tasks.Parallel/tests/ParallelForTests.cs b/src/libraries/System.Threading.Tasks.Parallel/tests/ParallelForTests.cs index c251b93fcfbb08..058bb3d0c75bf0 100644 --- a/src/libraries/System.Threading.Tasks.Parallel/tests/ParallelForTests.cs +++ b/src/libraries/System.Threading.Tasks.Parallel/tests/ParallelForTests.cs @@ -1213,6 +1213,7 @@ public static void RunParallelLoopCancellationTests() /// Test to ensure that the task ID can be accessed from inside the task /// [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))] + [ActiveIssue("https://github.com/dotnet/runtime/issues/91583", typeof(PlatformDetection), nameof(PlatformDetection.IsWasmThreadingSupported))] public static void TaskIDFromExternalContextTest() { int? withinTaskId = int.MinValue; diff --git a/src/libraries/System.Threading.Tasks.Parallel/tests/ParallelLoopResultTests.cs b/src/libraries/System.Threading.Tasks.Parallel/tests/ParallelLoopResultTests.cs index 430eabdfa01bb7..9006ee9469fc6e 100644 --- a/src/libraries/System.Threading.Tasks.Parallel/tests/ParallelLoopResultTests.cs +++ b/src/libraries/System.Threading.Tasks.Parallel/tests/ParallelLoopResultTests.cs @@ -373,6 +373,7 @@ private static void OrderablePartitionerForEachPLRTest( // Perform tests on various combinations of Stop()/Break() [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))] + [ActiveIssue("https://github.com/dotnet/runtime/issues/91579", typeof(PlatformDetection), nameof(PlatformDetection.IsWasmThreadingSupported))] public static void SimultaneousStopBreakTests() { // diff --git a/src/libraries/System.Threading/tests/MonitorTests.cs b/src/libraries/System.Threading/tests/MonitorTests.cs index ca8ebe9544be1c..13cb675cef34ae 100644 --- a/src/libraries/System.Threading/tests/MonitorTests.cs +++ b/src/libraries/System.Threading/tests/MonitorTests.cs @@ -447,6 +447,7 @@ public static void WaitTest() Monitor.Pulse(obj); } Monitor.Exit(obj); + t.Join(500); } [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))] diff --git a/src/libraries/System.Threading/tests/ReaderWriterLockSlimTests.cs b/src/libraries/System.Threading/tests/ReaderWriterLockSlimTests.cs index d4569737e35078..bf4fdd72cc6fdd 100644 --- a/src/libraries/System.Threading/tests/ReaderWriterLockSlimTests.cs +++ b/src/libraries/System.Threading/tests/ReaderWriterLockSlimTests.cs @@ -446,6 +446,8 @@ public static void ReleaseReadersWhenWaitingWriterTimesOut() // Typical order of execution: 7 writeWaiterThread.Join(); + readerThreads[0].Join(); + readerThreads[1].Join(); } } diff --git a/src/libraries/System.Threading/tests/System.Threading.Tests.csproj b/src/libraries/System.Threading/tests/System.Threading.Tests.csproj index e938db9863da3d..b54013032dbcdb 100644 --- a/src/libraries/System.Threading/tests/System.Threading.Tests.csproj +++ b/src/libraries/System.Threading/tests/System.Threading.Tests.csproj @@ -7,6 +7,10 @@ true + + + $(WasmXHarnessMonoArgs) --setenv=XHARNESS_LOG_TEST_START=true + From 4a7f662daf21e6be5f54f45bdfdd4e66c3db3967 Mon Sep 17 00:00:00 2001 From: pavelsavara Date: Tue, 23 Jan 2024 16:06:17 +0100 Subject: [PATCH 18/25] more --- .../tests/WasmTestRunner/WasmTestRunner.cs | 21 ++++++++++++++++--- .../JavaScript/WebWorkerTest.cs | 9 +++++--- 2 files changed, 24 insertions(+), 6 deletions(-) diff --git a/src/libraries/Common/tests/WasmTestRunner/WasmTestRunner.cs b/src/libraries/Common/tests/WasmTestRunner/WasmTestRunner.cs index 9fb129d825d742..f89d3a3adf55a3 100644 --- a/src/libraries/Common/tests/WasmTestRunner/WasmTestRunner.cs +++ b/src/libraries/Common/tests/WasmTestRunner/WasmTestRunner.cs @@ -24,6 +24,7 @@ public static async Task Main(string[] args) var includedClasses = new List(); var includedMethods = new List(); var backgroundExec = false; + var untilFailed = false; for (int i = 1; i < args.Length; i++) { @@ -53,6 +54,9 @@ public static async Task Main(string[] args) case "-backgroundExec": backgroundExec = true; break; + case "-untilFailed": + untilFailed = true; + break; default: throw new ArgumentException($"Invalid argument '{option}'."); } @@ -72,10 +76,21 @@ public static async Task Main(string[] args) { await Task.Yield(); } - if (backgroundExec) + + var res = 0; + do { - return await Task.Run(() => runner.Run()); + if (backgroundExec) + { + res = await Task.Run(() => runner.Run()); + } + else + { + res = await runner.Run(); + } } - return await runner.Run(); + while(res == 0 && untilFailed); + + return res; } } diff --git a/src/libraries/System.Runtime.InteropServices.JavaScript/tests/System.Runtime.InteropServices.JavaScript.UnitTests/System/Runtime/InteropServices/JavaScript/WebWorkerTest.cs b/src/libraries/System.Runtime.InteropServices.JavaScript/tests/System.Runtime.InteropServices.JavaScript.UnitTests/System/Runtime/InteropServices/JavaScript/WebWorkerTest.cs index 03874be56be9ae..9bdc35f02e7245 100644 --- a/src/libraries/System.Runtime.InteropServices.JavaScript/tests/System.Runtime.InteropServices.JavaScript.UnitTests/System/Runtime/InteropServices/JavaScript/WebWorkerTest.cs +++ b/src/libraries/System.Runtime.InteropServices.JavaScript/tests/System.Runtime.InteropServices.JavaScript.UnitTests/System/Runtime/InteropServices/JavaScript/WebWorkerTest.cs @@ -11,6 +11,7 @@ using System.Net.WebSockets; using System.Text; using System.Linq; +using System.Runtime.CompilerServices; namespace System.Runtime.InteropServices.JavaScript.Tests { @@ -48,12 +49,14 @@ public async Task InitializeAsync() #region Executors - private CancellationTokenSource CreateTestCaseTimeoutSource() + private CancellationTokenSource CreateTestCaseTimeoutSource([CallerMemberName] string memberName = "") { + var start = DateTime.Now; var cts = new CancellationTokenSource(TimeoutMilliseconds); cts.Token.Register(() => { - Console.WriteLine($"Unexpected test case timeout at {DateTime.Now.ToString("u")} ManagedThreadId:{Environment.CurrentManagedThreadId}"); + var end = DateTime.Now; + Console.WriteLine($"Unexpected test case {memberName} timeout after {end - start} ManagedThreadId:{Environment.CurrentManagedThreadId}"); }); return cts; } @@ -675,7 +678,7 @@ await executor.Execute(async () => private Task HttpClient_ActionInDifferentThread(string url, Executor executor1, Executor executor2, Func e2Job) { - var cts = CreateTestCaseTimeoutSource(); + var cts = new CancellationTokenSource(); var e1Job = async (Task e2done, TaskCompletionSource e1State) => { From fa473ec054fa164c4873ffde5f9dae82f4ff10b5 Mon Sep 17 00:00:00 2001 From: pavelsavara Date: Tue, 23 Jan 2024 16:41:17 +0100 Subject: [PATCH 19/25] more --- .../tests/RangePartitioner1Chunk.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/libraries/System.Threading.Tasks.Parallel/tests/RangePartitioner1Chunk.cs b/src/libraries/System.Threading.Tasks.Parallel/tests/RangePartitioner1Chunk.cs index b7eece1c2de61d..254a8ac86bf5e1 100644 --- a/src/libraries/System.Threading.Tasks.Parallel/tests/RangePartitioner1Chunk.cs +++ b/src/libraries/System.Threading.Tasks.Parallel/tests/RangePartitioner1Chunk.cs @@ -101,6 +101,7 @@ static void oneMoveNext(int length, bool isOrderable) /// /// [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))] + [ActiveIssue("https://github.com/dotnet/runtime/issues/91541", typeof(PlatformDetection), nameof(PlatformDetection.IsWasmThreadingSupported))] public static void IterationsWithDependency() { static void iterationsWithDependency(int length, int dependencyIndex) From c841796b2c110079b6154fa0ab422ba96ad23c7f Mon Sep 17 00:00:00 2001 From: pavelsavara Date: Tue, 23 Jan 2024 16:45:11 +0100 Subject: [PATCH 20/25] wip --- .../tests/RangePartitioner1Chunk.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libraries/System.Threading.Tasks.Parallel/tests/RangePartitioner1Chunk.cs b/src/libraries/System.Threading.Tasks.Parallel/tests/RangePartitioner1Chunk.cs index 254a8ac86bf5e1..8afcec80958f5d 100644 --- a/src/libraries/System.Threading.Tasks.Parallel/tests/RangePartitioner1Chunk.cs +++ b/src/libraries/System.Threading.Tasks.Parallel/tests/RangePartitioner1Chunk.cs @@ -101,7 +101,7 @@ static void oneMoveNext(int length, bool isOrderable) /// /// [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))] - [ActiveIssue("https://github.com/dotnet/runtime/issues/91541", typeof(PlatformDetection), nameof(PlatformDetection.IsWasmThreadingSupported))] + [ActiveIssue("https://github.com/dotnet/runtime/issues/97396", typeof(PlatformDetection), nameof(PlatformDetection.IsWasmThreadingSupported))] public static void IterationsWithDependency() { static void iterationsWithDependency(int length, int dependencyIndex) From aa57fc8d2b2b730f7ee6ed9e22d0efb07275238e Mon Sep 17 00:00:00 2001 From: pavelsavara Date: Tue, 23 Jan 2024 17:09:36 +0100 Subject: [PATCH 21/25] more --- .../JavaScript/WebWorkerTest.cs | 29 +++++++++---------- 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/src/libraries/System.Runtime.InteropServices.JavaScript/tests/System.Runtime.InteropServices.JavaScript.UnitTests/System/Runtime/InteropServices/JavaScript/WebWorkerTest.cs b/src/libraries/System.Runtime.InteropServices.JavaScript/tests/System.Runtime.InteropServices.JavaScript.UnitTests/System/Runtime/InteropServices/JavaScript/WebWorkerTest.cs index 9bdc35f02e7245..cf3d97207ba9e1 100644 --- a/src/libraries/System.Runtime.InteropServices.JavaScript/tests/System.Runtime.InteropServices.JavaScript.UnitTests/System/Runtime/InteropServices/JavaScript/WebWorkerTest.cs +++ b/src/libraries/System.Runtime.InteropServices.JavaScript/tests/System.Runtime.InteropServices.JavaScript.UnitTests/System/Runtime/InteropServices/JavaScript/WebWorkerTest.cs @@ -250,12 +250,11 @@ public async Task JSSynchronizationContext_Send_Post_To_Canceled() Assert.False(shouldNotHitPost); } +#if !DEBUG [Fact] // this will say something like `JSSynchronizationContext is still installed on worker 0x4ff0030.` in the console during shutdown. public async Task JSWebWorker_Abandon_Running() { - var cts = new CancellationTokenSource(); - TaskCompletionSource never = new TaskCompletionSource(); TaskCompletionSource ready = new TaskCompletionSource(); @@ -265,7 +264,7 @@ public async Task JSWebWorker_Abandon_Running() { ready.SetResult(); return never.Task; - }, cts.Token); + }, CancellationToken.None); #pragma warning restore CS4014 await ready.Task; @@ -280,8 +279,6 @@ public async Task JSWebWorker_Abandon_Running() // this will say something like `JSSynchronizationContext is still installed on worker 0x4ff0030.` in the console during shutdown. public async Task JSWebWorker_Abandon_Running_JS() { - var cts = new CancellationTokenSource(); - TaskCompletionSource ready = new TaskCompletionSource(); #pragma warning disable CS4014 @@ -292,7 +289,7 @@ public async Task JSWebWorker_Abandon_Running_JS() var never = WebWorkerTestHelper.JSDelay(int.MaxValue); ready.SetResult(); await never; - }, cts.Token); + }, CancellationToken.None); #pragma warning restore CS4014 await ready.Task; @@ -302,6 +299,8 @@ public async Task JSWebWorker_Abandon_Running_JS() // it should not prevent mono and the test suite from exiting } +#endif + [Theory, MemberData(nameof(GetTargetThreads))] public async Task Executor_Propagates(Executor executor) @@ -584,9 +583,9 @@ await executor.Execute(async () => [Theory, MemberData(nameof(GetTargetThreads2x))] - public Task WebSocketClient_ResponseCloseInDifferentThread(Executor executor1, Executor executor2) + public async Task WebSocketClient_ResponseCloseInDifferentThread(Executor executor1, Executor executor2) { - var cts = CreateTestCaseTimeoutSource(); + using var cts = CreateTestCaseTimeoutSource(); var uri = new Uri(WebWorkerTestHelper.LocalWsEcho + "?guid=" + Guid.NewGuid()); var message = "hello"; @@ -615,13 +614,13 @@ public Task WebSocketClient_ResponseCloseInDifferentThread(Executor executor1, E await client.CloseAsync(WebSocketCloseStatus.NormalClosure, "bye", CancellationToken.None); }; - return ActionsInDifferentThreads(executor1, executor2, e1Job, e2Job, cts); + await ActionsInDifferentThreads(executor1, executor2, e1Job, e2Job, cts); } [Theory, MemberData(nameof(GetTargetThreads2x))] - public Task WebSocketClient_CancelInDifferentThread(Executor executor1, Executor executor2) + public async Task WebSocketClient_CancelInDifferentThread(Executor executor1, Executor executor2) { - var cts = new CancellationTokenSource(); + using var cts = CreateTestCaseTimeoutSource(); var uri = new Uri(WebWorkerTestHelper.LocalWsEcho + "?guid=" + Guid.NewGuid()); var message = ".delay5sec"; // this will make the loopback server slower @@ -648,7 +647,7 @@ public Task WebSocketClient_CancelInDifferentThread(Executor executor1, Executor Assert.Equal(cts2.Token, ex.CancellationToken); }; - return ActionsInDifferentThreads(executor1, executor2, e1Job, e2Job, cts); + await ActionsInDifferentThreads(executor1, executor2, e1Job, e2Job, cts); } #endregion @@ -676,9 +675,9 @@ await executor.Execute(async () => private static string HelloJson = "{'hello':'world'}".Replace('\'', '"'); private static string EchoStart = "{\"Method\":\"POST\",\"Url\":\"/Echo.ashx"; - private Task HttpClient_ActionInDifferentThread(string url, Executor executor1, Executor executor2, Func e2Job) + private async Task HttpClient_ActionInDifferentThread(string url, Executor executor1, Executor executor2, Func e2Job) { - var cts = new CancellationTokenSource(); + using var cts = CreateTestCaseTimeoutSource(); var e1Job = async (Task e2done, TaskCompletionSource e1State) => { @@ -697,7 +696,7 @@ private Task HttpClient_ActionInDifferentThread(string url, Executor executor1, await e2done; }; - return ActionsInDifferentThreads(executor1, executor2, e1Job, e2Job, cts); + await ActionsInDifferentThreads(executor1, executor2, e1Job, e2Job, cts); } [Theory, MemberData(nameof(GetTargetThreads2x))] From 8f8f46456d285c0bc18fe2e37e8af4f8aaa2f591 Mon Sep 17 00:00:00 2001 From: pavelsavara Date: Tue, 23 Jan 2024 19:15:31 +0100 Subject: [PATCH 22/25] more --- .../Net8Tests/System.Numerics.Tensors.Net8.Tests.csproj | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/libraries/System.Numerics.Tensors/tests/Net8Tests/System.Numerics.Tensors.Net8.Tests.csproj b/src/libraries/System.Numerics.Tensors/tests/Net8Tests/System.Numerics.Tensors.Net8.Tests.csproj index eb08d0e5974a6f..90b06a110963b5 100644 --- a/src/libraries/System.Numerics.Tensors/tests/Net8Tests/System.Numerics.Tensors.Net8.Tests.csproj +++ b/src/libraries/System.Numerics.Tensors/tests/Net8Tests/System.Numerics.Tensors.Net8.Tests.csproj @@ -12,6 +12,11 @@ true + + + $(WasmXHarnessMonoArgs) --setenv=XHARNESS_LOG_TEST_START=true + + From 562e5d943dc508d966bb20a9cf7ad8800ce3c3a1 Mon Sep 17 00:00:00 2001 From: pavelsavara Date: Tue, 23 Jan 2024 19:17:19 +0100 Subject: [PATCH 23/25] more --- .../tests/System.Numerics.Tensors.Tests.csproj | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/libraries/System.Numerics.Tensors/tests/System.Numerics.Tensors.Tests.csproj b/src/libraries/System.Numerics.Tensors/tests/System.Numerics.Tensors.Tests.csproj index 4a508197cae5e0..f6d7643fae0558 100644 --- a/src/libraries/System.Numerics.Tensors/tests/System.Numerics.Tensors.Tests.csproj +++ b/src/libraries/System.Numerics.Tensors/tests/System.Numerics.Tensors.Tests.csproj @@ -5,6 +5,11 @@ true + + + $(WasmXHarnessMonoArgs) --setenv=XHARNESS_LOG_TEST_START=true + + false From 4dc25d657438a1f5ea38cc26ef6be1d35a85b872 Mon Sep 17 00:00:00 2001 From: pavelsavara Date: Wed, 24 Jan 2024 09:05:07 +0100 Subject: [PATCH 24/25] more --- .../tests/Net8Tests/System.Numerics.Tensors.Net8.Tests.csproj | 2 ++ .../tests/System.Numerics.Tensors.Tests.csproj | 2 ++ .../tests/RangePartitioner1Chunk.cs | 1 + src/libraries/sendtohelix-browser.targets | 4 ++++ 4 files changed, 9 insertions(+) diff --git a/src/libraries/System.Numerics.Tensors/tests/Net8Tests/System.Numerics.Tensors.Net8.Tests.csproj b/src/libraries/System.Numerics.Tensors/tests/Net8Tests/System.Numerics.Tensors.Net8.Tests.csproj index 90b06a110963b5..e789fc58d0e610 100644 --- a/src/libraries/System.Numerics.Tensors/tests/Net8Tests/System.Numerics.Tensors.Net8.Tests.csproj +++ b/src/libraries/System.Numerics.Tensors/tests/Net8Tests/System.Numerics.Tensors.Net8.Tests.csproj @@ -15,6 +15,8 @@ $(WasmXHarnessMonoArgs) --setenv=XHARNESS_LOG_TEST_START=true + + 01:15:00 diff --git a/src/libraries/System.Numerics.Tensors/tests/System.Numerics.Tensors.Tests.csproj b/src/libraries/System.Numerics.Tensors/tests/System.Numerics.Tensors.Tests.csproj index f6d7643fae0558..65975d9bc6c9f5 100644 --- a/src/libraries/System.Numerics.Tensors/tests/System.Numerics.Tensors.Tests.csproj +++ b/src/libraries/System.Numerics.Tensors/tests/System.Numerics.Tensors.Tests.csproj @@ -8,6 +8,8 @@ $(WasmXHarnessMonoArgs) --setenv=XHARNESS_LOG_TEST_START=true + + 01:15:00 diff --git a/src/libraries/System.Threading.Tasks.Parallel/tests/RangePartitioner1Chunk.cs b/src/libraries/System.Threading.Tasks.Parallel/tests/RangePartitioner1Chunk.cs index 8afcec80958f5d..c01449dc5d6742 100644 --- a/src/libraries/System.Threading.Tasks.Parallel/tests/RangePartitioner1Chunk.cs +++ b/src/libraries/System.Threading.Tasks.Parallel/tests/RangePartitioner1Chunk.cs @@ -167,6 +167,7 @@ public static void PFEDisposeEnum() /// Exception is expected and the enumerators are disposed /// [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))] + [ActiveIssue("https://github.com/dotnet/runtime/issues/91581", typeof(PlatformDetection), nameof(PlatformDetection.IsWasmThreadingSupported))] public static void ExceptionOnMoveNext() { static void exceptionOnMoveNext(int length, int indexToThrow, bool isOrderable) diff --git a/src/libraries/sendtohelix-browser.targets b/src/libraries/sendtohelix-browser.targets index f710cb8893df73..3cccb3fb641b8f 100644 --- a/src/libraries/sendtohelix-browser.targets +++ b/src/libraries/sendtohelix-browser.targets @@ -239,6 +239,8 @@ 01:20:00 01:20:00 01:20:00 + 01:20:00 + 01:20:00 @@ -266,6 +268,8 @@ 01:20:00 01:20:00 01:20:00 + 01:20:00 + 01:20:00 From 30dccd43c3e75534b700e3b34275ce4844ec69e2 Mon Sep 17 00:00:00 2001 From: pavelsavara Date: Wed, 24 Jan 2024 09:18:44 +0100 Subject: [PATCH 25/25] more --- .../tests/RangePartitionerTests.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/libraries/System.Threading.Tasks.Parallel/tests/RangePartitionerTests.cs b/src/libraries/System.Threading.Tasks.Parallel/tests/RangePartitionerTests.cs index 87e427d0837ece..e9452695618ea9 100644 --- a/src/libraries/System.Threading.Tasks.Parallel/tests/RangePartitionerTests.cs +++ b/src/libraries/System.Threading.Tasks.Parallel/tests/RangePartitionerTests.cs @@ -10,6 +10,7 @@ namespace System.Threading.Tasks.Tests public static class RangePartitionerTests { [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))] + [ActiveIssue("https://github.com/dotnet/runtime/issues/97440", typeof(PlatformDetection), nameof(PlatformDetection.IsWasmThreadingSupported))] public static void RunPartitionerStaticTest_SingleChunking() { CountdownEvent cde = new CountdownEvent(2);