diff --git a/eng/InstallRuntimes.proj b/eng/InstallRuntimes.proj
index 64fee58a67..b24e74d410 100644
--- a/eng/InstallRuntimes.proj
+++ b/eng/InstallRuntimes.proj
@@ -63,7 +63,7 @@
+ DependsOnTargets="CleanupVersionManifest;InstallRuntimesWindows;InstallRuntimesUnix;InstallHostRuntimeX86;InstallBuildSdk;OverrideLatestRuntime;WriteTestVersionManifest" />
+
+
+
+
+
+
diff --git a/eng/build.ps1 b/eng/build.ps1
index 0f64647493..57d8118e0d 100644
--- a/eng/build.ps1
+++ b/eng/build.ps1
@@ -114,14 +114,27 @@ if ($test) {
$env:SOS_TEST_INTERPRETER="true"
}
- # Build the test filter argument if provided
- # Use backslash-escaped quotes so they survive the additional quoting in tools.ps1
+ # Build the test filter argument if provided.
+ # Tests run as xUnit v3 / Microsoft.Testing.Platform executables, so use the MTP
+ # filter options (--filter-method / --filter-class) instead of the old xunit.console
+ # -method / -class flags.
+ # Use backslash-escaped quotes so they survive the additional quoting in tools.ps1.
+ #
+ # A filter is applied to EVERY project in the test traversal, so projects that don't
+ # contain a matching test legitimately run zero tests. MTP returns exit code 8 ("zero
+ # tests ran") in that case, which Arcade would otherwise treat as a failure. Append
+ # --ignore-exit-code 8 so those non-matching projects don't fail the run. The trade-off
+ # (a mistyped filter that matches nothing anywhere would pass silently) is covered by the
+ # "at least one test ran" guard after the test run below.
+ $testFilterActive = $false
$testFilterArg = ''
if ($methodfilter -ne '') {
- $testFilterArg = "/p:TestRunnerAdditionalArguments=\`"-method $methodfilter\`""
+ $testFilterActive = $true
+ $testFilterArg = "/p:TestRunnerAdditionalArguments=\`"--filter-method $methodfilter --ignore-exit-code 8\`""
}
elseif ($classfilter -ne '') {
- $testFilterArg = "/p:TestRunnerAdditionalArguments=\`"-class $classfilter\`""
+ $testFilterActive = $true
+ $testFilterArg = "/p:TestRunnerAdditionalArguments=\`"--filter-class $classfilter --ignore-exit-code 8\`""
}
# When the managed build was skipped (e.g. the test-only CI legs that download prebuilt
@@ -146,6 +159,17 @@ if ($test) {
}
}
+ # When a filter is active it is applied to every project in the traversal, so non-matching
+ # projects run zero tests. --ignore-exit-code 8 (added to $testFilterArg above) keeps those
+ # from failing the run; to still catch a filter that matches nothing ANYWHERE, count the
+ # tests that ran after the build. Clear this run's result XMLs first so the post-run count
+ # only reflects the current run (result file names embed the target framework, so stale
+ # files from a previous run would not otherwise be overwritten).
+ $resultsDir = Join-Path (Join-Path $artifactsdir "TestResults") $configuration
+ if ($testFilterActive -and (Test-Path $resultsDir)) {
+ Remove-Item (Join-Path $resultsDir "*.xml") -Force -ErrorAction SilentlyContinue
+ }
+
& "$engroot\common\build.ps1" `
-test `
-restore:$skipmanaged `
@@ -167,5 +191,26 @@ if ($test) {
if ($lastExitCode -ne 0) {
exit $lastExitCode
}
+
+ # Guard against a filter that silently matches nothing (see note above): sum the test
+ # counts from the xUnit result XMLs this run produced and fail if nothing ran.
+ if ($testFilterActive) {
+ $testsRan = 0
+ if (Test-Path $resultsDir) {
+ foreach ($xml in Get-ChildItem $resultsDir -Filter *.xml -File -ErrorAction SilentlyContinue) {
+ try {
+ [xml]$doc = Get-Content -LiteralPath $xml.FullName -Raw
+ foreach ($asm in @($doc.assemblies.assembly)) {
+ if ($asm -and $asm.total) { $testsRan += [int]$asm.total }
+ }
+ } catch { }
+ }
+ }
+ if ($testsRan -eq 0) {
+ Write-Host "ERROR: The test filter matched zero tests across all projects. Check the -methodfilter/-classfilter value." -ForegroundColor Red
+ exit 1
+ }
+ Write-Host "Test filter matched $testsRan test(s) across the run." -ForegroundColor Green
+ }
}
}
diff --git a/eng/build.sh b/eng/build.sh
index 76a5874586..45da6eaa5a 100755
--- a/eng/build.sh
+++ b/eng/build.sh
@@ -108,12 +108,12 @@ handle_arguments() {
;;
methodfilter|-methodfilter)
- __TestFilter="-method $2"
+ __TestFilter="--filter-method $2"
__ShiftArgs=1
;;
classfilter|-classfilter)
- __TestFilter="-class $2"
+ __TestFilter="--filter-class $2"
__ShiftArgs=1
;;
@@ -347,10 +347,19 @@ if [[ "$__Test" == 1 ]]; then
export SOS_TEST_INTERPRETER="true"
fi
- # Build the test filter argument if provided
+ # Build the test filter argument if provided.
+ #
+ # A filter is applied to EVERY project in the test traversal, so projects that don't
+ # contain a matching test legitimately run zero tests. MTP returns exit code 8 ("zero
+ # tests ran") in that case, which Arcade would otherwise treat as a failure. Append
+ # --ignore-exit-code 8 so those non-matching projects don't fail the run. The trade-off
+ # (a mistyped filter that matches nothing anywhere would pass silently) is covered by the
+ # "at least one test ran" guard after the test run below.
__TestFilterArg=
+ __TestFilterActive=0
if [[ -n "$__TestFilter" ]]; then
- __TestFilterArg="/p:TestRunnerAdditionalArguments=\"$__TestFilter\""
+ __TestFilterActive=1
+ __TestFilterArg="/p:TestRunnerAdditionalArguments=\"$__TestFilter --ignore-exit-code 8\""
fi
# When the managed build was skipped (e.g. the test-only CI legs that download prebuilt
@@ -377,6 +386,17 @@ if [[ "$__Test" == 1 ]]; then
fi
fi
+ # When a filter is active it is applied to every project in the traversal, so non-matching
+ # projects run zero tests. --ignore-exit-code 8 (added to __TestFilterArg above) keeps those
+ # from failing the run; to still catch a filter that matches nothing ANYWHERE, count the
+ # tests that ran after the build. Clear this run's result XMLs first so the post-run count
+ # only reflects the current run (result file names embed the target framework, so stale
+ # files from a previous run would not otherwise be overwritten).
+ __ResultsDir="$__RootBinDir/TestResults/$__BuildType"
+ if [[ "$__TestFilterActive" == 1 && -d "$__ResultsDir" ]]; then
+ rm -f "$__ResultsDir"/*.xml
+ fi
+
# __CommonMSBuildArgs contains TargetOS property
"$__RepoRootDir/eng/common/build.sh" \
--test \
@@ -397,6 +417,23 @@ if [[ "$__Test" == 1 ]]; then
if [ $? != 0 ]; then
exit 1
fi
+
+ # Guard against a filter that silently matches nothing (see note above): sum the test
+ # counts from the xUnit result XMLs this run produced and fail if nothing ran.
+ if [[ "$__TestFilterActive" == 1 ]]; then
+ __TestsRan=0
+ if [[ -d "$__ResultsDir" ]]; then
+ __TestsRan=$(cat "$__ResultsDir"/*.xml 2>/dev/null | grep -oE ']*total="[0-9]+"' | grep -oE 'total="[0-9]+"' | grep -oE '[0-9]+' | awk '{s+=$1} END {print s+0}')
+ fi
+ if [[ -z "$__TestsRan" ]]; then
+ __TestsRan=0
+ fi
+ if [[ "$__TestsRan" == 0 ]]; then
+ echo "ERROR: The test filter matched zero tests across all projects. Check the -methodfilter/-classfilter value."
+ exit 1
+ fi
+ echo "Test filter matched $__TestsRan test(s) across the run."
+ fi
fi
fi
diff --git a/global.json b/global.json
index c551a87c31..4aafc89647 100644
--- a/global.json
+++ b/global.json
@@ -4,13 +4,11 @@
"allowPrerelease": true,
"rollForward": "major"
},
+ "test": {
+ "runner": "Microsoft.Testing.Platform"
+ },
"tools": {
- "dotnet": "10.0.110",
- "runtimes": {
- "dotnet/x86": [
- "$(MicrosoftNETCoreApp100Version)"
- ]
- }
+ "dotnet": "10.0.110"
},
"msbuild-sdks": {
"Microsoft.Build.NoTargets": "3.7.0",
diff --git a/src/Microsoft.Diagnostics.TestHelpers/AcquireDotNetTestStep.cs b/src/Microsoft.Diagnostics.TestHelpers/AcquireDotNetTestStep.cs
index 1bdb2cccbc..1c257442b4 100644
--- a/src/Microsoft.Diagnostics.TestHelpers/AcquireDotNetTestStep.cs
+++ b/src/Microsoft.Diagnostics.TestHelpers/AcquireDotNetTestStep.cs
@@ -6,7 +6,7 @@
using System.IO.Compression;
using System.Net.Http;
using System.Threading.Tasks;
-using Xunit.Abstractions;
+using Xunit;
namespace Microsoft.Diagnostics.TestHelpers
{
diff --git a/src/Microsoft.Diagnostics.TestHelpers/AssertX.cs b/src/Microsoft.Diagnostics.TestHelpers/AssertX.cs
index cbb1a9455a..1b107644b0 100644
--- a/src/Microsoft.Diagnostics.TestHelpers/AssertX.cs
+++ b/src/Microsoft.Diagnostics.TestHelpers/AssertX.cs
@@ -3,7 +3,7 @@
using System;
using System.IO;
-using Xunit.Abstractions;
+using Xunit;
namespace Microsoft.Diagnostics.TestHelpers
{
diff --git a/src/Microsoft.Diagnostics.TestHelpers/BaseDebuggeeCompiler.cs b/src/Microsoft.Diagnostics.TestHelpers/BaseDebuggeeCompiler.cs
index d5db5c5086..a66107ab9b 100644
--- a/src/Microsoft.Diagnostics.TestHelpers/BaseDebuggeeCompiler.cs
+++ b/src/Microsoft.Diagnostics.TestHelpers/BaseDebuggeeCompiler.cs
@@ -5,7 +5,7 @@
using System.Collections.Generic;
using System.IO;
using System.Threading.Tasks;
-using Xunit.Abstractions;
+using Xunit;
namespace Microsoft.Diagnostics.TestHelpers
{
diff --git a/src/Microsoft.Diagnostics.TestHelpers/ConsoleTestOutputHelper.cs b/src/Microsoft.Diagnostics.TestHelpers/ConsoleTestOutputHelper.cs
index 4ea7b609ee..8a84579605 100644
--- a/src/Microsoft.Diagnostics.TestHelpers/ConsoleTestOutputHelper.cs
+++ b/src/Microsoft.Diagnostics.TestHelpers/ConsoleTestOutputHelper.cs
@@ -2,12 +2,26 @@
// The .NET Foundation licenses this file to you under the MIT license.
using System;
-using Xunit.Abstractions;
+using Xunit;
namespace Microsoft.Diagnostics.TestHelpers
{
public class ConsoleTestOutputHelper : ITestOutputHelper
{
+ public string Output => string.Empty;
+
+ public void Write(string message)
+ {
+ Console.Write(message);
+ Console.Out.Flush();
+ }
+
+ public void Write(string format, params object[] args)
+ {
+ Console.Write(format, args);
+ Console.Out.Flush();
+ }
+
public void WriteLine(string message)
{
Console.WriteLine(message);
diff --git a/src/Microsoft.Diagnostics.TestHelpers/CsprojBuildDebuggeeTestStep.cs b/src/Microsoft.Diagnostics.TestHelpers/CsprojBuildDebuggeeTestStep.cs
index f17a0d9e00..6b1fb64b65 100644
--- a/src/Microsoft.Diagnostics.TestHelpers/CsprojBuildDebuggeeTestStep.cs
+++ b/src/Microsoft.Diagnostics.TestHelpers/CsprojBuildDebuggeeTestStep.cs
@@ -5,7 +5,7 @@
using System.IO;
using System.Threading.Tasks;
using System.Xml.Linq;
-using Xunit.Abstractions;
+using Xunit;
namespace Microsoft.Diagnostics.TestHelpers
{
diff --git a/src/Microsoft.Diagnostics.TestHelpers/DebuggeeCompiler.cs b/src/Microsoft.Diagnostics.TestHelpers/DebuggeeCompiler.cs
index ce74a318ea..be34d38f37 100644
--- a/src/Microsoft.Diagnostics.TestHelpers/DebuggeeCompiler.cs
+++ b/src/Microsoft.Diagnostics.TestHelpers/DebuggeeCompiler.cs
@@ -3,7 +3,7 @@
using System;
using System.Threading.Tasks;
-using Xunit.Abstractions;
+using Xunit;
namespace Microsoft.Diagnostics.TestHelpers
{
diff --git a/src/Microsoft.Diagnostics.TestHelpers/DotNetBuildDebuggeeTestStep.cs b/src/Microsoft.Diagnostics.TestHelpers/DotNetBuildDebuggeeTestStep.cs
index 3df7b4a512..0839fc80b8 100644
--- a/src/Microsoft.Diagnostics.TestHelpers/DotNetBuildDebuggeeTestStep.cs
+++ b/src/Microsoft.Diagnostics.TestHelpers/DotNetBuildDebuggeeTestStep.cs
@@ -7,7 +7,7 @@
using System.Text;
using System.Threading;
using System.Threading.Tasks;
-using Xunit.Abstractions;
+using Xunit;
namespace Microsoft.Diagnostics.TestHelpers
{
diff --git a/src/Microsoft.Diagnostics.TestHelpers/FileTestOutputHelper.cs b/src/Microsoft.Diagnostics.TestHelpers/FileTestOutputHelper.cs
index e3eba6f5cf..2d553231cb 100644
--- a/src/Microsoft.Diagnostics.TestHelpers/FileTestOutputHelper.cs
+++ b/src/Microsoft.Diagnostics.TestHelpers/FileTestOutputHelper.cs
@@ -3,7 +3,7 @@
using System;
using System.IO;
-using Xunit.Abstractions;
+using Xunit;
namespace Microsoft.Diagnostics.TestHelpers
{
@@ -24,6 +24,24 @@ public FileTestOutputHelper(string logFilePath, FileMode fileMode = FileMode.Cre
_lock = new object();
}
+ public string Output => string.Empty;
+
+ public void Write(string message)
+ {
+ lock (_lock)
+ {
+ _logWriter.Write(message);
+ }
+ }
+
+ public void Write(string format, params object[] args)
+ {
+ lock (_lock)
+ {
+ _logWriter.Write(format, args);
+ }
+ }
+
public void WriteLine(string message)
{
lock (_lock)
diff --git a/src/Microsoft.Diagnostics.TestHelpers/IndentedTestOutputHelper.cs b/src/Microsoft.Diagnostics.TestHelpers/IndentedTestOutputHelper.cs
index 8e60b403a7..e56796afce 100644
--- a/src/Microsoft.Diagnostics.TestHelpers/IndentedTestOutputHelper.cs
+++ b/src/Microsoft.Diagnostics.TestHelpers/IndentedTestOutputHelper.cs
@@ -1,7 +1,7 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
-using Xunit.Abstractions;
+using Xunit;
namespace Microsoft.Diagnostics.TestHelpers
{
@@ -20,6 +20,18 @@ public IndentedTestOutputHelper(ITestOutputHelper innerOutput, string indentText
_indentText = indentText;
}
+ public string Output => _output.Output;
+
+ public void Write(string message)
+ {
+ _output.Write(_indentText + message);
+ }
+
+ public void Write(string format, params object[] args)
+ {
+ _output.Write(_indentText + format, args);
+ }
+
public void WriteLine(string message)
{
_output.WriteLine(_indentText + message);
diff --git a/src/Microsoft.Diagnostics.TestHelpers/LoggingListener.cs b/src/Microsoft.Diagnostics.TestHelpers/LoggingListener.cs
index 991325b862..61c0216206 100644
--- a/src/Microsoft.Diagnostics.TestHelpers/LoggingListener.cs
+++ b/src/Microsoft.Diagnostics.TestHelpers/LoggingListener.cs
@@ -4,7 +4,7 @@
using System;
using System.Diagnostics;
using Microsoft.Diagnostics.DebugServices.Implementation;
-using Xunit.Abstractions;
+using Xunit;
namespace Microsoft.Diagnostics.TestHelpers
{
diff --git a/src/Microsoft.Diagnostics.TestHelpers/Microsoft.Diagnostics.TestHelpers.csproj b/src/Microsoft.Diagnostics.TestHelpers/Microsoft.Diagnostics.TestHelpers.csproj
index 4e3df14e84..382974308f 100644
--- a/src/Microsoft.Diagnostics.TestHelpers/Microsoft.Diagnostics.TestHelpers.csproj
+++ b/src/Microsoft.Diagnostics.TestHelpers/Microsoft.Diagnostics.TestHelpers.csproj
@@ -14,8 +14,8 @@
-
-
+
+
diff --git a/src/Microsoft.Diagnostics.TestHelpers/MultiplexTestOutputHelper.cs b/src/Microsoft.Diagnostics.TestHelpers/MultiplexTestOutputHelper.cs
index 539398e8fe..a85c695af6 100644
--- a/src/Microsoft.Diagnostics.TestHelpers/MultiplexTestOutputHelper.cs
+++ b/src/Microsoft.Diagnostics.TestHelpers/MultiplexTestOutputHelper.cs
@@ -1,7 +1,8 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
-using Xunit.Abstractions;
+using System.Text;
+using Xunit;
namespace Microsoft.Diagnostics.TestHelpers
{
@@ -14,6 +15,35 @@ public MultiplexTestOutputHelper(params ITestOutputHelper[] outputs)
_outputs = outputs;
}
+ public string Output
+ {
+ get
+ {
+ StringBuilder builder = new();
+ foreach (ITestOutputHelper output in _outputs)
+ {
+ builder.Append(output.Output);
+ }
+ return builder.ToString();
+ }
+ }
+
+ public void Write(string message)
+ {
+ foreach (ITestOutputHelper output in _outputs)
+ {
+ output.Write(message);
+ }
+ }
+
+ public void Write(string format, params object[] args)
+ {
+ foreach (ITestOutputHelper output in _outputs)
+ {
+ output.Write(format, args);
+ }
+ }
+
public void WriteLine(string message)
{
foreach (ITestOutputHelper output in _outputs)
diff --git a/src/Microsoft.Diagnostics.TestHelpers/PrebuiltDebuggeeCompiler.cs b/src/Microsoft.Diagnostics.TestHelpers/PrebuiltDebuggeeCompiler.cs
index 218aa5196c..429e3aa9e9 100644
--- a/src/Microsoft.Diagnostics.TestHelpers/PrebuiltDebuggeeCompiler.cs
+++ b/src/Microsoft.Diagnostics.TestHelpers/PrebuiltDebuggeeCompiler.cs
@@ -3,7 +3,7 @@
using System.IO;
using System.Threading.Tasks;
-using Xunit.Abstractions;
+using Xunit;
namespace Microsoft.Diagnostics.TestHelpers
{
diff --git a/src/Microsoft.Diagnostics.TestHelpers/ProcessRunner.cs b/src/Microsoft.Diagnostics.TestHelpers/ProcessRunner.cs
index fde12ad22a..f82ba75a3d 100644
--- a/src/Microsoft.Diagnostics.TestHelpers/ProcessRunner.cs
+++ b/src/Microsoft.Diagnostics.TestHelpers/ProcessRunner.cs
@@ -9,7 +9,7 @@
using System.Runtime.InteropServices;
using System.Threading;
using System.Threading.Tasks;
-using Xunit.Abstractions;
+using Xunit;
namespace Microsoft.Diagnostics.TestHelpers
{
@@ -489,6 +489,20 @@ public ConsoleTestOutputHelper(ITestOutputHelper output)
_output = output;
}
+ public string Output => _output?.Output ?? string.Empty;
+
+ public void Write(string message)
+ {
+ Console.Write(message);
+ _output?.Write(message);
+ }
+
+ public void Write(string format, params object[] args)
+ {
+ Console.Write(format, args);
+ _output?.Write(format, args);
+ }
+
public void WriteLine(string message)
{
Console.WriteLine(message);
diff --git a/src/Microsoft.Diagnostics.TestHelpers/RemoteExecutorHelper.cs b/src/Microsoft.Diagnostics.TestHelpers/RemoteExecutorHelper.cs
index 1ba0c666e6..61ed34e370 100644
--- a/src/Microsoft.Diagnostics.TestHelpers/RemoteExecutorHelper.cs
+++ b/src/Microsoft.Diagnostics.TestHelpers/RemoteExecutorHelper.cs
@@ -8,7 +8,7 @@
using System.Threading.Tasks;
using Microsoft.Diagnostics.NETCore.Client;
using Microsoft.DotNet.RemoteExecutor;
-using Xunit.Abstractions;
+using Xunit;
using Xunit.Sdk;
namespace Microsoft.Diagnostics.TestHelpers
diff --git a/src/Microsoft.Diagnostics.TestHelpers/SdkPrebuiltDebuggeeCompiler.cs b/src/Microsoft.Diagnostics.TestHelpers/SdkPrebuiltDebuggeeCompiler.cs
index ebc4105d43..4417d92ddc 100644
--- a/src/Microsoft.Diagnostics.TestHelpers/SdkPrebuiltDebuggeeCompiler.cs
+++ b/src/Microsoft.Diagnostics.TestHelpers/SdkPrebuiltDebuggeeCompiler.cs
@@ -3,7 +3,7 @@
using System.IO;
using System.Threading.Tasks;
-using Xunit.Abstractions;
+using Xunit;
namespace Microsoft.Diagnostics.TestHelpers
{
diff --git a/src/Microsoft.Diagnostics.TestHelpers/TestConfiguration.cs b/src/Microsoft.Diagnostics.TestHelpers/TestConfiguration.cs
index bd3112cfe8..9a7a3c1864 100644
--- a/src/Microsoft.Diagnostics.TestHelpers/TestConfiguration.cs
+++ b/src/Microsoft.Diagnostics.TestHelpers/TestConfiguration.cs
@@ -376,7 +376,13 @@ public partial class TestConfiguration
public static TestConfiguration Empty { get; } = new TestConfiguration();
- public static string BaseDir { get; set; } = Path.GetFullPath(".");
+ // Default to the directory containing the test assembly (where Debugger.Tests.Config.txt
+ // and the other test assets are copied) rather than the current working directory. Under
+ // the classic xunit.console runner the working directory happened to be the output
+ // directory, so "." resolved correctly; the Microsoft.Testing.Platform runner launches the
+ // test executable with a different working directory, so relying on "." no longer finds the
+ // config file. Callers can still override this.
+ public static string BaseDir { get; set; } = Path.GetFullPath(AppContext.BaseDirectory);
private static readonly Regex versionRegex = GetVersionRegex();
diff --git a/src/Microsoft.Diagnostics.TestHelpers/TestOutputProcessLogger.cs b/src/Microsoft.Diagnostics.TestHelpers/TestOutputProcessLogger.cs
index 426abef2d8..1242d158d4 100644
--- a/src/Microsoft.Diagnostics.TestHelpers/TestOutputProcessLogger.cs
+++ b/src/Microsoft.Diagnostics.TestHelpers/TestOutputProcessLogger.cs
@@ -5,7 +5,7 @@
using System.Collections.Generic;
using System.Linq;
using System.Text;
-using Xunit.Abstractions;
+using Xunit;
namespace Microsoft.Diagnostics.TestHelpers
{
diff --git a/src/Microsoft.Diagnostics.TestHelpers/TestRunner.cs b/src/Microsoft.Diagnostics.TestHelpers/TestRunner.cs
index 433eb94e0b..7bf8216c0e 100644
--- a/src/Microsoft.Diagnostics.TestHelpers/TestRunner.cs
+++ b/src/Microsoft.Diagnostics.TestHelpers/TestRunner.cs
@@ -7,7 +7,7 @@
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
-using Xunit.Abstractions;
+using Xunit;
namespace Microsoft.Diagnostics.TestHelpers
{
@@ -165,6 +165,22 @@ public OutputHelper(ITestOutputHelper output, FileTestOutputHelper fileLogger, C
IndentedOutput = new IndentedTestOutputHelper(this);
}
+ public string Output => _output.Output;
+
+ public void Write(string message)
+ {
+ _output.Write(message);
+ _fileLogger?.Write(message);
+ _consoleLogger?.Write(message);
+ }
+
+ public void Write(string format, params object[] args)
+ {
+ _output.Write(format, args);
+ _fileLogger?.Write(format, args);
+ _consoleLogger?.Write(format, args);
+ }
+
public void WriteLine(string message)
{
_output.WriteLine(message);
diff --git a/src/Microsoft.Diagnostics.TestHelpers/TestStep.cs b/src/Microsoft.Diagnostics.TestHelpers/TestStep.cs
index edcd180c49..98e47c99bd 100644
--- a/src/Microsoft.Diagnostics.TestHelpers/TestStep.cs
+++ b/src/Microsoft.Diagnostics.TestHelpers/TestStep.cs
@@ -10,7 +10,7 @@
using System.Threading.Tasks;
using System.Xml;
using System.Xml.Linq;
-using Xunit.Abstractions;
+using Xunit;
namespace Microsoft.Diagnostics.TestHelpers
{
diff --git a/src/Microsoft.Diagnostics.TestHelpers/Xunit.Extensions/SkipTestException.cs b/src/Microsoft.Diagnostics.TestHelpers/Xunit.Extensions/SkipTestException.cs
index ee26f404b7..104a4be1fe 100644
--- a/src/Microsoft.Diagnostics.TestHelpers/Xunit.Extensions/SkipTestException.cs
+++ b/src/Microsoft.Diagnostics.TestHelpers/Xunit.Extensions/SkipTestException.cs
@@ -5,9 +5,17 @@
namespace Xunit.Extensions
{
+ ///
+ /// Exception that dynamically skips a test under xUnit v3. The message is prefixed
+ /// with the dynamic-skip token so the xUnit v3 runner reports the test as skipped
+ /// (the same mechanism used by Assert.Skip) instead of failed.
+ ///
public class SkipTestException : Exception
{
+ // Mirrors the internal Xunit.Sdk.DynamicSkipToken.Value constant from xunit.v3.assert.
+ private const string DynamicSkipToken = "$XunitDynamicSkip$";
+
public SkipTestException(string reason)
- : base(reason) { }
+ : base(DynamicSkipToken + reason) { }
}
}
diff --git a/src/Microsoft.Diagnostics.TestHelpers/Xunit.Extensions/SkippableFactAttribute.cs b/src/Microsoft.Diagnostics.TestHelpers/Xunit.Extensions/SkippableFactAttribute.cs
deleted file mode 100644
index b6b44f497b..0000000000
--- a/src/Microsoft.Diagnostics.TestHelpers/Xunit.Extensions/SkippableFactAttribute.cs
+++ /dev/null
@@ -1,10 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-
-using Xunit.Sdk;
-
-namespace Xunit.Extensions
-{
- [XunitTestCaseDiscoverer("Xunit.Extensions.SkippableFactDiscoverer", "Microsoft.Diagnostics.TestHelpers")]
- public class SkippableFactAttribute : FactAttribute { }
-}
diff --git a/src/Microsoft.Diagnostics.TestHelpers/Xunit.Extensions/SkippableFactDiscoverer.cs b/src/Microsoft.Diagnostics.TestHelpers/Xunit.Extensions/SkippableFactDiscoverer.cs
deleted file mode 100644
index 9451db2b8b..0000000000
--- a/src/Microsoft.Diagnostics.TestHelpers/Xunit.Extensions/SkippableFactDiscoverer.cs
+++ /dev/null
@@ -1,24 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-
-using System.Collections.Generic;
-using Xunit.Abstractions;
-using Xunit.Sdk;
-
-namespace Xunit.Extensions
-{
- public class SkippableFactDiscoverer : IXunitTestCaseDiscoverer
- {
- private readonly IMessageSink diagnosticMessageSink;
-
- public SkippableFactDiscoverer(IMessageSink diagnosticMessageSink)
- {
- this.diagnosticMessageSink = diagnosticMessageSink;
- }
-
- public IEnumerable Discover(ITestFrameworkDiscoveryOptions discoveryOptions, ITestMethod testMethod, IAttributeInfo factAttribute)
- {
- yield return new SkippableFactTestCase(diagnosticMessageSink, discoveryOptions.MethodDisplayOrDefault(), discoveryOptions.MethodDisplayOptionsOrDefault(), testMethod);
- }
- }
-}
diff --git a/src/Microsoft.Diagnostics.TestHelpers/Xunit.Extensions/SkippableFactMessageBus.cs b/src/Microsoft.Diagnostics.TestHelpers/Xunit.Extensions/SkippableFactMessageBus.cs
deleted file mode 100644
index b48add3a3e..0000000000
--- a/src/Microsoft.Diagnostics.TestHelpers/Xunit.Extensions/SkippableFactMessageBus.cs
+++ /dev/null
@@ -1,40 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-
-using System.Linq;
-using Xunit.Abstractions;
-using Xunit.Sdk;
-
-namespace Xunit.Extensions
-{
- public class SkippableFactMessageBus : IMessageBus
- {
- private readonly IMessageBus innerBus;
-
- public SkippableFactMessageBus(IMessageBus innerBus)
- {
- this.innerBus = innerBus;
- }
-
- public int DynamicallySkippedTestCount { get; private set; }
-
- public void Dispose() { }
-
- public bool QueueMessage(IMessageSinkMessage message)
- {
- ITestFailed testFailed = message as ITestFailed;
- if (testFailed != null)
- {
- string exceptionType = testFailed.ExceptionTypes.FirstOrDefault();
- if (exceptionType == typeof(SkipTestException).FullName)
- {
- DynamicallySkippedTestCount++;
- return innerBus.QueueMessage(new TestSkipped(testFailed.Test, testFailed.Messages.FirstOrDefault()));
- }
- }
-
- // Nothing we care about, send it on its way
- return innerBus.QueueMessage(message);
- }
- }
-}
diff --git a/src/Microsoft.Diagnostics.TestHelpers/Xunit.Extensions/SkippableFactTestCase.cs b/src/Microsoft.Diagnostics.TestHelpers/Xunit.Extensions/SkippableFactTestCase.cs
deleted file mode 100644
index b56c76341c..0000000000
--- a/src/Microsoft.Diagnostics.TestHelpers/Xunit.Extensions/SkippableFactTestCase.cs
+++ /dev/null
@@ -1,37 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-
-using System;
-using System.Threading;
-using System.Threading.Tasks;
-using Xunit.Abstractions;
-using Xunit.Sdk;
-
-namespace Xunit.Extensions
-{
- public class SkippableFactTestCase : XunitTestCase
- {
- [Obsolete("Called by the de-serializer; should only be called by deriving classes for de-serialization purposes")]
- public SkippableFactTestCase() { }
-
- public SkippableFactTestCase(IMessageSink diagnosticMessageSink, TestMethodDisplay defaultMethodDisplay, TestMethodDisplayOptions defaultMethodDisplayOptions, ITestMethod testMethod, object[] testMethodArguments = null)
- : base(diagnosticMessageSink, defaultMethodDisplay, defaultMethodDisplayOptions, testMethod, testMethodArguments) { }
-
- public override async Task RunAsync(IMessageSink diagnosticMessageSink,
- IMessageBus messageBus,
- object[] constructorArguments,
- ExceptionAggregator aggregator,
- CancellationTokenSource cancellationTokenSource)
- {
- SkippableFactMessageBus skipMessageBus = new(messageBus);
- RunSummary result = await base.RunAsync(diagnosticMessageSink, skipMessageBus, constructorArguments, aggregator, cancellationTokenSource).ConfigureAwait(false);
- if (skipMessageBus.DynamicallySkippedTestCount > 0)
- {
- result.Failed -= skipMessageBus.DynamicallySkippedTestCount;
- result.Skipped += skipMessageBus.DynamicallySkippedTestCount;
- }
-
- return result;
- }
- }
-}
diff --git a/src/Microsoft.Diagnostics.TestHelpers/Xunit.Extensions/SkippableTheoryAttribute.cs b/src/Microsoft.Diagnostics.TestHelpers/Xunit.Extensions/SkippableTheoryAttribute.cs
deleted file mode 100644
index 444c40e098..0000000000
--- a/src/Microsoft.Diagnostics.TestHelpers/Xunit.Extensions/SkippableTheoryAttribute.cs
+++ /dev/null
@@ -1,10 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-
-using Xunit.Sdk;
-
-namespace Xunit.Extensions
-{
- [XunitTestCaseDiscoverer("Xunit.Extensions.SkippableTheoryDiscoverer", "Microsoft.Diagnostics.TestHelpers")]
- public class SkippableTheoryAttribute : TheoryAttribute { }
-}
diff --git a/src/Microsoft.Diagnostics.TestHelpers/Xunit.Extensions/SkippableTheoryDiscoverer.cs b/src/Microsoft.Diagnostics.TestHelpers/Xunit.Extensions/SkippableTheoryDiscoverer.cs
deleted file mode 100644
index ed91b555ee..0000000000
--- a/src/Microsoft.Diagnostics.TestHelpers/Xunit.Extensions/SkippableTheoryDiscoverer.cs
+++ /dev/null
@@ -1,36 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-
-using System.Collections.Generic;
-using System.Linq;
-using Xunit.Abstractions;
-using Xunit.Sdk;
-
-namespace Xunit.Extensions
-{
- public class SkippableTheoryDiscoverer : IXunitTestCaseDiscoverer
- {
- private readonly IMessageSink diagnosticMessageSink;
- private readonly TheoryDiscoverer theoryDiscoverer;
-
- public SkippableTheoryDiscoverer(IMessageSink diagnosticMessageSink)
- {
- this.diagnosticMessageSink = diagnosticMessageSink;
-
- theoryDiscoverer = new TheoryDiscoverer(diagnosticMessageSink);
- }
-
- public IEnumerable Discover(ITestFrameworkDiscoveryOptions discoveryOptions, ITestMethod testMethod, IAttributeInfo factAttribute)
- {
- TestMethodDisplay defaultMethodDisplay = discoveryOptions.MethodDisplayOrDefault();
- TestMethodDisplayOptions defaultMethodDisplayOptions = discoveryOptions.MethodDisplayOptionsOrDefault();
-
- // Unlike fact discovery, the underlying algorithm for theories is complex, so we let the theory discoverer
- // do its work, and do a little on-the-fly conversion into our own test cases.
- return theoryDiscoverer.Discover(discoveryOptions, testMethod, factAttribute)
- .Select(testCase => testCase is XunitTheoryTestCase
- ? (IXunitTestCase)new SkippableTheoryTestCase(diagnosticMessageSink, defaultMethodDisplay, defaultMethodDisplayOptions, testCase.TestMethod)
- : new SkippableFactTestCase(diagnosticMessageSink, defaultMethodDisplay, defaultMethodDisplayOptions, testCase.TestMethod, testCase.TestMethodArguments));
- }
- }
-}
diff --git a/src/Microsoft.Diagnostics.TestHelpers/Xunit.Extensions/SkippableTheoryTestCase.cs b/src/Microsoft.Diagnostics.TestHelpers/Xunit.Extensions/SkippableTheoryTestCase.cs
deleted file mode 100644
index 9dc34df816..0000000000
--- a/src/Microsoft.Diagnostics.TestHelpers/Xunit.Extensions/SkippableTheoryTestCase.cs
+++ /dev/null
@@ -1,38 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-
-using System;
-using System.Threading;
-using System.Threading.Tasks;
-using Xunit.Abstractions;
-using Xunit.Sdk;
-
-namespace Xunit.Extensions
-{
- public class SkippableTheoryTestCase : XunitTheoryTestCase
- {
- [Obsolete("Called by the de-serializer; should only be called by deriving classes for de-serialization purposes")]
- public SkippableTheoryTestCase() { }
-
- public SkippableTheoryTestCase(IMessageSink diagnosticMessageSink, TestMethodDisplay defaultMethodDisplay, TestMethodDisplayOptions defaultMethodDisplayOptions, ITestMethod testMethod)
- : base(diagnosticMessageSink, defaultMethodDisplay, defaultMethodDisplayOptions, testMethod) { }
-
- public override async Task RunAsync(IMessageSink diagnosticMessageSink,
- IMessageBus messageBus,
- object[] constructorArguments,
- ExceptionAggregator aggregator,
- CancellationTokenSource cancellationTokenSource)
- {
- // Duplicated code from SkippableFactTestCase. I'm sure we could find a way to de-dup with some thought.
- SkippableFactMessageBus skipMessageBus = new(messageBus);
- RunSummary result = await base.RunAsync(diagnosticMessageSink, skipMessageBus, constructorArguments, aggregator, cancellationTokenSource).ConfigureAwait(false);
- if (skipMessageBus.DynamicallySkippedTestCount > 0)
- {
- result.Failed -= skipMessageBus.DynamicallySkippedTestCount;
- result.Skipped += skipMessageBus.DynamicallySkippedTestCount;
- }
-
- return result;
- }
- }
-}
diff --git a/src/tests/Common/MockConsole.cs b/src/tests/Common/MockConsole.cs
index 9b864a71f7..bd201805c4 100644
--- a/src/tests/Common/MockConsole.cs
+++ b/src/tests/Common/MockConsole.cs
@@ -1,4 +1,4 @@
-// Licensed to the .NET Foundation under one or more agreements.
+// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using System;
@@ -7,7 +7,6 @@
using System.Text;
using Microsoft.Diagnostics.Tools.Common;
using Xunit;
-using Xunit.Abstractions;
namespace Microsoft.Diagnostics.Tests.Common
{
diff --git a/src/tests/CommonTestRunner/TestRunner.cs b/src/tests/CommonTestRunner/TestRunner.cs
index e42383cc5b..76d0482e95 100644
--- a/src/tests/CommonTestRunner/TestRunner.cs
+++ b/src/tests/CommonTestRunner/TestRunner.cs
@@ -1,4 +1,4 @@
-// Licensed to the .NET Foundation under one or more agreements.
+// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using System;
@@ -14,7 +14,7 @@
using System.Threading;
using System.Threading.Tasks;
using Microsoft.Diagnostics.TestHelpers;
-using Xunit.Abstractions;
+using Xunit;
namespace Microsoft.Diagnostics.CommonTestRunner
{
diff --git a/src/tests/CommonTestRunner/TestRunnerUtilities.cs b/src/tests/CommonTestRunner/TestRunnerUtilities.cs
index 7cbc88b264..ff3ce88574 100644
--- a/src/tests/CommonTestRunner/TestRunnerUtilities.cs
+++ b/src/tests/CommonTestRunner/TestRunnerUtilities.cs
@@ -5,7 +5,7 @@
using System.Threading;
using System.Threading.Tasks;
using Microsoft.Diagnostics.TestHelpers;
-using Xunit.Abstractions;
+using Xunit;
using TestRunner = Microsoft.Diagnostics.CommonTestRunner.TestRunner;
namespace CommonTestRunner
diff --git a/src/tests/DbgShim.UnitTests/DbgShimTests.cs b/src/tests/DbgShim.UnitTests/DbgShimTests.cs
index 118cf2527c..27140e75c1 100644
--- a/src/tests/DbgShim.UnitTests/DbgShimTests.cs
+++ b/src/tests/DbgShim.UnitTests/DbgShimTests.cs
@@ -16,7 +16,6 @@
using Microsoft.Diagnostics.TestHelpers;
using SOS.Hosting;
using Xunit;
-using Xunit.Abstractions;
using Xunit.Extensions;
// Newer SDKs flag MemberData(nameof(Configurations)) with this error
@@ -49,7 +48,7 @@ public DbgShimTests(ITestOutputHelper output)
///
/// Test RegisterForRuntimeStartup for launch
///
- [SkippableTheory, MemberData(nameof(Configurations))]
+ [Theory, MemberData(nameof(Configurations))]
public async Task Launch1(TestConfiguration config)
{
await RemoteInvoke(config, nameof(Launch1), static async (string configXml) => {
@@ -65,7 +64,7 @@ await RemoteInvoke(config, nameof(Launch1), static async (string configXml) => {
///
/// Test RegisterForRuntimeStartupEx for launch
///
- [SkippableTheory, MemberData(nameof(Configurations))]
+ [Theory, MemberData(nameof(Configurations))]
public async Task Launch2(TestConfiguration config)
{
await RemoteInvoke(config, nameof(Launch2), static async (string configXml) => {
@@ -81,7 +80,7 @@ await RemoteInvoke(config, nameof(Launch2), static async (string configXml) => {
///
/// Test RegisterForRuntimeStartup3 for launch
///
- [SkippableTheory, MemberData(nameof(Configurations))]
+ [Theory, MemberData(nameof(Configurations))]
public async Task Launch3(TestConfiguration config)
{
if (OS.Kind == OSKind.OSX && config.PublishSingleFile)
@@ -106,7 +105,7 @@ await RemoteInvoke(config, nameof(Launch3), static async (string configXml) => {
///
/// Test RegisterForRuntimeStartup for attach
///
- [SkippableTheory, MemberData(nameof(Configurations))]
+ [Theory, MemberData(nameof(Configurations))]
public async Task Attach1(TestConfiguration config)
{
await RemoteInvoke(config, nameof(Attach1), static async (string configXml) => {
@@ -119,7 +118,7 @@ await RemoteInvoke(config, nameof(Attach1), static async (string configXml) => {
///
/// Test RegisterForRuntimeStartupEx for attach
///
- [SkippableTheory, MemberData(nameof(Configurations))]
+ [Theory, MemberData(nameof(Configurations))]
public async Task Attach2(TestConfiguration config)
{
await RemoteInvoke(config, nameof(Attach2), static async (string configXml) => {
@@ -132,7 +131,7 @@ await RemoteInvoke(config, nameof(Attach2), static async (string configXml) => {
///
/// Test RegisterForRuntimeStartup3 for attach
///
- [SkippableTheory, MemberData(nameof(Configurations))]
+ [Theory, MemberData(nameof(Configurations))]
public async Task Attach3(TestConfiguration config)
{
if (OS.Kind == OSKind.OSX && config.PublishSingleFile)
@@ -154,7 +153,7 @@ await RemoteInvoke(config, nameof(Attach3), static async (string configXml) => {
///
/// Test EnumerateCLRs/CloseCLREnumeration
///
- [SkippableTheory, MemberData(nameof(Configurations))]
+ [Theory, MemberData(nameof(Configurations))]
public async Task EnumerateCLRs(TestConfiguration config)
{
await RemoteInvoke(config, nameof(EnumerateCLRs), static async (string configXml) => {
@@ -178,7 +177,7 @@ await RemoteInvoke(config, nameof(EnumerateCLRs), static async (string configXml
///
/// Test CreateVersionStringFromModule/CreateDebuggingInterfaceFromVersion
///
- [SkippableTheory, MemberData(nameof(Configurations))]
+ [Theory, MemberData(nameof(Configurations))]
public async Task CreateDebuggingInterfaceFromVersion(TestConfiguration config)
{
await RemoteInvoke(config, nameof(CreateDebuggingInterfaceFromVersion), static async (string configXml) => {
@@ -191,7 +190,7 @@ await RemoteInvoke(config, nameof(CreateDebuggingInterfaceFromVersion), static a
///
/// Test CreateVersionStringFromModule/CreateDebuggingInterfaceFromVersionEx
///
- [SkippableTheory, MemberData(nameof(Configurations))]
+ [Theory, MemberData(nameof(Configurations))]
public async Task CreateDebuggingInterfaceFromVersionEx(TestConfiguration config)
{
await RemoteInvoke(config, nameof(CreateDebuggingInterfaceFromVersionEx), static async (string configXml) => {
@@ -204,7 +203,7 @@ await RemoteInvoke(config, nameof(CreateDebuggingInterfaceFromVersionEx), static
///
/// Test CreateVersionStringFromModule/CreateDebuggingInterfaceFromVersion2
///
- [SkippableTheory, MemberData(nameof(Configurations))]
+ [Theory, MemberData(nameof(Configurations))]
public async Task CreateDebuggingInterfaceFromVersion2(TestConfiguration config)
{
await RemoteInvoke(config, nameof(CreateDebuggingInterfaceFromVersion2), static async (string configXml) => {
@@ -217,7 +216,7 @@ await RemoteInvoke(config, nameof(CreateDebuggingInterfaceFromVersion2), static
///
/// Test CreateVersionStringFromModule/CreateDebuggingInterfaceFromVersion3
///
- [SkippableTheory, MemberData(nameof(Configurations))]
+ [Theory, MemberData(nameof(Configurations))]
public async Task CreateDebuggingInterfaceFromVersion3(TestConfiguration config)
{
if (OS.Kind == OSKind.OSX && config.PublishSingleFile)
@@ -236,7 +235,7 @@ await RemoteInvoke(config, nameof(CreateDebuggingInterfaceFromVersion3), static
});
}
- [SkippableTheory, MemberData(nameof(GetConfigurations), "TestName", "OpenVirtualProcess")]
+ [Theory, MemberData(nameof(GetConfigurations), "TestName", "OpenVirtualProcess")]
public async Task OpenVirtualProcess(TestConfiguration config)
{
// The current Linux test assets are not alpine/musl
diff --git a/src/tests/DbgShim.UnitTests/DebuggeeInfo.cs b/src/tests/DbgShim.UnitTests/DebuggeeInfo.cs
index 48588a6c64..346f97a488 100644
--- a/src/tests/DbgShim.UnitTests/DebuggeeInfo.cs
+++ b/src/tests/DbgShim.UnitTests/DebuggeeInfo.cs
@@ -9,7 +9,6 @@
using Microsoft.Diagnostics.Runtime.Utilities;
using Microsoft.Diagnostics.TestHelpers;
using Xunit;
-using Xunit.Abstractions;
namespace Microsoft.Diagnostics
{
diff --git a/src/tests/Directory.Build.props b/src/tests/Directory.Build.props
index e36d68d633..0998a90047 100644
--- a/src/tests/Directory.Build.props
+++ b/src/tests/Directory.Build.props
@@ -1,3 +1,35 @@
+
+
+
+ XUnitV3
+ Exe
+
+
+ $(ArtifactsDotnetTestDir)
+
diff --git a/src/tests/Microsoft.Diagnostics.DebugServices.UnitTests/ClrmaTests.cs b/src/tests/Microsoft.Diagnostics.DebugServices.UnitTests/ClrmaTests.cs
index 3be29ffc2c..9cc9c123d2 100644
--- a/src/tests/Microsoft.Diagnostics.DebugServices.UnitTests/ClrmaTests.cs
+++ b/src/tests/Microsoft.Diagnostics.DebugServices.UnitTests/ClrmaTests.cs
@@ -8,7 +8,6 @@
using System.Linq;
using Microsoft.Diagnostics.TestHelpers;
using Xunit;
-using Xunit.Abstractions;
using Xunit.Extensions;
// Newer SDKs flag MemberData(nameof(Configurations)) with this error
@@ -51,7 +50,7 @@ private static readonly (string, int)[] s_clrmaFilterList = [
( "Unable to load image ", 1 ),
];
- [SkippableTheory, MemberData(nameof(GetConfigurations))]
+ [Theory, MemberData(nameof(GetConfigurations))]
public void BangClrmaTests(TestHost host)
{
ITarget target = host.Target;
@@ -137,7 +136,7 @@ private static readonly (string, int)[] s_analyzeFilterList = [
( "Unable to load image ", 1 ),
];
- [SkippableTheory, MemberData(nameof(GetConfigurations))]
+ [Theory, MemberData(nameof(GetConfigurations))]
public void BangAnalyzeTests(TestHost host)
{
ITarget target = host.Target;
diff --git a/src/tests/Microsoft.Diagnostics.DebugServices.UnitTests/CommandServiceTests.cs b/src/tests/Microsoft.Diagnostics.DebugServices.UnitTests/CommandServiceTests.cs
index e70a57ced8..378b4b9879 100644
--- a/src/tests/Microsoft.Diagnostics.DebugServices.UnitTests/CommandServiceTests.cs
+++ b/src/tests/Microsoft.Diagnostics.DebugServices.UnitTests/CommandServiceTests.cs
@@ -7,8 +7,6 @@
using Microsoft.Diagnostics.DebugServices.Implementation;
using Microsoft.Diagnostics.TestHelpers;
using Xunit;
-using Xunit.Abstractions;
-using Xunit.Extensions;
[assembly: SuppressMessage("Performance", "CA1825:Avoid zero-length array allocations.", Justification = "")]
@@ -43,7 +41,7 @@ public CommandServiceTests(ITestOutputHelper output)
void IDisposable.Dispose() => Trace.Listeners.Remove(ListenerName);
- [SkippableTheory, MemberData(nameof(GetConfiguration))]
+ [Theory, MemberData(nameof(GetConfiguration))]
public void CommandServiceTest1(TestConfiguration config)
{
using TestDump testDump = new(config);
diff --git a/src/tests/Microsoft.Diagnostics.DebugServices.UnitTests/DebugServicesTests.cs b/src/tests/Microsoft.Diagnostics.DebugServices.UnitTests/DebugServicesTests.cs
index 9c56848cd8..dc6b48411d 100644
--- a/src/tests/Microsoft.Diagnostics.DebugServices.UnitTests/DebugServicesTests.cs
+++ b/src/tests/Microsoft.Diagnostics.DebugServices.UnitTests/DebugServicesTests.cs
@@ -11,7 +11,6 @@
using Microsoft.Diagnostics.Runtime;
using Microsoft.Diagnostics.TestHelpers;
using Xunit;
-using Xunit.Abstractions;
using Xunit.Extensions;
// Newer SDKs flag MemberData(nameof(Configurations)) with this error
@@ -59,7 +58,7 @@ public DebugServicesTests(ITestOutputHelper output)
void IDisposable.Dispose() => Trace.Listeners.Remove(ListenerName);
- [SkippableTheory, MemberData(nameof(GetConfigurations))]
+ [Theory, MemberData(nameof(GetConfigurations))]
public void TargetTests(TestHost host)
{
ITarget target = host.Target;
@@ -73,7 +72,7 @@ public void TargetTests(TestHost host)
host.TestData.CompareMembers(host.TestData.Target, target);
}
- [SkippableTheory, MemberData(nameof(GetConfigurations))]
+ [Theory, MemberData(nameof(GetConfigurations))]
public void ModuleTests(TestHost host)
{
IModuleService moduleService = host.Target.Services.GetService();
@@ -219,7 +218,7 @@ public void ModuleTests(TestHost host)
}
}
- [SkippableTheory, MemberData(nameof(GetConfigurations))]
+ [Theory, MemberData(nameof(GetConfigurations))]
public void ThreadTests(TestHost host)
{
IThreadService threadService = host.Target.Services.GetService();
@@ -262,7 +261,7 @@ public void ThreadTests(TestHost host)
}
}
- [SkippableTheory, MemberData(nameof(GetConfigurations))]
+ [Theory, MemberData(nameof(GetConfigurations))]
public void RuntimeTests(TestHost host)
{
// The current Linux test assets are not alpine/musl
diff --git a/src/tests/Microsoft.Diagnostics.DebugServices.UnitTests/RunTests.cs b/src/tests/Microsoft.Diagnostics.DebugServices.UnitTests/RunTests.cs
index c2299c85bf..1f5de90dbe 100644
--- a/src/tests/Microsoft.Diagnostics.DebugServices.UnitTests/RunTests.cs
+++ b/src/tests/Microsoft.Diagnostics.DebugServices.UnitTests/RunTests.cs
@@ -1,4 +1,4 @@
-// Licensed to the .NET Foundation under one or more agreements.
+// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using System;
@@ -12,7 +12,7 @@
using Microsoft.Diagnostics.DebugServices.Implementation;
using Microsoft.Diagnostics.TestHelpers;
using SOS.Extensions;
-using Xunit.Abstractions;
+using Xunit;
using Xunit.Extensions;
namespace Microsoft.Diagnostics.DebugServices.UnitTests
@@ -126,6 +126,12 @@ public override void Invoke()
#region ITestOutputHelper
+ string ITestOutputHelper.Output => string.Empty;
+
+ void ITestOutputHelper.Write(string message) => Write(message);
+
+ void ITestOutputHelper.Write(string format, params object[] args) => Write(string.Format(format, args));
+
void ITestOutputHelper.WriteLine(string message) => WriteLine(message);
void ITestOutputHelper.WriteLine(string format, params object[] args) => WriteLine(format, args);
diff --git a/src/tests/Microsoft.Diagnostics.ExtensionCommands.UnitTests/Microsoft.Diagnostics.ExtensionCommands.UnitTests.csproj b/src/tests/Microsoft.Diagnostics.ExtensionCommands.UnitTests/Microsoft.Diagnostics.ExtensionCommands.UnitTests.csproj
index 9d28481712..7d2e0eef1a 100644
--- a/src/tests/Microsoft.Diagnostics.ExtensionCommands.UnitTests/Microsoft.Diagnostics.ExtensionCommands.UnitTests.csproj
+++ b/src/tests/Microsoft.Diagnostics.ExtensionCommands.UnitTests/Microsoft.Diagnostics.ExtensionCommands.UnitTests.csproj
@@ -5,10 +5,6 @@
false
-
-
-
-
diff --git a/src/tests/Microsoft.Diagnostics.Monitoring.EventPipe/AspNetTriggerUnitTests.cs b/src/tests/Microsoft.Diagnostics.Monitoring.EventPipe/AspNetTriggerUnitTests.cs
index c29c1ee092..8995438378 100644
--- a/src/tests/Microsoft.Diagnostics.Monitoring.EventPipe/AspNetTriggerUnitTests.cs
+++ b/src/tests/Microsoft.Diagnostics.Monitoring.EventPipe/AspNetTriggerUnitTests.cs
@@ -5,7 +5,6 @@
using System.ComponentModel.DataAnnotations;
using Microsoft.Diagnostics.Monitoring.EventPipe.Triggers.AspNet;
using Xunit;
-using Xunit.Abstractions;
namespace Microsoft.Diagnostics.Monitoring.EventPipe.UnitTests
{
diff --git a/src/tests/Microsoft.Diagnostics.Monitoring.EventPipe/DistributedTracesPipelineUnitTests.cs b/src/tests/Microsoft.Diagnostics.Monitoring.EventPipe/DistributedTracesPipelineUnitTests.cs
index d50db93c79..e8fb5d33c5 100644
--- a/src/tests/Microsoft.Diagnostics.Monitoring.EventPipe/DistributedTracesPipelineUnitTests.cs
+++ b/src/tests/Microsoft.Diagnostics.Monitoring.EventPipe/DistributedTracesPipelineUnitTests.cs
@@ -12,8 +12,6 @@
using Microsoft.Diagnostics.NETCore.Client;
using Microsoft.Diagnostics.TestHelpers;
using Xunit;
-using Xunit.Abstractions;
-using Xunit.Extensions;
using TestRunner = Microsoft.Diagnostics.CommonTestRunner.TestRunner;
namespace Microsoft.Diagnostics.Monitoring.EventPipe.UnitTests
@@ -29,7 +27,7 @@ public DistributedTracesPipelineUnitTests(ITestOutputHelper output)
_output = output;
}
- [SkippableTheory, MemberData(nameof(Configurations))]
+ [Theory, MemberData(nameof(Configurations))]
public async Task TestTracesPipeline(TestConfiguration config)
{
TestActivityLogger logger = new();
@@ -80,7 +78,7 @@ await PipelineTestUtilities.ExecutePipelineWithTracee(
Assert.Equal("18", tags["custom.tag.int"]);
}
- [SkippableTheory, MemberData(nameof(Configurations))]
+ [Theory, MemberData(nameof(Configurations))]
public async Task TestTracesPipelineWithSamplingRatio(TestConfiguration config)
{
TestActivityLogger logger = new();
diff --git a/src/tests/Microsoft.Diagnostics.Monitoring.EventPipe/EventCounterPipelineUnitTests.cs b/src/tests/Microsoft.Diagnostics.Monitoring.EventPipe/EventCounterPipelineUnitTests.cs
index 2fb091ea9b..1f0e5f47e6 100644
--- a/src/tests/Microsoft.Diagnostics.Monitoring.EventPipe/EventCounterPipelineUnitTests.cs
+++ b/src/tests/Microsoft.Diagnostics.Monitoring.EventPipe/EventCounterPipelineUnitTests.cs
@@ -1,4 +1,4 @@
-// Licensed to the .NET Foundation under one or more agreements.
+// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using System.Collections.Generic;
@@ -8,7 +8,6 @@
using Microsoft.Diagnostics.NETCore.Client;
using Microsoft.Diagnostics.TestHelpers;
using Xunit;
-using Xunit.Abstractions;
using Xunit.Extensions;
using TestRunner = Microsoft.Diagnostics.CommonTestRunner.TestRunner;
@@ -119,7 +118,7 @@ public Task PipelineStarted(CancellationToken token)
public Task PipelineStopped(CancellationToken token) => Task.CompletedTask;
}
- [SkippableTheory, MemberData(nameof(Configurations))]
+ [Theory, MemberData(nameof(Configurations))]
public async Task TestCounterEventPipeline(TestConfiguration config)
{
string[] expectedCounters = new[] { "cpu-usage", "working-set" };
@@ -162,7 +161,7 @@ await PipelineTestUtilities.ExecutePipelineWithTracee(
Assert.True(logger.Metrics.All(m => string.Equals(m.CounterMetadata.ProviderName, expectedProvider)));
}
- [SkippableTheory, MemberData(nameof(Configurations))]
+ [Theory, MemberData(nameof(Configurations))]
public async Task TestDuplicateNameMetrics(TestConfiguration config)
{
if (config.RuntimeFrameworkVersionMajor < 9)
diff --git a/src/tests/Microsoft.Diagnostics.Monitoring.EventPipe/EventCounterTriggerTests.cs b/src/tests/Microsoft.Diagnostics.Monitoring.EventPipe/EventCounterTriggerTests.cs
index def5d754ab..7222de06d4 100644
--- a/src/tests/Microsoft.Diagnostics.Monitoring.EventPipe/EventCounterTriggerTests.cs
+++ b/src/tests/Microsoft.Diagnostics.Monitoring.EventPipe/EventCounterTriggerTests.cs
@@ -12,7 +12,6 @@
using Microsoft.Diagnostics.NETCore.Client;
using Microsoft.Diagnostics.TestHelpers;
using Xunit;
-using Xunit.Abstractions;
using Xunit.Extensions;
using TestRunner = Microsoft.Diagnostics.CommonTestRunner.TestRunner;
@@ -321,7 +320,7 @@ public void EventCounterTriggerDropTest()
/// Tests that the trigger condition can be detected on a live application
/// using the EventPipeTriggerPipeline.
///
- [SkippableTheory(Skip = "https://github.com/dotnet/diagnostics/issues/4782"), MemberData(nameof(Configurations))]
+ [Theory(Skip = "https://github.com/dotnet/diagnostics/issues/4782"), MemberData(nameof(Configurations))]
public async Task EventCounterTriggerWithEventPipePipelineTest(TestConfiguration config)
{
if (config.RuntimeFrameworkVersionMajor < 6)
diff --git a/src/tests/Microsoft.Diagnostics.Monitoring.EventPipe/EventLogsPipelineUnitTests.cs b/src/tests/Microsoft.Diagnostics.Monitoring.EventPipe/EventLogsPipelineUnitTests.cs
index 1b1d00e0e8..4fe83c4f0b 100644
--- a/src/tests/Microsoft.Diagnostics.Monitoring.EventPipe/EventLogsPipelineUnitTests.cs
+++ b/src/tests/Microsoft.Diagnostics.Monitoring.EventPipe/EventLogsPipelineUnitTests.cs
@@ -12,7 +12,6 @@
using Microsoft.Diagnostics.TestHelpers;
using Microsoft.Extensions.Logging;
using Xunit;
-using Xunit.Abstractions;
using Xunit.Extensions;
using TestRunner = Microsoft.Diagnostics.CommonTestRunner.TestRunner;
@@ -40,7 +39,7 @@ public EventLogsPipelineUnitTests(ITestOutputHelper output)
///
/// Test that all log events are collected if no filters are specified.
///
- [SkippableTheory, MemberData(nameof(Configurations))]
+ [Theory, MemberData(nameof(Configurations))]
public async Task TestLogsAllCategoriesAllLevels(TestConfiguration config)
{
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
@@ -62,13 +61,13 @@ public async Task TestLogsAllCategoriesAllLevels(TestConfiguration config)
ValidateAppLoggerCategoryWarningMessage(reader);
ValidateAppLoggerCategoryErrorMessage(reader);
- Assert.True(string.IsNullOrEmpty(await reader.ReadToEndAsync()), "Expected to have read all entries from stream.");
+ Assert.True(string.IsNullOrEmpty(await reader.ReadToEndAsync(TestContext.Current.CancellationToken)), "Expected to have read all entries from stream.");
}
///
/// Test that log events at or above the default level are collected.
///
- [SkippableTheory(Skip = "https://github.com/dotnet/diagnostics/issues/2541"), MemberData(nameof(Configurations))]
+ [Theory(Skip = "https://github.com/dotnet/diagnostics/issues/2541"), MemberData(nameof(Configurations))]
public async Task TestLogsAllCategoriesDefaultLevel(TestConfiguration config)
{
using Stream outputStream = await GetLogsAsync(config, settings => {
@@ -84,13 +83,13 @@ public async Task TestLogsAllCategoriesDefaultLevel(TestConfiguration config)
ValidateAppLoggerCategoryWarningMessage(reader);
ValidateAppLoggerCategoryErrorMessage(reader);
- Assert.True(string.IsNullOrEmpty(await reader.ReadToEndAsync()), "Expected to have read all entries from stream.");
+ Assert.True(string.IsNullOrEmpty(await reader.ReadToEndAsync(TestContext.Current.CancellationToken)), "Expected to have read all entries from stream.");
}
///
/// Test that log events at the default level are collected for categories without a specified level.
///
- [SkippableTheory(Skip = "Unreliable test https://github.com/dotnet/diagnostics/issues/3143"), MemberData(nameof(Configurations))]
+ [Theory(Skip = "Unreliable test https://github.com/dotnet/diagnostics/issues/3143"), MemberData(nameof(Configurations))]
public async Task TestLogsAllCategoriesDefaultLevelFallback(TestConfiguration config)
{
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
@@ -116,13 +115,13 @@ public async Task TestLogsAllCategoriesDefaultLevelFallback(TestConfiguration co
ValidateLoggerRemoteCategoryWarningMessage(reader);
ValidateAppLoggerCategoryErrorMessage(reader);
- Assert.True(string.IsNullOrEmpty(await reader.ReadToEndAsync()), "Expected to have read all entries from stream.");
+ Assert.True(string.IsNullOrEmpty(await reader.ReadToEndAsync(TestContext.Current.CancellationToken)), "Expected to have read all entries from stream.");
}
///
/// Test that LogLevel.None is not supported as the default log level.
///
- [SkippableTheory, MemberData(nameof(Configurations))]
+ [Theory, MemberData(nameof(Configurations))]
public async Task TestLogsAllCategoriesDefaultLevelNoneNotSupported(TestConfiguration config)
{
// Pipeline should throw PipelineException with inner exception of NotSupportedException.
@@ -140,7 +139,7 @@ public async Task TestLogsAllCategoriesDefaultLevelNoneNotSupported(TestConfigur
///
/// Test that log events are collected for the categories and levels specified by the application.
///
- [SkippableTheory, MemberData(nameof(Configurations))]
+ [Theory, MemberData(nameof(Configurations))]
public async Task TestLogsUseAppFilters(TestConfiguration config)
{
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
@@ -157,14 +156,14 @@ public async Task TestLogsUseAppFilters(TestConfiguration config)
ValidateAppLoggerCategoryWarningMessage(reader);
ValidateAppLoggerCategoryErrorMessage(reader);
- Assert.True(string.IsNullOrEmpty(await reader.ReadToEndAsync()), "Expected to have read all entries from stream.");
+ Assert.True(string.IsNullOrEmpty(await reader.ReadToEndAsync(TestContext.Current.CancellationToken)), "Expected to have read all entries from stream.");
}
///
/// Test that log events are collected for the categories and levels specified by the application
/// and for the categories and levels specified in the filter specs.
///
- [SkippableTheory(Skip = "https://github.com/dotnet/diagnostics/issues/2541"), MemberData(nameof(Configurations))]
+ [Theory(Skip = "https://github.com/dotnet/diagnostics/issues/2541"), MemberData(nameof(Configurations))]
public async Task TestLogsUseAppFiltersAndFilterSpecs(TestConfiguration config)
{
using Stream outputStream = await GetLogsAsync(config, settings => {
@@ -182,13 +181,13 @@ public async Task TestLogsUseAppFiltersAndFilterSpecs(TestConfiguration config)
ValidateAppLoggerCategoryWarningMessage(reader);
ValidateAppLoggerCategoryErrorMessage(reader);
- Assert.True(string.IsNullOrEmpty(await reader.ReadToEndAsync()), "Expected to have read all entries from stream.");
+ Assert.True(string.IsNullOrEmpty(await reader.ReadToEndAsync(TestContext.Current.CancellationToken)), "Expected to have read all entries from stream.");
}
///
/// Test that log events are collected for wildcard categories.
///
- [SkippableTheory, MemberData(nameof(Configurations))]
+ [Theory, MemberData(nameof(Configurations))]
public async Task TestLogsWildcardCategory(TestConfiguration config)
{
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
@@ -213,7 +212,7 @@ public async Task TestLogsWildcardCategory(TestConfiguration config)
ValidateAppLoggerCategoryWarningMessage(reader);
ValidateAppLoggerCategoryErrorMessage(reader);
- Assert.True(string.IsNullOrEmpty(await reader.ReadToEndAsync()), "Expected to have read all entries from stream.");
+ Assert.True(string.IsNullOrEmpty(await reader.ReadToEndAsync(TestContext.Current.CancellationToken)), "Expected to have read all entries from stream.");
}
private async Task GetLogsAsync(TestConfiguration config, Action settingsCallback = null)
diff --git a/src/tests/Microsoft.Diagnostics.Monitoring.EventPipe/EventTracePipelineUnitTests.cs b/src/tests/Microsoft.Diagnostics.Monitoring.EventPipe/EventTracePipelineUnitTests.cs
index e24250a3ae..86211a4da2 100644
--- a/src/tests/Microsoft.Diagnostics.Monitoring.EventPipe/EventTracePipelineUnitTests.cs
+++ b/src/tests/Microsoft.Diagnostics.Monitoring.EventPipe/EventTracePipelineUnitTests.cs
@@ -1,4 +1,4 @@
-// Licensed to the .NET Foundation under one or more agreements.
+// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using System;
@@ -11,8 +11,6 @@
using Microsoft.Diagnostics.TestHelpers;
using Microsoft.Diagnostics.Tracing;
using Xunit;
-using Xunit.Abstractions;
-using Xunit.Extensions;
using TestRunner = Microsoft.Diagnostics.CommonTestRunner.TestRunner;
// Newer SDKs flag MemberData(nameof(Configurations)) with this error
@@ -32,7 +30,7 @@ public EventTracePipelineUnitTests(ITestOutputHelper output)
_output = output;
}
- [SkippableTheory, MemberData(nameof(Configurations))]
+ [Theory, MemberData(nameof(Configurations))]
public async Task TestTraceStopAsync(TestConfiguration config)
{
Stream eventStream = null;
@@ -75,7 +73,7 @@ await PipelineTestUtilities.ExecutePipelineWithTracee(
Assert.Throws(() => eventStream.Read(new byte[4], 0, 4));
}
- [SkippableTheory, MemberData(nameof(Configurations))]
+ [Theory, MemberData(nameof(Configurations))]
public async Task TestEventStreamCleanup(TestConfiguration config)
{
Stream eventStream = null;
diff --git a/src/tests/Microsoft.Diagnostics.Monitoring.EventPipe/GlobMatcherTests.cs b/src/tests/Microsoft.Diagnostics.Monitoring.EventPipe/GlobMatcherTests.cs
index 88317be47b..007a021852 100644
--- a/src/tests/Microsoft.Diagnostics.Monitoring.EventPipe/GlobMatcherTests.cs
+++ b/src/tests/Microsoft.Diagnostics.Monitoring.EventPipe/GlobMatcherTests.cs
@@ -6,7 +6,6 @@
using System.Linq;
using Microsoft.Diagnostics.Monitoring.EventPipe.Triggers.AspNet;
using Xunit;
-using Xunit.Abstractions;
namespace Microsoft.Diagnostics.Monitoring.EventPipe.UnitTests
{
diff --git a/src/tests/Microsoft.Diagnostics.Monitoring.EventPipe/LogsPipelineUnitTests.cs b/src/tests/Microsoft.Diagnostics.Monitoring.EventPipe/LogsPipelineUnitTests.cs
index 0b11d899be..f84818a0c4 100644
--- a/src/tests/Microsoft.Diagnostics.Monitoring.EventPipe/LogsPipelineUnitTests.cs
+++ b/src/tests/Microsoft.Diagnostics.Monitoring.EventPipe/LogsPipelineUnitTests.cs
@@ -13,8 +13,6 @@
using Microsoft.Diagnostics.TestHelpers;
using Microsoft.Extensions.Logging;
using Xunit;
-using Xunit.Abstractions;
-using Xunit.Extensions;
using TestRunner = Microsoft.Diagnostics.CommonTestRunner.TestRunner;
namespace Microsoft.Diagnostics.Monitoring.EventPipe.UnitTests
@@ -32,7 +30,7 @@ public LogsPipelineUnitTests(ITestOutputHelper output)
_output = output;
}
- [SkippableTheory, MemberData(nameof(Configurations))]
+ [Theory, MemberData(nameof(Configurations))]
public async Task TestLogsPipeline(TestConfiguration config)
{
// TODO: When distributed tracing support lands EventPipeTracee
diff --git a/src/tests/Microsoft.Diagnostics.Monitoring.EventPipe/Microsoft.Diagnostics.Monitoring.EventPipe.UnitTests.csproj b/src/tests/Microsoft.Diagnostics.Monitoring.EventPipe/Microsoft.Diagnostics.Monitoring.EventPipe.UnitTests.csproj
index 7d44500941..b9d2ed1078 100644
--- a/src/tests/Microsoft.Diagnostics.Monitoring.EventPipe/Microsoft.Diagnostics.Monitoring.EventPipe.UnitTests.csproj
+++ b/src/tests/Microsoft.Diagnostics.Monitoring.EventPipe/Microsoft.Diagnostics.Monitoring.EventPipe.UnitTests.csproj
@@ -12,7 +12,6 @@
-
diff --git a/src/tests/Microsoft.Diagnostics.Monitoring.EventPipe/PipelineTestUtilities.cs b/src/tests/Microsoft.Diagnostics.Monitoring.EventPipe/PipelineTestUtilities.cs
index 5630f2dd71..e3ae508d7d 100644
--- a/src/tests/Microsoft.Diagnostics.Monitoring.EventPipe/PipelineTestUtilities.cs
+++ b/src/tests/Microsoft.Diagnostics.Monitoring.EventPipe/PipelineTestUtilities.cs
@@ -6,7 +6,7 @@
using System.Threading.Tasks;
using CommonTestRunner;
using Microsoft.Diagnostics.TestHelpers;
-using Xunit.Abstractions;
+using Xunit;
using TestRunner = Microsoft.Diagnostics.CommonTestRunner.TestRunner;
namespace Microsoft.Diagnostics.Monitoring.EventPipe.UnitTests
diff --git a/src/tests/Microsoft.Diagnostics.Monitoring/Microsoft.Diagnostics.Monitoring.UnitTests.csproj b/src/tests/Microsoft.Diagnostics.Monitoring/Microsoft.Diagnostics.Monitoring.UnitTests.csproj
index e7bb6394da..2f10c19aca 100644
--- a/src/tests/Microsoft.Diagnostics.Monitoring/Microsoft.Diagnostics.Monitoring.UnitTests.csproj
+++ b/src/tests/Microsoft.Diagnostics.Monitoring/Microsoft.Diagnostics.Monitoring.UnitTests.csproj
@@ -11,7 +11,6 @@
-
diff --git a/src/tests/Microsoft.Diagnostics.Monitoring/PipelineTests.cs b/src/tests/Microsoft.Diagnostics.Monitoring/PipelineTests.cs
index 071eb7622f..3b5e703a5b 100644
--- a/src/tests/Microsoft.Diagnostics.Monitoring/PipelineTests.cs
+++ b/src/tests/Microsoft.Diagnostics.Monitoring/PipelineTests.cs
@@ -5,7 +5,6 @@
using System.Threading;
using System.Threading.Tasks;
using Xunit;
-using Xunit.Abstractions;
namespace Microsoft.Diagnostics.Monitoring.UnitTests
{
@@ -25,7 +24,7 @@ public async Task TestStartStopCancelDispose()
CancellationTokenSource cancellationTokenSource = new();
CancellationToken token = cancellationTokenSource.Token;
- await Assert.ThrowsAsync(() => timePipeline.StopAsync());
+ await Assert.ThrowsAsync(() => timePipeline.StopAsync(TestContext.Current.CancellationToken));
Task startTask = timePipeline.RunAsync(token);
Task secondStartCall = timePipeline.RunAsync(token);
diff --git a/src/tests/Microsoft.Diagnostics.NETCore.Client/EventPipeSessionTests.cs b/src/tests/Microsoft.Diagnostics.NETCore.Client/EventPipeSessionTests.cs
index 3acc97be3e..a5cd4e5e18 100644
--- a/src/tests/Microsoft.Diagnostics.NETCore.Client/EventPipeSessionTests.cs
+++ b/src/tests/Microsoft.Diagnostics.NETCore.Client/EventPipeSessionTests.cs
@@ -1,4 +1,4 @@
-// Licensed to the .NET Foundation under one or more agreements.
+// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using System;
@@ -11,7 +11,6 @@
using Microsoft.Diagnostics.Tracing;
using Microsoft.Diagnostics.Tracing.Etlx;
using Xunit;
-using Xunit.Abstractions;
using Xunit.Extensions;
using TestRunner = Microsoft.Diagnostics.CommonTestRunner.TestRunner;
@@ -32,13 +31,13 @@ public EventPipeSessionTests(ITestOutputHelper outputHelper)
_output = outputHelper;
}
- [SkippableTheory, MemberData(nameof(Configurations))]
+ [Theory, MemberData(nameof(Configurations))]
public Task BasicEventPipeSessionTest(TestConfiguration config)
{
return BasicEventPipeSessionTestCore(config, useAsync: false);
}
- [SkippableTheory, MemberData(nameof(Configurations))]
+ [Theory, MemberData(nameof(Configurations))]
public Task BasicEventPipeSessionTestAsync(TestConfiguration config)
{
return BasicEventPipeSessionTestCore(config, useAsync: true);
@@ -61,13 +60,13 @@ private async Task BasicEventPipeSessionTestCore(TestConfiguration config, bool
runner.Stop();
}
- [SkippableTheory, MemberData(nameof(Configurations))]
+ [Theory, MemberData(nameof(Configurations))]
public Task EventPipeSessionStreamTest(TestConfiguration config)
{
return EventPipeSessionStreamTestCore(config, useAsync: false);
}
- [SkippableTheory, MemberData(nameof(Configurations))]
+ [Theory, MemberData(nameof(Configurations))]
public Task EventPipeSessionStreamTestAsync(TestConfiguration config)
{
return EventPipeSessionStreamTestCore(config, useAsync: true);
@@ -119,13 +118,13 @@ private async Task EventPipeSessionStreamTestCore(TestConfiguration config, bool
}
}
- [SkippableTheory, MemberData(nameof(Configurations))]
+ [Theory, MemberData(nameof(Configurations))]
public Task EventPipeSessionUnavailableTest(TestConfiguration config)
{
return EventPipeSessionTests.EventPipeSessionUnavailableTestCore(config, useAsync: false);
}
- [SkippableTheory, MemberData(nameof(Configurations))]
+ [Theory, MemberData(nameof(Configurations))]
public Task EventPipeSessionUnavailableTestAsync(TestConfiguration config)
{
return EventPipeSessionTests.EventPipeSessionUnavailableTestCore(config, useAsync: true);
@@ -147,13 +146,13 @@ await Assert.ThrowsAsync(() => clientShim.StartEven
}));
}
- [SkippableTheory, MemberData(nameof(Configurations))]
+ [Theory, MemberData(nameof(Configurations))]
public Task StartEventPipeSessionWithSingleProviderTest(TestConfiguration config)
{
return StartEventPipeSessionWithSingleProviderTestCore(config, useAsync: false);
}
- [SkippableTheory, MemberData(nameof(Configurations))]
+ [Theory, MemberData(nameof(Configurations))]
public Task StartEventPipeSessionWithSingleProviderTestAsync(TestConfiguration config)
{
return StartEventPipeSessionWithSingleProviderTestCore(config, useAsync: true);
@@ -173,7 +172,7 @@ private async Task StartEventPipeSessionWithSingleProviderTestCore(TestConfigura
runner.Stop();
}
- [SkippableTheory(Skip = "https://github.com/dotnet/diagnostics/issues/4717"), MemberData(nameof(Configurations))]
+ [Theory(Skip = "https://github.com/dotnet/diagnostics/issues/4717"), MemberData(nameof(Configurations))]
public async Task StartEventPipeSessionWithoutStackwalkTestAsync(TestConfiguration testConfig)
{
if (testConfig.RuntimeFrameworkVersionMajor < 9)
@@ -214,9 +213,11 @@ public async Task StartEventPipeSessionWithoutStackwalkTestAsync(TestConfigurati
{
runner.WakeupTracee();
}
- });
+ }, TestContext.Current.CancellationToken);
runner.WriteLine("Waiting for stream Task");
- streamTask.Wait(10000);
+#pragma warning disable xUnit1031 // Intentional blocking wait; the proper async fix is tied to the race condition in https://github.com/dotnet/diagnostics/issues/4717
+ streamTask.Wait(10000, TestContext.Current.CancellationToken);
+#pragma warning restore xUnit1031
runner.WriteLine("Done waiting for stream Task");
session.Stop();
await streamTask;
diff --git a/src/tests/Microsoft.Diagnostics.NETCore.Client/GetProcessEnvironmentTests.cs b/src/tests/Microsoft.Diagnostics.NETCore.Client/GetProcessEnvironmentTests.cs
index 92587d0b63..5fc8a4f7ef 100644
--- a/src/tests/Microsoft.Diagnostics.NETCore.Client/GetProcessEnvironmentTests.cs
+++ b/src/tests/Microsoft.Diagnostics.NETCore.Client/GetProcessEnvironmentTests.cs
@@ -1,11 +1,10 @@
-// Licensed to the .NET Foundation under one or more agreements.
+// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using System.Collections.Generic;
using System.Threading.Tasks;
using Microsoft.Diagnostics.TestHelpers;
using Xunit;
-using Xunit.Abstractions;
using Xunit.Extensions;
using TestRunner = Microsoft.Diagnostics.CommonTestRunner.TestRunner;
@@ -26,13 +25,13 @@ public ProcessEnvironmentTests(ITestOutputHelper outputHelper)
_output = outputHelper;
}
- [SkippableTheory, MemberData(nameof(Configurations))]
+ [Theory, MemberData(nameof(Configurations))]
public Task BasicEnvTest(TestConfiguration config)
{
return BasicEnvTestCore(config, useAsync: false);
}
- [SkippableTheory, MemberData(nameof(Configurations))]
+ [Theory, MemberData(nameof(Configurations))]
public Task BasicEnvTestAsync(TestConfiguration config)
{
return BasicEnvTestCore(config, useAsync: true);
diff --git a/src/tests/Microsoft.Diagnostics.NETCore.Client/GetProcessInfoTests.cs b/src/tests/Microsoft.Diagnostics.NETCore.Client/GetProcessInfoTests.cs
index 7f7181bc47..ffd2fb1c27 100644
--- a/src/tests/Microsoft.Diagnostics.NETCore.Client/GetProcessInfoTests.cs
+++ b/src/tests/Microsoft.Diagnostics.NETCore.Client/GetProcessInfoTests.cs
@@ -8,7 +8,6 @@
using Microsoft.Diagnostics.CommonTestRunner;
using Microsoft.Diagnostics.TestHelpers;
using Xunit;
-using Xunit.Abstractions;
using Xunit.Extensions;
using TestRunner = Microsoft.Diagnostics.CommonTestRunner.TestRunner;
@@ -29,25 +28,25 @@ public GetProcessInfoTests(ITestOutputHelper outputHelper)
_output = outputHelper;
}
- [SkippableTheory, MemberData(nameof(Configurations))]
+ [Theory, MemberData(nameof(Configurations))]
public Task BasicProcessInfoNoSuspendTest(TestConfiguration config)
{
return BasicProcessInfoTestCore(config, useAsync: false, suspend: false);
}
- [SkippableTheory, MemberData(nameof(Configurations))]
+ [Theory, MemberData(nameof(Configurations))]
public Task BasicProcessInfoNoSuspendTestAsync(TestConfiguration config)
{
return BasicProcessInfoTestCore(config, useAsync: true, suspend: false);
}
- [SkippableTheory, MemberData(nameof(Configurations))]
+ [Theory, MemberData(nameof(Configurations))]
public Task BasicProcessInfoSuspendTest(TestConfiguration config)
{
return BasicProcessInfoTestCore(config, useAsync: false, suspend: true);
}
- [SkippableTheory, MemberData(nameof(Configurations))]
+ [Theory, MemberData(nameof(Configurations))]
public Task BasicProcessInfoSuspendTestAsync(TestConfiguration config)
{
return BasicProcessInfoTestCore(config, useAsync: true, suspend: true);
diff --git a/src/tests/Microsoft.Diagnostics.NETCore.Client/GetPublishedProcessesTests.cs b/src/tests/Microsoft.Diagnostics.NETCore.Client/GetPublishedProcessesTests.cs
index 851db1184e..757acc3c9d 100644
--- a/src/tests/Microsoft.Diagnostics.NETCore.Client/GetPublishedProcessesTests.cs
+++ b/src/tests/Microsoft.Diagnostics.NETCore.Client/GetPublishedProcessesTests.cs
@@ -1,4 +1,4 @@
-// Licensed to the .NET Foundation under one or more agreements.
+// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using System;
@@ -7,8 +7,6 @@
using System.Threading.Tasks;
using Microsoft.Diagnostics.TestHelpers;
using Xunit;
-using Xunit.Abstractions;
-using Xunit.Extensions;
using TestRunner = Microsoft.Diagnostics.CommonTestRunner.TestRunner;
// Newer SDKs flag MemberData(nameof(Configurations)) with this error
@@ -32,7 +30,7 @@ public GetPublishedProcessesTest(ITestOutputHelper outputHelper)
_output = outputHelper;
}
- [SkippableTheory, MemberData(nameof(Configurations))]
+ [Theory, MemberData(nameof(Configurations))]
public async Task PublishedProcessTest1(TestConfiguration config)
{
await using TestRunner runner = await TestRunner.Create(config, _output, "Tracee");
@@ -47,7 +45,7 @@ public async Task PublishedProcessTest1(TestConfiguration config)
runner.WakeupTracee();
}
- [SkippableTheory, MemberData(nameof(Configurations))]
+ [Theory, MemberData(nameof(Configurations))]
public async Task MultiplePublishedProcessTest(TestConfiguration config)
{
TestRunner[] runner = new TestRunner[3];
@@ -87,7 +85,7 @@ public async Task MultiplePublishedProcessTest(TestConfiguration config)
}
}
- [SkippableTheory, MemberData(nameof(Configurations))]
+ [Theory, MemberData(nameof(Configurations))]
public async Task WaitForConnectionTest(TestConfiguration config)
{
await using TestRunner runner = await TestRunner.Create(config, _output, "Tracee");
diff --git a/src/tests/Microsoft.Diagnostics.NETCore.Client/HandleableCollectionTests.cs b/src/tests/Microsoft.Diagnostics.NETCore.Client/HandleableCollectionTests.cs
index 1a4b7e0b75..4429cf36cd 100644
--- a/src/tests/Microsoft.Diagnostics.NETCore.Client/HandleableCollectionTests.cs
+++ b/src/tests/Microsoft.Diagnostics.NETCore.Client/HandleableCollectionTests.cs
@@ -8,7 +8,6 @@
using System.Threading;
using System.Threading.Tasks;
using Xunit;
-using Xunit.Abstractions;
namespace Microsoft.Diagnostics.NETCore.Client
{
@@ -44,7 +43,7 @@ public async Task HandleableCollectionThrowsWhenDisposedTest()
// Task.Delay intentionally shorter than default timeout to check that Handle*
// calls did not complete quickly.
- Task delayTask = Task.Delay(TimeSpan.FromSeconds(1));
+ Task delayTask = Task.Delay(TimeSpan.FromSeconds(1), TestContext.Current.CancellationToken);
Task completedTask = await Task.WhenAny(delayTask, handleTask, handleAsyncTask);
// Check that the handle tasks didn't complete
@@ -299,7 +298,7 @@ public async Task HandleableCollectionClearItemsTest()
// Task.Delay intentionally shorter than default timeout to check that HandleAsync
// calls did not complete quickly.
- Task delayTask = Task.Delay(TimeSpan.FromSeconds(1));
+ Task delayTask = Task.Delay(TimeSpan.FromSeconds(1), TestContext.Current.CancellationToken);
Task completedTask = await Task.WhenAny(delayTask, handleAsyncTask);
// Check that the handle task didn't complete
@@ -319,7 +318,7 @@ public async Task HandleableCollectionClearItemsTest()
// Task.Delay intentionally longer than default timeout to check that HandleAsync
// does complete by handling a value. The delay Task is used in case the handler doesn't
// handle a value and doesn't respect cancellation so as to not stall the test indefinitely.
- delayTask = Task.Delay(2 * DefaultPositiveVerificationTimeout);
+ delayTask = Task.Delay(2 * DefaultPositiveVerificationTimeout, TestContext.Current.CancellationToken);
completedTask = await Task.WhenAny(delayTask, handleAsyncTask);
// Check that the handle task did complete
diff --git a/src/tests/Microsoft.Diagnostics.NETCore.Client/Microsoft.Diagnostics.NETCore.Client.UnitTests.csproj b/src/tests/Microsoft.Diagnostics.NETCore.Client/Microsoft.Diagnostics.NETCore.Client.UnitTests.csproj
index 8dfe4a33f3..30562d9f87 100644
--- a/src/tests/Microsoft.Diagnostics.NETCore.Client/Microsoft.Diagnostics.NETCore.Client.UnitTests.csproj
+++ b/src/tests/Microsoft.Diagnostics.NETCore.Client/Microsoft.Diagnostics.NETCore.Client.UnitTests.csproj
@@ -12,7 +12,6 @@
-
diff --git a/src/tests/Microsoft.Diagnostics.NETCore.Client/PerfMapTests.cs b/src/tests/Microsoft.Diagnostics.NETCore.Client/PerfMapTests.cs
index 6673b7729a..f50fb6a3a3 100644
--- a/src/tests/Microsoft.Diagnostics.NETCore.Client/PerfMapTests.cs
+++ b/src/tests/Microsoft.Diagnostics.NETCore.Client/PerfMapTests.cs
@@ -12,7 +12,6 @@
using Microsoft.Diagnostics.CommonTestRunner;
using Microsoft.Diagnostics.TestHelpers;
using Xunit;
-using Xunit.Abstractions;
using Xunit.Extensions;
using TestRunner = Microsoft.Diagnostics.CommonTestRunner.TestRunner;
@@ -149,7 +148,7 @@ private void CheckWellKnownMethods(PerfMapType type, int pid)
}
}
- [SkippableTheory, MemberData(nameof(Configurations))]
+ [Theory, MemberData(nameof(Configurations))]
public async Task GenerateAllTest(TestConfiguration config)
{
if (config.RuntimeFrameworkVersionMajor >= 8)
@@ -159,7 +158,7 @@ public async Task GenerateAllTest(TestConfiguration config)
await GenerateTestCore(PerfMapType.All, config);
}
- [SkippableTheory, MemberData(nameof(Configurations))]
+ [Theory, MemberData(nameof(Configurations))]
public async Task GeneratePerfMapTest(TestConfiguration config)
{
if (config.RuntimeFrameworkVersionMajor >= 8)
@@ -169,7 +168,7 @@ public async Task GeneratePerfMapTest(TestConfiguration config)
await GenerateTestCore(PerfMapType.PerfMap, config);
}
- [SkippableTheory, MemberData(nameof(Configurations))]
+ [Theory, MemberData(nameof(Configurations))]
public async Task GenerateJitDumpTest(TestConfiguration config)
{
await GenerateTestCore(PerfMapType.JitDump, config);
diff --git a/src/tests/Microsoft.Diagnostics.NETCore.Client/PidIpcEndpointTests.cs b/src/tests/Microsoft.Diagnostics.NETCore.Client/PidIpcEndpointTests.cs
index c08f0ce023..e2a54d9023 100644
--- a/src/tests/Microsoft.Diagnostics.NETCore.Client/PidIpcEndpointTests.cs
+++ b/src/tests/Microsoft.Diagnostics.NETCore.Client/PidIpcEndpointTests.cs
@@ -7,7 +7,6 @@
using System.Runtime.InteropServices;
using System.Text;
using System.Threading;
-using Microsoft.DotNet.XUnitExtensions;
using Xunit;
namespace Microsoft.Diagnostics.NETCore.Client
@@ -128,34 +127,38 @@ public void ParseTmpDir_EmptyEnviron_ReturnsFallback()
#region Behavioral tests (platform-specific, real system calls)
- [ConditionalFact(nameof(IsLinux))]
+ [Fact]
public void TryGetNamespacePid_CurrentProcess_SameNamespace_ReturnsFalse()
{
+ Assert.SkipUnless(IsLinux, "Condition 'IsLinux' was not met.");
int currentPid = Process.GetCurrentProcess().Id;
bool result = PidIpcEndpoint.TryGetNamespacePid(currentPid, out int nsPid);
Assert.False(result);
Assert.Equal(currentPid, nsPid);
}
- [ConditionalFact(nameof(IsNotLinux))]
+ [Fact]
public void TryGetNamespacePid_NonLinux_ReturnsFalse()
{
+ Assert.SkipUnless(IsNotLinux, "Condition 'IsNotLinux' was not met.");
bool result = PidIpcEndpoint.TryGetNamespacePid(1, out int nsPid);
Assert.False(result);
Assert.Equal(1, nsPid);
}
- [ConditionalFact(nameof(IsLinux))]
+ [Fact]
public void TryGetNamespacePid_NonExistentPid_DoesNotThrow()
{
+ Assert.SkipUnless(IsLinux, "Condition 'IsLinux' was not met.");
bool result = PidIpcEndpoint.TryGetNamespacePid(int.MaxValue, out int nsPid);
Assert.False(result);
Assert.Equal(int.MaxValue, nsPid);
}
- [ConditionalFact(nameof(IsLinux))]
+ [Fact]
public void GetProcessTmpDir_ChildProcess_ReadsTmpdir()
{
+ Assert.SkipUnless(IsLinux, "Condition 'IsLinux' was not met.");
string customTmpDir = "/custom/tmp/test";
ProcessStartInfo psi = new("sleep", "30")
{
@@ -277,9 +280,10 @@ public void GetDefaultAddress_NonExistentPid_ThrowsServerNotAvailable()
Assert.Contains("is not running", ex.Message);
}
- [ConditionalFact(nameof(IsLinux))]
+ [Fact]
public void GetProcessTmpDir_KernelThread_DoesNotThrow()
{
+ Assert.SkipUnless(IsLinux, "Condition 'IsLinux' was not met.");
int unreadableEnvironPid = -1;
foreach (string procEntry in Directory.EnumerateDirectories("/proc"))
{
@@ -305,7 +309,8 @@ public void GetProcessTmpDir_KernelThread_DoesNotThrow()
if (unreadableEnvironPid == -1)
{
- throw new SkipTestException("No process with an unreadable (IOException) /proc/{pid}/environ was found.");
+ Assert.Skip("No process with an unreadable (IOException) /proc/{pid}/environ was found.");
+ return;
}
bool environReadable = true;
diff --git a/src/tests/Microsoft.Diagnostics.NETCore.Client/ReversedServerTests.cs b/src/tests/Microsoft.Diagnostics.NETCore.Client/ReversedServerTests.cs
index a60d93138f..a948e31425 100644
--- a/src/tests/Microsoft.Diagnostics.NETCore.Client/ReversedServerTests.cs
+++ b/src/tests/Microsoft.Diagnostics.NETCore.Client/ReversedServerTests.cs
@@ -14,7 +14,6 @@
using Microsoft.Diagnostics.TestHelpers;
using Microsoft.Diagnostics.Tracing;
using Xunit;
-using Xunit.Abstractions;
using Xunit.Extensions;
using TestRunner = Microsoft.Diagnostics.CommonTestRunner.TestRunner;
@@ -103,7 +102,7 @@ await Assert.ThrowsAsync(
() => server.RemoveConnection(Guid.Empty));
}
- [SkippableFact]
+ [Fact]
public async Task ReversedServerAddressInUseTest()
{
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
@@ -156,13 +155,13 @@ public async Task ReversedServerAcceptAsyncYieldsTest()
Assert.True(acceptTask.IsCanceled);
}
- [SkippableTheory, MemberData(nameof(Configurations))]
+ [Theory, MemberData(nameof(Configurations))]
public async Task ReversedServerNonExistingRuntimeIdentifierTest(TestConfiguration config)
{
await ReversedServerNonExistingRuntimeIdentifierTestCore(config, useAsync: false);
}
- [SkippableTheory, MemberData(nameof(Configurations))]
+ [Theory, MemberData(nameof(Configurations))]
public async Task ReversedServerNonExistingRuntimeIdentifierTestAsync(TestConfiguration config)
{
await ReversedServerNonExistingRuntimeIdentifierTestCore(config, useAsync: true);
@@ -194,13 +193,13 @@ private async Task ReversedServerNonExistingRuntimeIdentifierTestCore(TestConfig
Assert.False(server.RemoveConnection(Guid.NewGuid()), "Removal of nonexisting connection should fail.");
}
- [SkippableTheory, MemberData(nameof(Configurations))]
+ [Theory, MemberData(nameof(Configurations))]
public async Task ReversedServerSingleTargetMultipleUseClientTest(TestConfiguration config)
{
await ReversedServerSingleTargetMultipleUseClientTestCore(config, useAsync: false);
}
- [SkippableTheory, MemberData(nameof(Configurations))]
+ [Theory, MemberData(nameof(Configurations))]
public async Task ReversedServerSingleTargetMultipleUseClientTestAsync(TestConfiguration config)
{
await ReversedServerSingleTargetMultipleUseClientTestCore(config, useAsync: true);
@@ -254,13 +253,13 @@ private async Task ReversedServerSingleTargetMultipleUseClientTestCore(TestConfi
await VerifyNoNewEndpointInfos(server, useAsync);
}
- [SkippableTheory, MemberData(nameof(Configurations))]
+ [Theory, MemberData(nameof(Configurations))]
public async Task ReversedServerSingleTargetExitsClientInviableTest(TestConfiguration config)
{
await ReversedServerSingleTargetExitsClientInviableTestCore(config, useAsync: false);
}
- [SkippableTheory, MemberData(nameof(Configurations))]
+ [Theory, MemberData(nameof(Configurations))]
public async Task ReversedServerSingleTargetExitsClientInviableTestAsync(TestConfiguration config)
{
await ReversedServerSingleTargetExitsClientInviableTestCore(config, useAsync: true);
@@ -313,7 +312,7 @@ private async Task ReversedServerSingleTargetExitsClientInviableTestCore(TestCon
/// Validates that the does not create a new server
/// transport during disposal.
///
- [SkippableTheory, MemberData(nameof(Configurations))]
+ [Theory, MemberData(nameof(Configurations))]
public async Task ReversedServerNoCreateTransportAfterDispose(TestConfiguration config)
{
if (config.RuntimeFrameworkVersionMajor < 5)
diff --git a/src/tests/Microsoft.SymbolStore.UnitTests/KeyGeneratorTests.cs b/src/tests/Microsoft.SymbolStore.UnitTests/KeyGeneratorTests.cs
index 428893488d..af82e51797 100644
--- a/src/tests/Microsoft.SymbolStore.UnitTests/KeyGeneratorTests.cs
+++ b/src/tests/Microsoft.SymbolStore.UnitTests/KeyGeneratorTests.cs
@@ -7,7 +7,6 @@
using Microsoft.SymbolStore.KeyGenerators;
using TestHelpers;
using Xunit;
-using Xunit.Abstractions;
namespace Microsoft.SymbolStore.Tests
{
diff --git a/src/tests/Microsoft.SymbolStore.UnitTests/PEFileKeyGenerationTests.cs b/src/tests/Microsoft.SymbolStore.UnitTests/PEFileKeyGenerationTests.cs
index 2d6e3044c6..e8c5315525 100644
--- a/src/tests/Microsoft.SymbolStore.UnitTests/PEFileKeyGenerationTests.cs
+++ b/src/tests/Microsoft.SymbolStore.UnitTests/PEFileKeyGenerationTests.cs
@@ -1,4 +1,4 @@
-// Licensed to the .NET Foundation under one or more agreements.
+// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using System.Collections.Generic;
@@ -7,7 +7,6 @@
using Microsoft.SymbolStore.KeyGenerators;
using TestHelpers;
using Xunit;
-using Xunit.Abstractions;
namespace Microsoft.SymbolStore.Tests
{
diff --git a/src/tests/Microsoft.SymbolStore.UnitTests/SymbolStoreTests.cs b/src/tests/Microsoft.SymbolStore.UnitTests/SymbolStoreTests.cs
index ee87de31da..984bdde946 100644
--- a/src/tests/Microsoft.SymbolStore.UnitTests/SymbolStoreTests.cs
+++ b/src/tests/Microsoft.SymbolStore.UnitTests/SymbolStoreTests.cs
@@ -11,7 +11,6 @@
using Microsoft.SymbolStore.SymbolStores;
using SOS;
using Xunit;
-using Xunit.Abstractions;
namespace Microsoft.SymbolStore.Tests
{
diff --git a/src/tests/Microsoft.SymbolStore.UnitTests/Tracer.cs b/src/tests/Microsoft.SymbolStore.UnitTests/Tracer.cs
index 0adf3d85d9..ea5943e3f9 100644
--- a/src/tests/Microsoft.SymbolStore.UnitTests/Tracer.cs
+++ b/src/tests/Microsoft.SymbolStore.UnitTests/Tracer.cs
@@ -1,7 +1,7 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
-using Xunit.Abstractions;
+using Xunit;
namespace Microsoft.SymbolStore.Tests
{
diff --git a/src/tests/SOS.UnitTests/SOS.UnitTests.csproj b/src/tests/SOS.UnitTests/SOS.UnitTests.csproj
index df9a23e046..a09eabd3a1 100644
--- a/src/tests/SOS.UnitTests/SOS.UnitTests.csproj
+++ b/src/tests/SOS.UnitTests/SOS.UnitTests.csproj
@@ -8,6 +8,13 @@
$(OutputPath)$(TargetFramework)\Debugger.Tests.Common.txt
true
true
+
+ $(MSBuildThisFileDirectory)xunit.runner.json
+ $(MSBuildThisFileDirectory)xunit.runner.json
@@ -16,10 +23,6 @@
-
-
-
-
Debugger.Tests.Config.txt
diff --git a/src/tests/SOS.UnitTests/SOS.cs b/src/tests/SOS.UnitTests/SOS.cs
index 5d365a55ec..56b9085f88 100644
--- a/src/tests/SOS.UnitTests/SOS.cs
+++ b/src/tests/SOS.UnitTests/SOS.cs
@@ -11,7 +11,6 @@
using Microsoft.Diagnostics.TestHelpers;
using System.Text.Json;
using Xunit;
-using Xunit.Abstractions;
using Xunit.Extensions;
public static class SOSTestHelpers
@@ -296,7 +295,7 @@ public SOSStackTraceTests(ITestOutputHelper output)
private ITestOutputHelper Output { get; set; }
- [SkippableTheory, MemberData(nameof(SOSTestHelpers.Configurations), MemberType = typeof(SOSTestHelpers))]
+ [Theory, MemberData(nameof(SOSTestHelpers.Configurations), MemberType = typeof(SOSTestHelpers))]
public async Task StackTraceSoftwareExceptionFrame(TestConfiguration config)
{
if (config.RuntimeFrameworkVersionMajor < 10)
@@ -315,7 +314,7 @@ await SOSTestHelpers.RunTest(
testTriage: true);
}
- [SkippableTheory, MemberData(nameof(SOSTestHelpers.Configurations), MemberType = typeof(SOSTestHelpers))]
+ [Theory, MemberData(nameof(SOSTestHelpers.Configurations), MemberType = typeof(SOSTestHelpers))]
public async Task StackTraceFaultingExceptionFrame(TestConfiguration config)
{
SOSTestHelpers.SkipIfWinX86(config);
@@ -329,7 +328,7 @@ await SOSTestHelpers.RunTest(
testTriage: true);
}
- [SkippableTheory, MemberData(nameof(SOSTestHelpers.Configurations), MemberType = typeof(SOSTestHelpers))]
+ [Theory, MemberData(nameof(SOSTestHelpers.Configurations), MemberType = typeof(SOSTestHelpers))]
public async Task StackTests(TestConfiguration config)
{
// Tracking: https://github.com/dotnet/diagnostics/issues/5883 (dotnet/runtime#129456)
@@ -343,7 +342,7 @@ await SOSTestHelpers.RunTest(
testName: "SOS.StackTests");
}
- [SkippableTheory, MemberData(nameof(SOSTestHelpers.Configurations), MemberType = typeof(SOSTestHelpers))]
+ [Theory, MemberData(nameof(SOSTestHelpers.Configurations), MemberType = typeof(SOSTestHelpers))]
public async Task ClrStackWithNumberOfFrames(TestConfiguration config)
{
if (config.IsDesktop)
@@ -369,7 +368,7 @@ public SOSExceptionTests(ITestOutputHelper output)
private ITestOutputHelper Output { get; set; }
- [SkippableTheory, MemberData(nameof(SOSTestHelpers.Configurations), MemberType = typeof(SOSTestHelpers))]
+ [Theory, MemberData(nameof(SOSTestHelpers.Configurations), MemberType = typeof(SOSTestHelpers))]
public async Task DivZero(TestConfiguration config)
{
await SOSTestHelpers.RunTest(
@@ -380,13 +379,13 @@ await SOSTestHelpers.RunTest(
testTriage: true);
}
- [SkippableTheory, MemberData(nameof(SOSTestHelpers.Configurations), MemberType = typeof(SOSTestHelpers))]
+ [Theory, MemberData(nameof(SOSTestHelpers.Configurations), MemberType = typeof(SOSTestHelpers))]
public async Task SimpleThrow(TestConfiguration config)
{
await SOSTestHelpers.RunTest(config, debuggeeName: "SimpleThrow", scriptName: "SimpleThrow.script", Output, testTriage: true);
}
- [SkippableTheory, MemberData(nameof(SOSTestHelpers.Configurations), MemberType = typeof(SOSTestHelpers))]
+ [Theory, MemberData(nameof(SOSTestHelpers.Configurations), MemberType = typeof(SOSTestHelpers))]
public async Task NestedExceptionTest(TestConfiguration config)
{
await SOSTestHelpers.RunTest(
@@ -397,7 +396,7 @@ await SOSTestHelpers.RunTest(
testTriage: true);
}
- [SkippableTheory, MemberData(nameof(SOSTestHelpers.Configurations), MemberType = typeof(SOSTestHelpers))]
+ [Theory, MemberData(nameof(SOSTestHelpers.Configurations), MemberType = typeof(SOSTestHelpers))]
public async Task TaskNestedException(TestConfiguration config)
{
await SOSTestHelpers.RunTest(
@@ -418,7 +417,7 @@ public SOSInterpreterTests(ITestOutputHelper output)
private ITestOutputHelper Output { get; set; }
- [SkippableTheory, MemberData(nameof(SOSTestHelpers.InterpreterConfigurations), MemberType = typeof(SOSTestHelpers))]
+ [Theory, MemberData(nameof(SOSTestHelpers.InterpreterConfigurations), MemberType = typeof(SOSTestHelpers))]
public async Task InterpreterStackTest(TestConfiguration config)
{
if (!config.UseInterpreter)
@@ -439,7 +438,7 @@ await SOSTestHelpers.RunTest(
Output);
}
- [SkippableTheory, MemberData(nameof(SOSTestHelpers.InterpreterConfigurations), MemberType = typeof(SOSTestHelpers))]
+ [Theory, MemberData(nameof(SOSTestHelpers.InterpreterConfigurations), MemberType = typeof(SOSTestHelpers))]
public async Task InterpreterStackInterleavedTest(TestConfiguration config)
{
if (!config.UseInterpreter)
@@ -470,7 +469,7 @@ public SOSOverflowTests(ITestOutputHelper output)
private ITestOutputHelper Output { get; set; }
- [SkippableTheory, MemberData(nameof(SOSTestHelpers.Configurations), MemberType = typeof(SOSTestHelpers))]
+ [Theory, MemberData(nameof(SOSTestHelpers.Configurations), MemberType = typeof(SOSTestHelpers))]
public async Task Overflow(TestConfiguration config)
{
await SOSTestHelpers.RunTest(
@@ -500,7 +499,7 @@ public SOSGCTests(ITestOutputHelper output)
private ITestOutputHelper Output { get; set; }
- [SkippableTheory, MemberData(nameof(SOSTestHelpers.Configurations), MemberType = typeof(SOSTestHelpers))]
+ [Theory, MemberData(nameof(SOSTestHelpers.Configurations), MemberType = typeof(SOSTestHelpers))]
public async Task GCTests(TestConfiguration config)
{
SOSTestHelpers.SkipIfArm(config);
@@ -517,7 +516,7 @@ await SOSTestHelpers.RunTest(
testDump: false);
}
- [SkippableTheory, MemberData(nameof(SOSTestHelpers.Configurations), MemberType = typeof(SOSTestHelpers))]
+ [Theory, MemberData(nameof(SOSTestHelpers.Configurations), MemberType = typeof(SOSTestHelpers))]
public async Task GCPOHTests(TestConfiguration config)
{
if (config.IsDesktop || config.RuntimeFrameworkVersionMajor < 5)
@@ -535,7 +534,7 @@ await SOSTestHelpers.RunTest(
testDump: false);
}
- [SkippableTheory, MemberData(nameof(SOSTestHelpers.GetGCConfigurations), MemberType = typeof(SOSTestHelpers))]
+ [Theory, MemberData(nameof(SOSTestHelpers.GetGCConfigurations), MemberType = typeof(SOSTestHelpers))]
public async Task FindRootsOlderGeneration(TestConfiguration config)
{
if (OS.Kind != OSKind.Windows)
@@ -557,7 +556,7 @@ await SOSTestHelpers.RunTest(
testDump: false);
}
- [SkippableTheory, MemberData(nameof(SOSTestHelpers.GetGCConfigurations), MemberType = typeof(SOSTestHelpers))]
+ [Theory, MemberData(nameof(SOSTestHelpers.GetGCConfigurations), MemberType = typeof(SOSTestHelpers))]
public async Task DumpGCData(TestConfiguration config)
{
if (config.RuntimeFrameworkVersionMajor < 10)
@@ -574,7 +573,7 @@ await SOSTestHelpers.RunTest(
testDump: false);
}
- [SkippableTheory, MemberData(nameof(SOSTestHelpers.Configurations), MemberType = typeof(SOSTestHelpers))]
+ [Theory, MemberData(nameof(SOSTestHelpers.Configurations), MemberType = typeof(SOSTestHelpers))]
public async Task DumpGen(TestConfiguration config)
{
await SOSTestHelpers.RunTest(
@@ -603,7 +602,7 @@ public SOSDumpTests(ITestOutputHelper output)
private ITestOutputHelper Output { get; set; }
- [SkippableTheory, MemberData(nameof(SOSTestHelpers.GetNetCoreConfigurations), MemberType = typeof(SOSTestHelpers))]
+ [Theory, MemberData(nameof(SOSTestHelpers.GetNetCoreConfigurations), MemberType = typeof(SOSTestHelpers))]
public async Task MiniDumpLocalVarLookup(TestConfiguration config)
{
if (OS.Kind != OSKind.Windows)
@@ -629,7 +628,7 @@ await SOSTestHelpers.RunTest(
dumpGenerator: SOSRunner.DumpGenerator.NativeDebugger);
}
- [SkippableTheory, MemberData(nameof(SOSTestHelpers.Configurations), MemberType = typeof(SOSTestHelpers))]
+ [Theory, MemberData(nameof(SOSTestHelpers.Configurations), MemberType = typeof(SOSTestHelpers))]
public async Task ConcurrentDictionaries(TestConfiguration config)
{
if (OS.Kind != OSKind.Windows && config.RuntimeFrameworkVersionMajor == 10)
@@ -653,7 +652,7 @@ await SOSTestHelpers.RunTest(
Output);
}
- [SkippableTheory, MemberData(nameof(SOSTestHelpers.Configurations), MemberType = typeof(SOSTestHelpers))]
+ [Theory, MemberData(nameof(SOSTestHelpers.Configurations), MemberType = typeof(SOSTestHelpers))]
public async Task OtherCommands(TestConfiguration config)
{
// This debuggee needs the directory of the exes/dlls to load the SymbolTestDll assembly.
@@ -681,7 +680,7 @@ public SOSMethodTests(ITestOutputHelper output)
private ITestOutputHelper Output { get; set; }
- [SkippableTheory, MemberData(nameof(SOSTestHelpers.Configurations), MemberType = typeof(SOSTestHelpers))]
+ [Theory, MemberData(nameof(SOSTestHelpers.Configurations), MemberType = typeof(SOSTestHelpers))]
public async Task DynamicMethod(TestConfiguration config)
{
if (config.PublishSingleFile || config.IsDesktop)
@@ -698,13 +697,13 @@ public async Task DynamicMethod(TestConfiguration config)
await SOSTestHelpers.RunTest(config, debuggeeName: "DynamicMethod", scriptName: "DynamicMethod.script", Output);
}
- [SkippableTheory, MemberData(nameof(SOSTestHelpers.Configurations), MemberType = typeof(SOSTestHelpers))]
+ [Theory, MemberData(nameof(SOSTestHelpers.Configurations), MemberType = typeof(SOSTestHelpers))]
public async Task Reflection(TestConfiguration config)
{
await SOSTestHelpers.RunTest(config, debuggeeName: "ReflectionTest", scriptName: "Reflection.script", Output, testTriage: true);
}
- [SkippableTheory, MemberData(nameof(SOSTestHelpers.GetNetCoreConfigurations), MemberType = typeof(SOSTestHelpers))]
+ [Theory, MemberData(nameof(SOSTestHelpers.GetNetCoreConfigurations), MemberType = typeof(SOSTestHelpers))]
public async Task VarargPInvokeInteropMD(TestConfiguration config)
{
if (OS.Kind != OSKind.Windows)
@@ -733,7 +732,7 @@ public SOSThreadingTests(ITestOutputHelper output)
private ITestOutputHelper Output { get; set; }
- [SkippableTheory, MemberData(nameof(SOSTestHelpers.Configurations), MemberType = typeof(SOSTestHelpers))]
+ [Theory, MemberData(nameof(SOSTestHelpers.Configurations), MemberType = typeof(SOSTestHelpers))]
public async Task ThreadApartment(TestConfiguration config)
{
if (OS.Kind != OSKind.Windows)
@@ -744,7 +743,7 @@ public async Task ThreadApartment(TestConfiguration config)
await SOSTestHelpers.RunTest(config, debuggeeName: "ThreadApartment", scriptName: "ThreadApartment.script", Output);
}
- [SkippableTheory, MemberData(nameof(SOSTestHelpers.Configurations), MemberType = typeof(SOSTestHelpers))]
+ [Theory, MemberData(nameof(SOSTestHelpers.Configurations), MemberType = typeof(SOSTestHelpers))]
public async Task LineNums(TestConfiguration config)
{
await SOSTestHelpers.RunTest(
@@ -765,7 +764,7 @@ public SOSAsyncTests(ITestOutputHelper output)
private ITestOutputHelper Output { get; set; }
- [SkippableTheory, MemberData(nameof(SOSTestHelpers.Configurations), MemberType = typeof(SOSTestHelpers))]
+ [Theory, MemberData(nameof(SOSTestHelpers.Configurations), MemberType = typeof(SOSTestHelpers))]
public async Task AsyncMain(TestConfiguration config)
{
await SOSTestHelpers.RunTest(config, debuggeeName: "AsyncMain", scriptName: "AsyncMain.script", Output, testTriage: true);
@@ -781,7 +780,7 @@ public SOSScenarioTests(ITestOutputHelper output)
private ITestOutputHelper Output { get; set; }
- [SkippableTheory, MemberData(nameof(SOSTestHelpers.GetConfigurations), "TestName", "SOS.TestExtensions", MemberType = typeof(SOSTestHelpers))]
+ [Theory, MemberData(nameof(SOSTestHelpers.GetConfigurations), "TestName", "SOS.TestExtensions", MemberType = typeof(SOSTestHelpers))]
public async Task TestExtensions(TestConfiguration config)
{
await SOSTestHelpers.RunTest(
@@ -792,7 +791,7 @@ await SOSTestHelpers.RunTest(
testName: "SOS.TestExtensions");
}
- [SkippableTheory, MemberData(nameof(SOSTestHelpers.GetConfigurations), "TestName", "SOS.WebApp3", MemberType = typeof(SOSTestHelpers))]
+ [Theory, MemberData(nameof(SOSTestHelpers.GetConfigurations), "TestName", "SOS.WebApp3", MemberType = typeof(SOSTestHelpers))]
public async Task WebApp3(TestConfiguration config)
{
await SOSTestHelpers.RunTest("WebApp.script", new SOSRunner.TestInformation
@@ -806,7 +805,7 @@ public async Task WebApp3(TestConfiguration config)
Output);
}
- [SkippableTheory, MemberData(nameof(SOSTestHelpers.GetConfigurations), "TestName", "SOS.DualRuntimes", MemberType = typeof(SOSTestHelpers))]
+ [Theory, MemberData(nameof(SOSTestHelpers.GetConfigurations), "TestName", "SOS.DualRuntimes", MemberType = typeof(SOSTestHelpers))]
public async Task DualRuntimes(TestConfiguration config)
{
// This test on linux/macOS can be called with an empty config because vstest and dotnet test fail/complain about no test parameters. The
@@ -857,7 +856,7 @@ public SOSStackAndOtherTests(ITestOutputHelper output)
private ITestOutputHelper Output { get; set; }
- [SkippableTheory, MemberData(nameof(SOSTestHelpers.GetConfigurations), "TestName", "SOS.StackAndOtherTests", MemberType = typeof(SOSTestHelpers))]
+ [Theory, MemberData(nameof(SOSTestHelpers.GetConfigurations), "TestName", "SOS.StackAndOtherTests", MemberType = typeof(SOSTestHelpers))]
public async Task StackAndOtherTests(TestConfiguration config)
{
// Single-file .NET 8 servicing DAC signature verification fails with CDB SecureLoadDotNetExtensions.
@@ -924,7 +923,7 @@ public SOSPluginTests(ITestOutputHelper output)
private ITestOutputHelper Output { get; set; }
- [SkippableTheory, MemberData(nameof(SOSTestHelpers.Configurations), MemberType = typeof(SOSTestHelpers))]
+ [Theory, MemberData(nameof(SOSTestHelpers.Configurations), MemberType = typeof(SOSTestHelpers))]
public async Task LLDBPluginTests(TestConfiguration config)
{
SOSTestHelpers.SkipIfArm(config);
diff --git a/src/tests/SOS.UnitTests/SOSRunner.cs b/src/tests/SOS.UnitTests/SOSRunner.cs
index d45026f038..feb7446bf3 100644
--- a/src/tests/SOS.UnitTests/SOSRunner.cs
+++ b/src/tests/SOS.UnitTests/SOSRunner.cs
@@ -1,4 +1,4 @@
-// Licensed to the .NET Foundation under one or more agreements.
+// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using System;
@@ -13,7 +13,7 @@
using System.Threading;
using System.Threading.Tasks;
using Microsoft.Diagnostics.TestHelpers;
-using Xunit.Abstractions;
+using Xunit;
using Xunit.Extensions;
public class SOSRunner : IDisposable
diff --git a/src/tests/SOS.UnitTests/xunit.runner.json b/src/tests/SOS.UnitTests/xunit.runner.json
index f0245a5b0f..53912d55f1 100644
--- a/src/tests/SOS.UnitTests/xunit.runner.json
+++ b/src/tests/SOS.UnitTests/xunit.runner.json
@@ -1,4 +1,5 @@
{
"$schema": "https://xunit.net/schema/current/xunit.runner.schema.json",
+ "shadowCopy": false,
"preEnumerateTheories": false
}
diff --git a/src/tests/dotnet-counters/ConsoleExporterTests.cs b/src/tests/dotnet-counters/ConsoleExporterTests.cs
index 12680effa1..8917344965 100644
--- a/src/tests/dotnet-counters/ConsoleExporterTests.cs
+++ b/src/tests/dotnet-counters/ConsoleExporterTests.cs
@@ -10,7 +10,6 @@
using Microsoft.Diagnostics.Tests.Common;
using Microsoft.Diagnostics.Tools.Counters.Exporters;
using Xunit;
-using Xunit.Abstractions;
namespace DotnetCounters.UnitTests
{
diff --git a/src/tests/dotnet-counters/CounterMonitorPayloadTests.cs b/src/tests/dotnet-counters/CounterMonitorPayloadTests.cs
index 38bc614706..ae4e35468e 100644
--- a/src/tests/dotnet-counters/CounterMonitorPayloadTests.cs
+++ b/src/tests/dotnet-counters/CounterMonitorPayloadTests.cs
@@ -1,4 +1,4 @@
-// Licensed to the .NET Foundation under one or more agreements.
+// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using System;
@@ -13,7 +13,6 @@
using Microsoft.Diagnostics.TestHelpers;
using Microsoft.Diagnostics.Tools.Counters;
using Xunit;
-using Xunit.Abstractions;
using Xunit.Extensions;
using TestRunner = Microsoft.Diagnostics.CommonTestRunner.TestRunner;
using Constants = DotnetCounters.UnitTests.TestConstants;
@@ -42,7 +41,7 @@ public CounterMonitorPayloadTests(ITestOutputHelper outputHelper)
_outputHelper = outputHelper;
}
- [SkippableTheory, MemberData(nameof(Configurations))]
+ [Theory, MemberData(nameof(Configurations))]
public async Task TestCounterMonitorCustomMetricsJSON(TestConfiguration configuration)
{
CheckRuntimeOS();
@@ -53,7 +52,7 @@ public async Task TestCounterMonitorCustomMetricsJSON(TestConfiguration configur
ValidateCustomMetrics(metricComponents, CountersExportFormat.json);
}
- [SkippableTheory, MemberData(nameof(Configurations))]
+ [Theory, MemberData(nameof(Configurations))]
public async Task TestCounterMonitorCustomMetricsCSV(TestConfiguration configuration)
{
CheckRuntimeOS();
@@ -64,7 +63,7 @@ public async Task TestCounterMonitorCustomMetricsCSV(TestConfiguration configura
ValidateCustomMetrics(metricComponents, CountersExportFormat.csv);
}
- [SkippableTheory, MemberData(nameof(Configurations))]
+ [Theory, MemberData(nameof(Configurations))]
public async Task TestCounterMonitorEventCounterSystemRuntimeMetricsJSON(TestConfiguration configuration)
{
CheckRuntimeOS();
@@ -74,7 +73,7 @@ public async Task TestCounterMonitorEventCounterSystemRuntimeMetricsJSON(TestCon
ValidateEventCounterSystemRuntimeMetrics(metricComponents);
}
- [SkippableTheory, MemberData(nameof(Configurations))]
+ [Theory, MemberData(nameof(Configurations))]
public async Task TestCounterMonitorEventCounterSystemRuntimeMetricsCSV(TestConfiguration configuration)
{
CheckRuntimeOS();
diff --git a/src/tests/dotnet-trace/ChildProcessTests.cs b/src/tests/dotnet-trace/ChildProcessTests.cs
index 73b59d44bf..21444aa7c1 100644
--- a/src/tests/dotnet-trace/ChildProcessTests.cs
+++ b/src/tests/dotnet-trace/ChildProcessTests.cs
@@ -1,4 +1,4 @@
-// Licensed to the .NET Foundation under one or more agreements.
+// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using System.Collections.Generic;
@@ -7,7 +7,6 @@
using Microsoft.Diagnostics.CommonTestRunner;
using Microsoft.Diagnostics.TestHelpers;
using Xunit;
-using Xunit.Abstractions;
using Xunit.Extensions;
using TestRunner = Microsoft.Diagnostics.CommonTestRunner.TestRunner;
@@ -91,7 +90,7 @@ private void LaunchDotNetTrace(TestConfiguration config, string dotnetTraceComma
}
}
- [SkippableTheory, MemberData(nameof(Configurations))]
+ [Theory, MemberData(nameof(Configurations))]
public void VerifyExitCode(TestConfiguration config)
{
VerifyExitCodeX(config, "232", 232);
@@ -105,7 +104,7 @@ private void VerifyExitCodeX(TestConfiguration config, string commandLineArg, in
Assert.Contains($"Process exited with code '{exitCode}'.", stdOut);
}
- [SkippableTheory, MemberData(nameof(Configurations))]
+ [Theory, MemberData(nameof(Configurations))]
public void VerifyHideIO(TestConfiguration config)
{
LaunchDotNetTrace(config, "collect -o VerifyHideIO.nettrace", "0 this is a message", out int dotnetTraceExitCode, out string stdOut, out string stdErr);
@@ -119,7 +118,7 @@ public void VerifyHideIO(TestConfiguration config)
}
}
- [SkippableTheory, MemberData(nameof(Configurations))]
+ [Theory, MemberData(nameof(Configurations))]
public void VerifyShowIO(TestConfiguration config)
{
LaunchDotNetTrace(config, "collect -o VerifyShowIO.nettrace --show-child-io", "0 this is a message", out int dotnetTraceExitCode, out string stdOut, out string stdErr);
diff --git a/src/tests/dotnet-trace/CollectCommandFunctionalTests.cs b/src/tests/dotnet-trace/CollectCommandFunctionalTests.cs
index c59802287e..e5f403aa10 100644
--- a/src/tests/dotnet-trace/CollectCommandFunctionalTests.cs
+++ b/src/tests/dotnet-trace/CollectCommandFunctionalTests.cs
@@ -1,4 +1,4 @@
-// Licensed to the .NET Foundation under one or more agreements.
+// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using System;
@@ -13,7 +13,6 @@
using Microsoft.Diagnostics.Tools.Trace;
using Microsoft.Internal.Common.Utils;
using Xunit;
-using Xunit.Abstractions;
namespace Microsoft.Diagnostics.Tools.Trace
{
diff --git a/src/tests/dotnet-trace/CollectLinuxCommandFunctionalTests.cs b/src/tests/dotnet-trace/CollectLinuxCommandFunctionalTests.cs
index 6a3f429b3f..a05473881d 100644
--- a/src/tests/dotnet-trace/CollectLinuxCommandFunctionalTests.cs
+++ b/src/tests/dotnet-trace/CollectLinuxCommandFunctionalTests.cs
@@ -13,10 +13,8 @@
using System.Threading.Tasks;
using Microsoft.Diagnostics.Tests.Common;
using Microsoft.Diagnostics.Tools.Trace;
-using Microsoft.DotNet.XUnitExtensions;
using Microsoft.Internal.Common.Utils;
using Xunit;
-using Xunit.Abstractions;
namespace Microsoft.Diagnostics.Tools.Trace
{
@@ -32,7 +30,6 @@ public CollectLinuxCommandFunctionalTests(ITestOutputHelper outputHelper)
_outputHelper = outputHelper;
}
private static CollectLinuxCommandHandler.CollectLinuxArgs TestArgs(
- CancellationToken ct = default,
string[] providers = null,
string clrEventLevel = "",
string clrEvents = "",
@@ -44,7 +41,7 @@ private static CollectLinuxCommandHandler.CollectLinuxArgs TestArgs(
int processId = 0,
bool probe = false)
{
- return new CollectLinuxCommandHandler.CollectLinuxArgs(ct,
+ return new CollectLinuxCommandHandler.CollectLinuxArgs(TestContext.Current.CancellationToken,
providers ?? Array.Empty(),
clrEventLevel,
clrEvents,
@@ -57,29 +54,32 @@ private static CollectLinuxCommandHandler.CollectLinuxArgs TestArgs(
probe);
}
- [ConditionalTheory(nameof(IsCollectLinuxSupported))]
+ [Theory]
[MemberData(nameof(BasicCases))]
public void CollectLinuxCommandProviderConfigurationConsolidation(object testArgs, string[] expectedLines)
{
+ Assert.SkipUnless(IsCollectLinuxSupported, "Condition 'IsCollectLinuxSupported' was not met.");
MockConsole console = new(200, 30, _outputHelper);
int exitCode = Run(testArgs, console);
Assert.Equal((int)ReturnCode.Ok, exitCode);
console.AssertSanitizedLinesEqual(CollectLinuxSanitizer, expectedLines);
}
- [ConditionalTheory(nameof(IsCollectLinuxSupported))]
+ [Theory]
[MemberData(nameof(InvalidProviders))]
public void CollectLinuxCommandProviderConfigurationConsolidation_Throws(object testArgs, string[] expectedException)
{
+ Assert.SkipUnless(IsCollectLinuxSupported, "Condition 'IsCollectLinuxSupported' was not met.");
MockConsole console = new(200, 30, _outputHelper);
int exitCode = Run(testArgs, console);
Assert.Equal((int)ReturnCode.ArgumentError, exitCode);
console.AssertSanitizedLinesEqual(null, expectedException);
}
- [ConditionalFact(nameof(IsCollectLinuxSupported))]
+ [Fact]
public void CollectLinuxCommand_ReportsResolveProcessErrors()
{
+ Assert.SkipUnless(IsCollectLinuxSupported, "Condition 'IsCollectLinuxSupported' was not met.");
MockConsole console = new(200, 30, _outputHelper);
var args = TestArgs(processId: -1);
int exitCode = Run(args, console);
@@ -88,9 +88,10 @@ public void CollectLinuxCommand_ReportsResolveProcessErrors()
console.AssertSanitizedLinesEqual(null, FormatException("-1 is not a valid process ID"));
}
- [ConditionalFact(nameof(IsCollectLinuxSupported))]
+ [Fact]
public void CollectLinuxCommand_ReportsResolveProcessNameErrors()
{
+ Assert.SkipUnless(IsCollectLinuxSupported, "Condition 'IsCollectLinuxSupported' was not met.");
MockConsole console = new(200, 30, _outputHelper);
var args = TestArgs(name: "process-that-should-not-exist", processId: 0);
int exitCode = Run(args, console);
@@ -99,10 +100,11 @@ public void CollectLinuxCommand_ReportsResolveProcessNameErrors()
console.AssertSanitizedLinesEqual(null, FormatException("There is no active process with the given name: process-that-should-not-exist"));
}
- [ConditionalTheory(nameof(IsCollectLinuxSupported))]
+ [Theory]
[MemberData(nameof(ResolveProcessExceptions))]
public void CollectLinuxCommand_ResolveProcessExceptions(object testArgs, string[] expectedError)
{
+ Assert.SkipUnless(IsCollectLinuxSupported, "Condition 'IsCollectLinuxSupported' was not met.");
MockConsole console = new(200, 30, _outputHelper);
int exitCode = Run(testArgs, console);
@@ -111,9 +113,10 @@ public void CollectLinuxCommand_ResolveProcessExceptions(object testArgs, string
console.AssertSanitizedLinesEqual(null, expectedError);
}
- [ConditionalFact(nameof(IsCollectLinuxSupported))]
+ [Fact]
public void CollectLinuxCommand_Probe_ListsProcesses_WhenNoArgs()
{
+ Assert.SkipUnless(IsCollectLinuxSupported, "Condition 'IsCollectLinuxSupported' was not met.");
MockConsole console = new(200, 2000, _outputHelper);
var args = TestArgs(probe: true, output: new FileInfo(CommonOptions.DefaultTraceName));
int exitCode = Run(args, console);
@@ -131,9 +134,10 @@ public void CollectLinuxCommand_Probe_ListsProcesses_WhenNoArgs()
console.AssertSanitizedLinesEqual(CollectLinuxProbeSanitizer, expected);
}
- [ConditionalFact(nameof(IsCollectLinuxSupported))]
+ [Fact]
public void CollectLinuxCommand_Probe_CsvToConsole()
{
+ Assert.SkipUnless(IsCollectLinuxSupported, "Condition 'IsCollectLinuxSupported' was not met.");
MockConsole console = new(200, 2000, _outputHelper);
var args = TestArgs(probe: true, output: new FileInfo("stdout"));
int exitCode = Run(args, console);
@@ -148,9 +152,10 @@ public void CollectLinuxCommand_Probe_CsvToConsole()
console.AssertSanitizedLinesEqual(CollectLinuxProbeSanitizer, expected);
}
- [ConditionalFact(nameof(IsCollectLinuxSupported))]
+ [Fact]
public void CollectLinuxCommand_Probe_Csv()
{
+ Assert.SkipUnless(IsCollectLinuxSupported, "Condition 'IsCollectLinuxSupported' was not met.");
MockConsole console = new(200, 2000, _outputHelper);
string tempFilePath = Path.GetTempFileName();
var args = TestArgs(probe: true, output: new FileInfo(tempFilePath));
@@ -167,9 +172,10 @@ public void CollectLinuxCommand_Probe_Csv()
console.AssertSanitizedLinesEqual(null, expected);
}
- [ConditionalFact(nameof(IsCollectLinuxSupported))]
+ [Fact]
public void CollectLinuxCommand_Probe_ReportsResolveProcessErrors_InvalidPid()
{
+ Assert.SkipUnless(IsCollectLinuxSupported, "Condition 'IsCollectLinuxSupported' was not met.");
MockConsole console = new(200, 30, _outputHelper);
var args = TestArgs(processId: -1, probe: true);
int exitCode = Run(args, console);
@@ -181,9 +187,10 @@ public void CollectLinuxCommand_Probe_ReportsResolveProcessErrors_InvalidPid()
console.AssertSanitizedLinesEqual(null, expected);
}
- [ConditionalFact(nameof(IsCollectLinuxSupported))]
+ [Fact]
public void CollectLinuxCommand_Probe_ReportsResolveProcessErrors_InvalidName()
{
+ Assert.SkipUnless(IsCollectLinuxSupported, "Condition 'IsCollectLinuxSupported' was not met.");
MockConsole console = new(200, 30, _outputHelper);
var args = TestArgs(name: "process-that-should-not-exist", processId: 0, probe: true);
int exitCode = Run(args, console);
@@ -195,9 +202,10 @@ public void CollectLinuxCommand_Probe_ReportsResolveProcessErrors_InvalidName()
console.AssertSanitizedLinesEqual(null, expected);
}
- [ConditionalFact(nameof(IsCollectLinuxSupported))]
+ [Fact]
public void CollectLinuxCommand_Probe_ReportsResolveProcessErrors_BothPidAndName()
{
+ Assert.SkipUnless(IsCollectLinuxSupported, "Condition 'IsCollectLinuxSupported' was not met.");
MockConsole console = new(200, 30, _outputHelper);
var args = TestArgs(name: "dummy", processId: 1, probe: true);
int exitCode = Run(args, console);
@@ -211,9 +219,10 @@ public void CollectLinuxCommand_Probe_ReportsResolveProcessErrors_BothPidAndName
console.AssertSanitizedLinesEqual(null, expected);
}
- [ConditionalFact(nameof(IsCollectLinuxSupported))]
+ [Fact]
public void CollectLinuxCommand_ReportsConnectionFailed_NonDotNetProcess()
{
+ Assert.SkipUnless(IsCollectLinuxSupported, "Condition 'IsCollectLinuxSupported' was not met.");
// PID 1 (init/systemd) exists but is not a .NET process — no diagnostic port.
string pid1Name = Process.GetProcessById(1).ProcessName;
MockConsole console = new(200, 30, _outputHelper);
@@ -225,9 +234,10 @@ public void CollectLinuxCommand_ReportsConnectionFailed_NonDotNetProcess()
$"Unable to connect to process '{pid1Name} (1)'. The process may have exited, or it doesn't have an accessible .NET diagnostic port."));
}
- [ConditionalFact(nameof(IsCollectLinuxSupported))]
+ [Fact]
public void CollectLinuxCommand_Probe_ReportsConnectionFailed_NonDotNetProcess()
{
+ Assert.SkipUnless(IsCollectLinuxSupported, "Condition 'IsCollectLinuxSupported' was not met.");
// PID 1 (init/systemd) exists but is not a .NET process — no diagnostic port.
string pid1Name = Process.GetProcessById(1).ProcessName;
MockConsole console = new(200, 2000, _outputHelper);
@@ -243,9 +253,10 @@ public void CollectLinuxCommand_Probe_ReportsConnectionFailed_NonDotNetProcess()
console.AssertSanitizedLinesEqual(null, expected);
}
- [ConditionalFact(nameof(IsCollectLinuxNotSupported))]
+ [Fact]
public void CollectLinuxCommand_NotSupported_OnNonLinux()
{
+ Assert.SkipUnless(IsCollectLinuxNotSupported, "Condition 'IsCollectLinuxNotSupported' was not met.");
MockConsole console = new(200, 30, _outputHelper);
int exitCode = Run(TestArgs(), console);
Assert.Equal((int)ReturnCode.PlatformNotSupportedError, exitCode);
@@ -255,9 +266,10 @@ public void CollectLinuxCommand_NotSupported_OnNonLinux()
});
}
- [ConditionalFact(nameof(IsCollectLinuxSupported))]
+ [Fact]
public void CollectLinuxCommand_RestoresCursorVisibility_OnSuccess()
{
+ Assert.SkipUnless(IsCollectLinuxSupported, "Condition 'IsCollectLinuxSupported' was not met.");
MockConsole console = new(200, 30, _outputHelper)
{
CursorVisible = false
@@ -269,9 +281,10 @@ public void CollectLinuxCommand_RestoresCursorVisibility_OnSuccess()
Assert.True(console.CursorVisible, "Cursor should be visible after command completes");
}
- [ConditionalFact(nameof(IsCollectLinuxSupported))]
+ [Fact]
public void CollectLinuxCommand_RestoresCursorVisibility_OnError()
{
+ Assert.SkipUnless(IsCollectLinuxSupported, "Condition 'IsCollectLinuxSupported' was not met.");
MockConsole console = new(200, 30, _outputHelper)
{
CursorVisible = false
@@ -290,11 +303,12 @@ public void CollectLinuxCommand_RestoresCursorVisibility_OnError()
Assert.Equal((int)ReturnCode.TracingError, exitCode);
}
- [ConditionalTheory(nameof(IsCollectLinuxSupported))]
+ [Theory]
[InlineData(true)]
[InlineData(false)]
public void CollectLinuxCommand_DoesNotChangeCursorVisibility_WhenOutputIsRedirected(bool initialCursorVisible)
{
+ Assert.SkipUnless(IsCollectLinuxSupported, "Condition 'IsCollectLinuxSupported' was not met.");
MockConsole console = new(200, 30, _outputHelper)
{
CursorVisible = initialCursorVisible,
@@ -308,9 +322,10 @@ public void CollectLinuxCommand_DoesNotChangeCursorVisibility_WhenOutputIsRedire
Assert.Equal(initialCursorVisible, console.CursorVisible);
}
- [ConditionalFact(nameof(IsCollectLinuxSupported))]
+ [Fact]
public void CollectLinuxCommand_DoesNotPrintStatusUpdates_WhenOutputIsRedirected()
{
+ Assert.SkipUnless(IsCollectLinuxSupported, "Condition 'IsCollectLinuxSupported' was not met.");
MockConsole console = new(200, 30, _outputHelper);
console.IsOutputRedirected = true;
@@ -329,9 +344,10 @@ public void CollectLinuxCommand_DoesNotPrintStatusUpdates_WhenOutputIsRedirected
Assert.DoesNotContain(lines, l => l.Contains("Press ", StringComparison.OrdinalIgnoreCase));
}
- [ConditionalFact(nameof(IsCollectLinuxSupported))]
+ [Fact]
public void CollectLinuxCommand_DoesNotReadKey_WhenInputIsRedirected()
{
+ Assert.SkipUnless(IsCollectLinuxSupported, "Condition 'IsCollectLinuxSupported' was not met.");
MockConsole console = new(200, 30, _outputHelper);
console.IsInputRedirected = true;
console.KeyAvailable = true;
@@ -359,9 +375,10 @@ public void CollectLinuxCommand_DoesNotReadKey_WhenInputIsRedirected()
Assert.True(callbackInvoked);
}
- [ConditionalFact(nameof(IsCollectLinuxSupported))]
+ [Fact]
public void CollectLinuxCommand_PrintsStatusOnce_WhenCursorRepositioningUnsupported()
{
+ Assert.SkipUnless(IsCollectLinuxSupported, "Condition 'IsCollectLinuxSupported' was not met.");
MockConsole console = new(200, 30, _outputHelper);
var handler = new CollectLinuxCommandHandler(console);
diff --git a/src/tests/dotnet-trace/DotnetTrace.UnitTests.csproj b/src/tests/dotnet-trace/DotnetTrace.UnitTests.csproj
index 056dd23295..155aab243a 100644
--- a/src/tests/dotnet-trace/DotnetTrace.UnitTests.csproj
+++ b/src/tests/dotnet-trace/DotnetTrace.UnitTests.csproj
@@ -4,10 +4,6 @@
$(NetCoreAppTestTargetFramework)
-
-
-
-
diff --git a/src/tests/eventpipe/ContentionEvents.cs b/src/tests/eventpipe/ContentionEvents.cs
index 2e41c356a3..18b104f56b 100644
--- a/src/tests/eventpipe/ContentionEvents.cs
+++ b/src/tests/eventpipe/ContentionEvents.cs
@@ -1,4 +1,4 @@
-// Licensed to the .NET Foundation under one or more agreements.
+// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using System;
@@ -10,7 +10,6 @@
using Microsoft.Diagnostics.NETCore.Client;
using Microsoft.Diagnostics.Tracing;
using Xunit;
-using Xunit.Abstractions;
namespace EventPipe.UnitTests.ContentionValidation
{
diff --git a/src/tests/eventpipe/CustomEvents.cs b/src/tests/eventpipe/CustomEvents.cs
index bb81f5fd5f..e714b39e11 100644
--- a/src/tests/eventpipe/CustomEvents.cs
+++ b/src/tests/eventpipe/CustomEvents.cs
@@ -1,4 +1,4 @@
-// Licensed to the .NET Foundation under one or more agreements.
+// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using System;
@@ -8,7 +8,6 @@
using EventPipe.UnitTests.Common;
using Microsoft.Diagnostics.NETCore.Client;
using Xunit;
-using Xunit.Abstractions;
namespace EventPipe.UnitTests.CustomEventsValidation
{
diff --git a/src/tests/eventpipe/EventPipe.UnitTests.csproj b/src/tests/eventpipe/EventPipe.UnitTests.csproj
index 0234a80bbe..500882ae9f 100644
--- a/src/tests/eventpipe/EventPipe.UnitTests.csproj
+++ b/src/tests/eventpipe/EventPipe.UnitTests.csproj
@@ -7,7 +7,6 @@
-
diff --git a/src/tests/eventpipe/GCEvents.cs b/src/tests/eventpipe/GCEvents.cs
index c4374ff0a5..ba8199974e 100644
--- a/src/tests/eventpipe/GCEvents.cs
+++ b/src/tests/eventpipe/GCEvents.cs
@@ -1,4 +1,4 @@
-// Licensed to the .NET Foundation under one or more agreements.
+// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using System;
@@ -10,7 +10,6 @@
using Microsoft.Diagnostics.NETCore.Client;
using Microsoft.Diagnostics.Tracing;
using Xunit;
-using Xunit.Abstractions;
namespace EventPipe.UnitTests.GCEventsValidation
{
diff --git a/src/tests/eventpipe/LoaderEvents.cs b/src/tests/eventpipe/LoaderEvents.cs
index a54cfea294..11c4a61673 100644
--- a/src/tests/eventpipe/LoaderEvents.cs
+++ b/src/tests/eventpipe/LoaderEvents.cs
@@ -1,4 +1,4 @@
-// Licensed to the .NET Foundation under one or more agreements.
+// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using System;
@@ -13,7 +13,6 @@
using Microsoft.Diagnostics.NETCore.Client;
using Microsoft.Diagnostics.Tracing;
using Xunit;
-using Xunit.Abstractions;
namespace EventPipe.UnitTests.LoaderEventsValidation
{
diff --git a/src/tests/eventpipe/MethodEvents.cs b/src/tests/eventpipe/MethodEvents.cs
index ef1daf66f3..39260dbf86 100644
--- a/src/tests/eventpipe/MethodEvents.cs
+++ b/src/tests/eventpipe/MethodEvents.cs
@@ -1,4 +1,4 @@
-// Licensed to the .NET Foundation under one or more agreements.
+// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using System;
@@ -10,7 +10,6 @@
using Microsoft.Diagnostics.NETCore.Client;
using Microsoft.Diagnostics.Tracing;
using Xunit;
-using Xunit.Abstractions;
namespace EventPipe.UnitTests.MethodEventsValidation
{
diff --git a/src/tests/eventpipe/ThreadPoolEvents.cs b/src/tests/eventpipe/ThreadPoolEvents.cs
index 3561aab0eb..138db9d038 100644
--- a/src/tests/eventpipe/ThreadPoolEvents.cs
+++ b/src/tests/eventpipe/ThreadPoolEvents.cs
@@ -1,4 +1,4 @@
-// Licensed to the .NET Foundation under one or more agreements.
+// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using System;
@@ -10,7 +10,6 @@
using Microsoft.Diagnostics.NETCore.Client;
using Microsoft.Diagnostics.Tracing;
using Xunit;
-using Xunit.Abstractions;
namespace EventPipe.UnitTests.ThreadPoolValidation
{
diff --git a/src/tests/eventpipe/common/RemoteTestExecutorHelper.cs b/src/tests/eventpipe/common/RemoteTestExecutorHelper.cs
index 92ee3e7b6b..59c71e4ffd 100644
--- a/src/tests/eventpipe/common/RemoteTestExecutorHelper.cs
+++ b/src/tests/eventpipe/common/RemoteTestExecutorHelper.cs
@@ -5,7 +5,7 @@
using System.Diagnostics;
using System.Threading.Tasks;
using Microsoft.DotNet.RemoteExecutor;
-using Xunit.Abstractions;
+using Xunit;
namespace EventPipe.UnitTests.Common
{
diff --git a/src/tests/eventpipe/providers.cs b/src/tests/eventpipe/providers.cs
index ffde173d9b..be15a699a1 100644
--- a/src/tests/eventpipe/providers.cs
+++ b/src/tests/eventpipe/providers.cs
@@ -1,4 +1,4 @@
-// Licensed to the .NET Foundation under one or more agreements.
+// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using System;
@@ -8,7 +8,6 @@
using EventPipe.UnitTests.Common;
using Microsoft.Diagnostics.NETCore.Client;
using Xunit;
-using Xunit.Abstractions;
// Use this test as an example of how to write tests for EventPipe in
// the dotnet/diagnostics repo