Bug 1284874 - Add marionette test-suite to android_emulator_unittest.py; r?gbrown draft
authorMaja Frydrychowicz <mjzffr@gmail.com>
Wed, 24 Aug 2016 10:06:15 -0400
changeset 405507 47c9f79b54335859c28be32f1ec599de6957bd69
parent 405506 d37ac88ceb25fac3b7f646d0e56f803562883d18
child 405508 3649f9f2f183f63b1d640247833441c526b3056e
push id27507
push usermjzffr@gmail.com
push dateThu, 25 Aug 2016 15:12:45 +0000
reviewersgbrown
bugs1284874
milestone51.0a1
Bug 1284874 - Add marionette test-suite to android_emulator_unittest.py; r?gbrown MozReview-Commit-ID: 41TtPAHGWBg
testing/mozharness/configs/android/androidarm_4_3.py
testing/mozharness/scripts/android_emulator_unittest.py
--- a/testing/mozharness/configs/android/androidarm_4_3.py
+++ b/testing/mozharness/configs/android/androidarm_4_3.py
@@ -1,14 +1,16 @@
 import os
 
 config = {
     "buildbot_json_path": "buildprops.json",
     "hostutils_manifest_path": "testing/config/tooltool-manifests/linux64/hostutils.manifest",
     "robocop_package_name": "org.mozilla.roboexample.test",
+    "marionette_address": "localhost:2828",
+    "marionette_test_manifest": "unit-tests.ini",
     "tooltool_manifest_path": "testing/config/tooltool-manifests/androidarm_4_3/releng.manifest",
     "tooltool_cache": "/builds/tooltool_cache",
     "avds_dir": "/home/cltbld/.android",
     "emulator_manifest": """
         [
         {
         "size": 140097024,
         "digest": "51781032335c09103e8509b1a558bf22a7119392cf1ea301c49c01bdf21ff0ceb37d260bc1c322cd9b903252429fb01830fc27e4632be30cd345c95bf4b1a39b",
@@ -350,16 +352,33 @@ config = {
                 "--symbols-path=%(symbols_path)s",
                 "--xre-path=%(xre_path)s",
                 "--dm_trans=adb",
                 "--localBinDir=../bin",
                 "--apk=%(installer_path)s",
                 ".",
             ],
         },
+        "marionette": {
+            "run_filename": os.path.join("marionette","runtests.py"),
+            "testsdir": "marionette",
+            "options": [
+                "--emulator",
+                "--app=fennec",
+                "--package=%(app)s",
+                "--address=%(address)s",
+                "%(test_manifest)s",
+                "--disable-e10s",
+                "--gecko-log=%(gecko_log)s",
+                "--log-raw=%(raw_log_file)s",
+                "--log-errorsummary=%(error_summary_file)s",
+                "--symbols-path=%(symbols_path)s",
+                "--startup-timeout=300",
+            ],
+        },
 
     },  # end suite_definitions
     "download_minidump_stackwalk": True,
     "default_blob_upload_servers": [
         "https://blobupload.elasticbeanstalk.com",
     ],
     "blob_uploader_auth_file": os.path.join(os.getcwd(), "oauth.txt"),
 }
--- a/testing/mozharness/scripts/android_emulator_unittest.py
+++ b/testing/mozharness/scripts/android_emulator_unittest.py
@@ -149,16 +149,21 @@ class AndroidEmulatorTest(BlobUploadMixi
         dirs['abs_modules_dir'] = os.path.join(
             dirs['abs_test_install_dir'], 'modules')
         dirs['abs_blob_upload_dir'] = os.path.join(
             abs_dirs['abs_work_dir'], 'blobber_upload_dir')
         dirs['abs_emulator_dir'] = os.path.join(
             abs_dirs['abs_work_dir'], 'emulator')
         dirs['abs_mochitest_dir'] = os.path.join(
             dirs['abs_test_install_dir'], 'mochitest')
+        dirs['abs_marionette_dir'] = os.path.join(
+            dirs['abs_test_install_dir'], 'marionette', 'marionette')
+        dirs['abs_marionette_tests_dir'] = os.path.join(
+            dirs['abs_test_install_dir'], 'marionette', 'tests', 'testing',
+            'marionette', 'harness', 'marionette', 'tests')
         dirs['abs_avds_dir'] = self.config.get("avds_dir", "/home/cltbld/.android")
 
         for key in dirs.keys():
             if key not in abs_dirs:
                 abs_dirs[key] = dirs[key]
         self.abs_dirs = abs_dirs
         return self.abs_dirs
 
@@ -166,16 +171,19 @@ class AndroidEmulatorTest(BlobUploadMixi
     def _pre_create_virtualenv(self, action):
         dirs = self.query_abs_dirs()
 
         if os.path.isdir(dirs['abs_mochitest_dir']):
             # mochitest is the only thing that needs this
             requirements = os.path.join(dirs['abs_mochitest_dir'],
                         'websocketprocessbridge',
                         'websocketprocessbridge_requirements.txt')
+        elif self.test_suite == 'marionette':
+            requirements = os.path.join(dirs['abs_test_install_dir'],
+                                    'config', 'marionette_requirements.txt')
 
             self.register_virtualenv_module(requirements=[requirements],
                                             two_pass=True)
 
     def _launch_emulator(self):
         env = self.query_env()
 
         # Set $LD_LIBRARY_PATH to self.dirs['abs_work_dir'] so that
@@ -454,16 +462,23 @@ class AndroidEmulatorTest(BlobUploadMixi
             # TestingMixin._download_and_extract_symbols() will set
             # self.symbols_path when downloading/extracting.
             'symbols_path': self.symbols_path,
             'modules_dir': dirs['abs_modules_dir'],
             'installer_path': self.installer_path,
             'raw_log_file': raw_log_file,
             'error_summary_file': error_summary_file,
             'dm_trans': c['device_manager'],
+            # marionette options
+            'address': c.get('marionette_address'),
+            'gecko_log': os.path.join(dirs["abs_blob_upload_dir"], 'gecko.log'),
+            'test_manifest': os.path.join(
+                dirs['abs_marionette_tests_dir'],
+                self.config.get('marionette_test_manifest', '')
+            ),
         }
         for option in self.config["suite_definitions"][self.test_suite]["options"]:
             opt = option.split('=')[0]
             # override configured chunk options with script args, if specified
             if opt == '--this-chunk' and self.this_chunk is not None:
                 continue
             if opt == '--total-chunks' and self.total_chunks is not None:
                 continue