Bug 1550161 - Avoid attribute error in android gtest; r=bc
authorGeoff Brown <gbrown@mozilla.com>
Fri, 10 May 2019 01:19:43 +0000
changeset 532157 919f1307f466e0d747bcc5cc40947ddfb0d7662e
parent 532156 c21f692a069302eca39bdb1342bc6acb9fa14a3b
child 532158 1df96f5e640231e8ddbc8ed1dadaef69b55d4e62
push id11265
push userffxbld-merge
push dateMon, 13 May 2019 10:53:39 +0000
treeherdermozilla-beta@77e0fe8dbdd3 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbc
bugs1550161
milestone68.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1550161 - Avoid attribute error in android gtest; r=bc Differential Revision: https://phabricator.services.mozilla.com/D30593
testing/gtest/remotegtests.py
--- a/testing/gtest/remotegtests.py
+++ b/testing/gtest/remotegtests.py
@@ -25,16 +25,18 @@ import mozlog
 LOGGER_NAME = 'gtest'
 log = mozlog.unstructured.getLogger(LOGGER_NAME)
 
 
 class RemoteGTests(object):
     """
        A test harness to run gtest on Android.
     """
+    def __init__(self):
+        self.device = None
 
     def build_environment(self, shuffle, test_filter):
         """
            Create and return a dictionary of all the appropriate env variables
            and values.
         """
         env = {}
         env["XPCOM_DEBUG_BREAK"] = "stack-and-abort"
@@ -185,20 +187,21 @@ class RemoteGTests(object):
         finally:
             try:
                 shutil.rmtree(dump_dir)
             except Exception:
                 log.warning("unable to remove directory: %s" % dump_dir)
         return crashed
 
     def cleanup(self):
-        self.device.stop_application(self.package)
-        self.device.rm(self.remote_log, force=True, root=True)
-        self.device.rm(self.remote_profile, recursive=True, force=True, root=True)
-        self.device.rm(self.remote_minidumps, recursive=True, force=True, root=True)
+        if self.device:
+            self.device.stop_application(self.package)
+            self.device.rm(self.remote_log, force=True, root=True)
+            self.device.rm(self.remote_profile, recursive=True, force=True, root=True)
+            self.device.rm(self.remote_minidumps, recursive=True, force=True, root=True)
 
 
 class AppWaiter(object):
     def __init__(self, device, remote_log,
                  test_proc_timeout=1200, test_proc_no_output_timeout=300,
                  test_proc_start_timeout=60, output_poll_interval=10):
         self.device = device
         self.remote_log = remote_log