Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Harness] Make CrashSnapshotReporter injectable and add unit tests #8129

Merged
merged 43 commits into from
Mar 20, 2020
Merged
Show file tree
Hide file tree
Changes from 32 commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
a9c49ab
Move AppInstallMonitorLog
Mar 13, 2020
ba7f37f
Move Helpers.GenerateStableGuid
Mar 13, 2020
74d7816
Move DirectoryUtilities
Mar 13, 2020
61646f1
Move DirectoryUtilities.RootDirectory
Mar 13, 2020
88acdea
Add CrashSnapshot ctor
Mar 13, 2020
140a0cf
refactor CrashReportSnapshot
Mar 13, 2020
9f20fd2
Add WrenchLog
Mar 13, 2020
d378104
Move stuff out of Harness
Mar 13, 2020
2b5c649
Merge remote-tracking branch 'origin/master' into prvysoky/reafctor-u…
Mar 15, 2020
4fe4daa
Merge remote-tracking branch 'origin/master' into prvysoky/reafctor-u…
Mar 16, 2020
c38b390
Remove RootDirectory
Mar 16, 2020
9143073
Revert RootDirectory
Mar 16, 2020
c9dad7a
Merge remote-tracking branch 'origin/master' into prvysoky/reafctor-u…
Mar 16, 2020
ec1c35e
Merge remote-tracking branch 'origin/master' into prvysoky/reafctor-u…
Mar 16, 2020
27c873f
Merge remote-tracking branch 'origin/master' into prvysoky/reafctor-u…
Mar 17, 2020
929fc60
Merge remote-tracking branch 'origin/master' into prvysoky/reafctor-u…
Mar 17, 2020
fbcb828
Remove Initialize() calls
Mar 17, 2020
3435023
Make CrashReportSnapshot injectable
Mar 17, 2020
b3a7db5
Remove Harness dependency from CrashReportSnapshot
Mar 17, 2020
a6298c0
Add device snapshot tests
Mar 17, 2020
735fadf
Trim down IHarness and make properties of Harness readonly
Mar 17, 2020
2311882
Merge remote-tracking branch 'premun/prvysoky/reafctor-utils' into pr…
Mar 17, 2020
eabd707
Memoize xcoderoot
Mar 17, 2020
b68a323
Use MlaunchArguments
Mar 17, 2020
c407f39
Add MlaunchArguments docs
Mar 17, 2020
4185aec
Add CrashReportSnapshot docs
Mar 17, 2020
8329a72
Rename method
Mar 17, 2020
67b0093
Rename class
Mar 17, 2020
19dff9a
Refactor CrashSnapshotReporter
Mar 17, 2020
b064cec
Merge remote-tracking branch 'origin/master' into prvysoky/snapshots
Mar 17, 2020
aeac546
Inject AppRunner
Mar 17, 2020
b63618b
Indent parameters
Mar 17, 2020
667fdd5
Indent parameters
Mar 18, 2020
f1ca7fd
Fix unit tests
Mar 18, 2020
e00cf1f
Fix gathering crash logs
Mar 18, 2020
cda1d75
Add crash logs to output
Mar 18, 2020
3b3df84
Fix getting xcode root
Mar 18, 2020
51b6f65
Merge remote-tracking branch 'origin/master' into prvysoky/snapshots
Mar 18, 2020
5630743
Merge remote-tracking branch 'origin/master' into prvysoky/snapshots
Mar 19, 2020
6369304
Merge remote-tracking branch 'origin/master' into prvysoky/snapshots
Mar 19, 2020
5cf725c
Fix alignment
Mar 19, 2020
febde28
Merge remote-tracking branch 'origin/master' into prvysoky/snapshots
Mar 19, 2020
1032156
Merge remote-tracking branch 'origin/master' into prvysoky/snapshots
Mar 20, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions tests/xharness/AppRunner.cs
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ class AppRunner
readonly ISimulatorsLoaderFactory simulatorsLoaderFactory;
readonly ISimpleListenerFactory listenerFactory;
readonly IDeviceLoaderFactory devicesLoaderFactory;
readonly ICrashSnapshotReporterFactory snapshotReporterFactory;

readonly RunMode mode;
readonly bool isSimulator;
Expand Down Expand Up @@ -95,6 +96,7 @@ public AppRunner (IProcessManager processManager,
ISimulatorsLoaderFactory simulatorsFactory,
ISimpleListenerFactory simpleListenerFactory,
IDeviceLoaderFactory devicesFactory,
ICrashSnapshotReporterFactory snapshotReporterFactory,
AppRunnerTarget target,
IHarness harness,
ILog mainLog,
Expand All @@ -113,6 +115,7 @@ public AppRunner (IProcessManager processManager,
this.simulatorsLoaderFactory = simulatorsFactory ?? throw new ArgumentNullException (nameof (simulatorsFactory));
this.listenerFactory = simpleListenerFactory ?? throw new ArgumentNullException (nameof (simpleListenerFactory));
this.devicesLoaderFactory = devicesFactory ?? throw new ArgumentNullException (nameof (devicesFactory));
this.snapshotReporterFactory = snapshotReporterFactory ?? throw new ArgumentNullException (nameof (snapshotReporterFactory));
this.harness = harness ?? throw new ArgumentNullException (nameof (harness));
this.MainLog = mainLog ?? throw new ArgumentNullException (nameof (mainLog));
this.projectFilePath = projectFilePath ?? throw new ArgumentNullException (nameof (projectFilePath));
Expand Down Expand Up @@ -423,15 +426,14 @@ public bool TestsSucceeded (AppInformation appInfo, string test_log_path, bool t

public async Task<int> RunAsync ()
{
CrashReportSnapshot crash_reports;
ILog device_system_log = null;
ILog listener_log = null;
ILog run_log = MainLog;

if (!isSimulator)
FindDevice ();

crash_reports = new CrashReportSnapshot (harness, MainLog, Logs, isDevice: !isSimulator, deviceName);
ICrashSnapshotReporter crash_reports = snapshotReporterFactory.Create (MainLog, Logs, isDevice: !isSimulator, deviceName);

var args = new List<string> ();
if (!string.IsNullOrEmpty (harness.XcodeRoot)) {
Expand Down Expand Up @@ -747,7 +749,7 @@ public async Task<int> RunAsync ()
if (!success.Value) {
int pid = 0;
string crash_reason = null;
foreach (var crash in crash_reports.Logs) {
foreach (var crash in Logs) {
premun marked this conversation as resolved.
Show resolved Hide resolved
try {
if (pid == 0) {
// Find the pid
Expand Down Expand Up @@ -789,7 +791,7 @@ public async Task<int> RunAsync ()
variation,
$"App Crash {AppInformation.AppName} {variation}",
$"App crashed {crash_reason}.",
crash_reports.Log.FullPath,
MainLog.FullPath,
harness.XmlJargon);
}

Expand All @@ -813,7 +815,7 @@ public async Task<int> RunAsync ()
variation,
$"App Crash {AppInformation.AppName} {variation}",
$"App crashed: {FailureMessage}",
crash_reports.Log.FullPath,
MainLog.FullPath,
harness.XmlJargon);
}
} else if (launch_failure) {
Expand Down
151 changes: 0 additions & 151 deletions tests/xharness/CrashReportSnapshot.cs

This file was deleted.

Loading