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; } } 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 41f676fae..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, @@ -361,11 +362,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));