From 29114e76e559bbf1726002007e7cf1dd7ca0a203 Mon Sep 17 00:00:00 2001 From: Matous Kozak Date: Thu, 16 Jan 2025 13:28:05 +0000 Subject: [PATCH 1/3] unify adb and main console log output on Android --- src/Microsoft.DotNet.XHarness.Android/AdbRunner.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/Microsoft.DotNet.XHarness.Android/AdbRunner.cs b/src/Microsoft.DotNet.XHarness.Android/AdbRunner.cs index 4dabc65ae..dfbd5f357 100644 --- a/src/Microsoft.DotNet.XHarness.Android/AdbRunner.cs +++ b/src/Microsoft.DotNet.XHarness.Android/AdbRunner.cs @@ -154,6 +154,9 @@ public bool TryDumpAdbLog(string outputFilePath, string filterSpec = "") Directory.CreateDirectory(Path.GetDirectoryName(outputFilePath) ?? throw new ArgumentNullException(nameof(outputFilePath))); File.WriteAllText(outputFilePath, result.StandardOutput); _log.LogInformation($"Wrote current ADB log to {outputFilePath}"); + // The adb log is not directly accessible. + // Hence, we duplicate the log to the main console log to simplify the UX of failure investigation. + _log.LogInformation($"ADB log output:{Environment.NewLine}{result.StandardOutput}"); return true; } } From 414b29b88e5f62a022e508214230559d7502de16 Mon Sep 17 00:00:00 2001 From: Matous Kozak Date: Thu, 16 Jan 2025 13:36:12 +0000 Subject: [PATCH 2/3] unify main and appOutputLog for iOS devices --- .../AppOperations/AppTester.cs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/Microsoft.DotNet.XHarness.Apple/AppOperations/AppTester.cs b/src/Microsoft.DotNet.XHarness.Apple/AppOperations/AppTester.cs index 41f676fae..4dfe70bb2 100644 --- a/src/Microsoft.DotNet.XHarness.Apple/AppOperations/AppTester.cs +++ b/src/Microsoft.DotNet.XHarness.Apple/AppOperations/AppTester.cs @@ -361,11 +361,15 @@ private async Task RunDeviceTests( // We need to check for MT1111 (which means that mlaunch won't wait for the app to exit) IFileBackedLog aggregatedLog = Log.CreateReadableAggregatedLog(_mainLog, testReporter.CallbackLog); + // The app output log is not directly accessible. + // Hence, we duplicate the log to the main console log to simplify the UX of failure investigation. + IFileBackedLog aggregatedAppOutputLog = Log.CreateReadableAggregatedLog(_mainLog, appOutputLog); + var result = await RunAndWatchForAppSignal(() => _processManager.ExecuteCommandAsync( mlaunchArguments, aggregatedLog, - appOutputLog, - appOutputLog, + aggregatedAppOutputLog, + aggregatedAppOutputLog, timeout, envVars, cancellationToken: cancellationToken)); From ac5d1a1250d007663245d08817dcf578040d3f25 Mon Sep 17 00:00:00 2001 From: Matous Kozak Date: Tue, 21 Jan 2025 13:59:38 +0000 Subject: [PATCH 3/3] Unify logs for MacCatalyst --- .../AppOperations/AppRunnerBase.cs | 5 ++++- .../AppOperations/AppTester.cs | 3 ++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/Microsoft.DotNet.XHarness.Apple/AppOperations/AppRunnerBase.cs b/src/Microsoft.DotNet.XHarness.Apple/AppOperations/AppRunnerBase.cs index e2e94d048..a24848d6e 100644 --- a/src/Microsoft.DotNet.XHarness.Apple/AppOperations/AppRunnerBase.cs +++ b/src/Microsoft.DotNet.XHarness.Apple/AppOperations/AppRunnerBase.cs @@ -327,8 +327,11 @@ private CancellationTokenSource CaptureLogStream(string appName, bool useSimctl, } else { + // For MacCatalyst, the test output log does not propagate to the main log. + // Hence, we duplicate the log to the main console log to simplify the UX of failure investigation. + IFileBackedLog aggregatedAppOutputLog = Log.CreateReadableAggregatedLog(_mainLog, log); _processManager - .ExecuteCommandAsync("log", logArgs, _mainLog, log, log, TimeSpan.FromDays(1), cancellationToken: streamCancellation) + .ExecuteCommandAsync("log", logArgs, _mainLog, aggregatedAppOutputLog, aggregatedAppOutputLog, TimeSpan.FromDays(1), cancellationToken: streamCancellation) .DoNotAwait(); } diff --git a/src/Microsoft.DotNet.XHarness.Apple/AppOperations/AppTester.cs b/src/Microsoft.DotNet.XHarness.Apple/AppOperations/AppTester.cs index 4dfe70bb2..06dbb6c36 100644 --- a/src/Microsoft.DotNet.XHarness.Apple/AppOperations/AppTester.cs +++ b/src/Microsoft.DotNet.XHarness.Apple/AppOperations/AppTester.cs @@ -190,7 +190,8 @@ public AppTester( using var crashLogs = new Logs(_logs.Directory); ICrashSnapshotReporter crashReporter = _snapshotReporterFactory.Create(_mainLog, crashLogs, isDevice: !isSimulator, device.Name); - using ITestReporter testReporter = _testReporterFactory.Create(_mainLog, + using ITestReporter testReporter = _testReporterFactory.Create( + _mainLog, _mainLog, _logs, crashReporter,