diff --git a/src/Tools/PrepareTests/TestDiscovery.cs b/src/Tools/PrepareTests/TestDiscovery.cs index 12a6ee80ff644..4a0c868b400d7 100644 --- a/src/Tools/PrepareTests/TestDiscovery.cs +++ b/src/Tools/PrepareTests/TestDiscovery.cs @@ -14,6 +14,8 @@ namespace PrepareTests; internal class TestDiscovery { + private static readonly object s_lock = new(); + public static bool RunDiscovery(string repoRootDirectory, string dotnetPath, bool isUnix) { var binDirectory = Path.Combine(repoRootDirectory, "artifacts", "bin"); @@ -32,11 +34,23 @@ public static bool RunDiscovery(string repoRootDirectory, string dotnetPath, boo ? dotnetFrameworkWorker : dotnetCoreWorker; - success &= RunWorker(dotnetPath, workerPath, assembly); + var result = RunWorker(dotnetPath, workerPath, assembly); + lock (s_lock) + { + success &= result; + } }); stopwatch.Stop(); - Console.WriteLine($"Discovered tests in {stopwatch.Elapsed}"); + if (success) + { + Console.WriteLine($"Discovered tests in {stopwatch.Elapsed}"); + } + else + { + Console.WriteLine($"Test discovery failed"); + } + return success; } @@ -44,7 +58,7 @@ public static bool RunDiscovery(string repoRootDirectory, string dotnetPath, boo { var testDiscoveryWorkerFolder = Path.Combine(binDirectory, "TestDiscoveryWorker"); var configuration = Directory.Exists(Path.Combine(testDiscoveryWorkerFolder, "Debug")) ? "Debug" : "Release"; - return (Path.Combine(testDiscoveryWorkerFolder, configuration, "net7.0", "TestDiscoveryWorker.dll"), + return (Path.Combine(testDiscoveryWorkerFolder, configuration, "net8.0", "TestDiscoveryWorker.dll"), Path.Combine(testDiscoveryWorkerFolder, configuration, "net472", "TestDiscoveryWorker.exe")); } @@ -95,6 +109,12 @@ static bool RunWorker(string dotnetPath, string pathToWorker, string pathToAssem pipeClient.WaitForExit(); success &= pipeClient.ExitCode == 0; pipeClient.Close(); + + if (!success) + { + Console.WriteLine($"Failed to discover tests in {pathToAssembly}"); + } + return success; } diff --git a/src/Tools/TestDiscoveryWorker/TestDiscoveryWorker.csproj b/src/Tools/TestDiscoveryWorker/TestDiscoveryWorker.csproj index ba3851edfe4fe..b5334c458df4a 100644 --- a/src/Tools/TestDiscoveryWorker/TestDiscoveryWorker.csproj +++ b/src/Tools/TestDiscoveryWorker/TestDiscoveryWorker.csproj @@ -2,7 +2,7 @@ Exe - net7.0;net472 + net8.0;net472 enable