Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 83e7b8dd authored by vadimt's avatar vadimt Committed by Vadim Tryshev
Browse files

Saving bugreport for the first failed test.

When a test fails, we need bugreport, but it's not guaranteed, as per b/279484565.

Test: presubmit
Bug: 273319213
Change-Id: If71aef768873c2ef57b11f32d628abf97bd76a5a
parent 3e3d3e78
Loading
Loading
Loading
Loading
+4 −3
Original line number Diff line number Diff line
@@ -26,6 +26,7 @@ import java.util.zip.ZipOutputStream;

public class FailureWatcher extends TestWatcher {
    private static final String TAG = "FailureWatcher";
    private static boolean sSavedBugreport = false;
    final private UiDevice mDevice;
    private final LauncherInstrumentation mLauncher;

@@ -127,10 +128,10 @@ public class FailureWatcher extends TestWatcher {
        dumpCommand("logcat -d -s TestRunner", diagFile(description, "FilteredLogcat", "txt"));

        // Dump bugreport
        final String systemAnomalyMessage = launcher.getSystemAnomalyMessage(false, false);
        if (systemAnomalyMessage != null) {
            Log.d(TAG, "Saving bugreport, system anomaly message: " + systemAnomalyMessage, e);
        if (!sSavedBugreport) {
            dumpCommand("bugreportz -s", diagFile(description, "Bugreport", "zip"));
            // Not saving bugreport for each failure for time and space economy.
            sSavedBugreport = true;
        }
    }