Bug 1461440 - test-verify should support MOZHARNESS_TEST_PATHS. r=gbrown
authorJoel Maher <jmaher@mozilla.com>
Wed, 23 May 2018 09:59:51 -0400
changeset 419630 dcd341823c776b650d3c89c07ad781675095dd83
parent 419629 51743cb0e425282d0111bdd414a581a838a7ce0e
child 419631 8f56e6dd916450dd9c3de12894cf531497c0a71e
push id64364
push userapavel@mozilla.com
push dateWed, 23 May 2018 22:04:11 +0000
treeherderautoland@538e4b3728c4 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgbrown
bugs1461440
milestone62.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 1461440 - test-verify should support MOZHARNESS_TEST_PATHS. r=gbrown
testing/mozharness/mozharness/mozilla/testing/per_test_base.py
testing/mozharness/scripts/android_emulator_unittest.py
testing/mozharness/scripts/desktop_unittest.py
testing/mozharness/scripts/web_platform_tests.py
--- a/testing/mozharness/mozharness/mozilla/testing/per_test_base.py
+++ b/testing/mozharness/mozharness/mozilla/testing/per_test_base.py
@@ -176,25 +176,28 @@ class SingleTestMixin(object):
         mozinfo.update({"e10s": e10s})
         headless = self.config.get('headless', False)
         mozinfo.update({"headless": headless})
         # FIXME(emilio): Need to update test expectations.
         mozinfo.update({'stylo': True})
         mozinfo.update({'verify': True})
         self.info("Per-test run using mozinfo: %s" % str(mozinfo.info))
 
-        # determine which files were changed on this push
-        url = '%s/json-automationrelevance/%s' % (repository.rstrip('/'), revision)
-        contents = self.retry(get_automationrelevance, attempts=2, sleeptime=10)
         changed_files = set()
-        for c in contents['changesets']:
-            self.info(" {cset} {desc}".format(
-                cset=c['node'][0:12],
-                desc=c['desc'].splitlines()[0].encode('ascii', 'ignore')))
-            changed_files |= set(c['files'])
+        if os.environ.get('MOZHARNESS_TEST_PATHS', None) is not None:
+            changed_files |= set(os.environ['MOZHARNESS_TEST_PATHS'].split(':'))
+        else:
+            # determine which files were changed on this push
+            url = '%s/json-automationrelevance/%s' % (repository.rstrip('/'), revision)
+            contents = self.retry(get_automationrelevance, attempts=2, sleeptime=10)
+            for c in contents['changesets']:
+                self.info(" {cset} {desc}".format(
+                    cset=c['node'][0:12],
+                    desc=c['desc'].splitlines()[0].encode('ascii', 'ignore')))
+                changed_files |= set(c['files'])
 
         if self.config.get('per_test_category') == "web-platform":
             self._find_wpt_tests(dirs, changed_files)
         elif self.config.get('gpu_required') == True:
             self._find_misc_tests(dirs, changed_files, gpu=True)
         else:
             self._find_misc_tests(dirs, changed_files)
 
--- a/testing/mozharness/scripts/android_emulator_unittest.py
+++ b/testing/mozharness/scripts/android_emulator_unittest.py
@@ -161,17 +161,17 @@ class AndroidEmulatorTest(TestingMixin, 
             # but org.mozilla.firefox for release builds, and there may be
             # other variations. 'aapt dump badging <apk>' could be used as an
             # alternative to package-name.txt, but introduces a dependency
             # on aapt, found currently in the Android SDK build-tools component.
             apk_dir = self.abs_dirs['abs_work_dir']
             self.apk_path = os.path.join(apk_dir, self.installer_path)
             unzip = self.query_exe("unzip")
             package_path = os.path.join(apk_dir, 'package-name.txt')
-            unzip_cmd = [unzip, '-q', '-o',  self.apk_path]
+            unzip_cmd = [unzip, '-q', '-o', self.apk_path]
             self.run_command(unzip_cmd, cwd=apk_dir, halt_on_failure=True)
             self.app_name = str(self.read_from_file(package_path, verbose=True)).rstrip()
         return self.app_name
 
     def _launch_emulator(self):
         env = self.query_env()
 
         # Write a default ddms.cfg to avoid unwanted prompts
@@ -431,23 +431,24 @@ class AndroidEmulatorTest(TestingMixin, 
                     continue
 
             if '%(app)' in option:
                 # only query package name if requested
                 cmd.extend([option % {'app': self._query_package_name()}])
             else:
                 cmd.extend([option % str_format_values])
 
-        if user_paths:
-            cmd.extend(user_paths.split(':'))
-        elif not self.verify_enabled:
-            if self.this_chunk is not None:
-                cmd.extend(['--this-chunk', self.this_chunk])
-            if self.total_chunks is not None:
-                cmd.extend(['--total-chunks', self.total_chunks])
+        if not (self.verify_enabled or self.per_test_coverage):
+            if user_paths:
+                cmd.extend(user_paths.split(':'))
+            elif not (self.verify_enabled or self.per_test_coverage):
+                if self.this_chunk is not None:
+                    cmd.extend(['--this-chunk', self.this_chunk])
+                if self.total_chunks is not None:
+                    cmd.extend(['--total-chunks', self.total_chunks])
 
         try_options, try_tests = self.try_args(self.test_suite)
         cmd.extend(try_options)
         if not self.verify_enabled and not self.per_test_coverage:
             cmd.extend(self.query_tests_args(
                 self.config["suite_definitions"][self.test_suite].get("tests"),
                 None,
                 try_tests))
--- a/testing/mozharness/scripts/desktop_unittest.py
+++ b/testing/mozharness/scripts/desktop_unittest.py
@@ -396,21 +396,22 @@ class DesktopUnittest(TestingMixin, Merc
 
             if suite_category not in SUITE_NO_E10S:
                 if suite_category in SUITE_DEFAULT_E10S and not c['e10s']:
                     base_cmd.append('--disable-e10s')
                 elif suite_category not in SUITE_DEFAULT_E10S and c['e10s']:
                     base_cmd.append('--e10s')
 
             # Ignore chunking if we have user specified test paths
-            if os.environ.get('MOZHARNESS_TEST_PATHS'):
-                base_cmd.extend(os.environ['MOZHARNESS_TEST_PATHS'].split(':'))
-            elif c.get('total_chunks') and c.get('this_chunk') and not self.verify_enabled:
-                base_cmd.extend(['--total-chunks', c['total_chunks'],
-                                 '--this-chunk', c['this_chunk']])
+            if not (self.verify_enabled or self.per_test_coverage):
+                if os.environ.get('MOZHARNESS_TEST_PATHS'):
+                    base_cmd.extend(os.environ['MOZHARNESS_TEST_PATHS'].split(':'))
+                elif c.get('total_chunks') and c.get('this_chunk'):
+                    base_cmd.extend(['--total-chunks', c['total_chunks'],
+                                     '--this-chunk', c['this_chunk']])
 
             if c['no_random']:
                 if suite_category == "mochitest":
                     base_cmd.append('--bisect-chunk=default')
                 else:
                     self.warning("--no-random does not currently work with suites other than "
                                  "mochitest.")
 
--- a/testing/mozharness/scripts/web_platform_tests.py
+++ b/testing/mozharness/scripts/web_platform_tests.py
@@ -204,27 +204,28 @@ class WebPlatformTest(TestingMixin, Merc
         if not c["e10s"]:
             cmd.append("--disable-e10s")
 
         if c["single_stylo_traversal"]:
             cmd.append("--stylo-threads=1")
         else:
             cmd.append("--stylo-threads=4")
 
-        if os.environ.get('MOZHARNESS_TEST_PATHS'):
-            prefix = 'testing/web-platform'
-            paths = os.environ['MOZHARNESS_TEST_PATHS'].split(':')
-            paths = [os.path.join(dirs["abs_wpttest_dir"], os.path.relpath(p, prefix))
-                     for p in paths if p.startswith(prefix)]
-            cmd.extend(paths)
-        elif not self.verify_enabled:
-            for opt in ["total_chunks", "this_chunk"]:
-                val = c.get(opt)
-                if val:
-                    cmd.append("--%s=%s" % (opt.replace("_", "-"), val))
+        if not (self.verify_enabled or self.per_test_coverage):
+            if os.environ.get('MOZHARNESS_TEST_PATHS'):
+                prefix = 'testing/web-platform'
+                paths = os.environ['MOZHARNESS_TEST_PATHS'].split(':')
+                paths = [os.path.join(dirs["abs_wpttest_dir"], os.path.relpath(p, prefix))
+                         for p in paths if p.startswith(prefix)]
+                cmd.extend(paths)
+            else:
+                for opt in ["total_chunks", "this_chunk"]:
+                    val = c.get(opt)
+                    if val:
+                        cmd.append("--%s=%s" % (opt.replace("_", "-"), val))
 
         if "wdspec" in test_types:
             geckodriver_path = self._query_geckodriver()
             if not geckodriver_path or not os.path.isfile(geckodriver_path):
                 self.fatal("Unable to find geckodriver binary "
                            "in common test package: %s" % str(geckodriver_path))
             cmd.append("--webdriver-binary=%s" % geckodriver_path)
             cmd.append("--webdriver-arg=-vv")  # enable trace logs
@@ -232,17 +233,17 @@ class WebPlatformTest(TestingMixin, Merc
         options = list(c.get("options", []))
 
         str_format_values = {
             'binary_path': self.binary_path,
             'test_path': dirs["abs_wpttest_dir"],
             'test_install_path': dirs["abs_test_install_dir"],
             'abs_app_dir': abs_app_dir,
             'abs_work_dir': dirs["abs_work_dir"]
-            }
+        }
 
         test_type_suite = {
             "testharness": "web-platform-tests",
             "reftest": "web-platform-tests-reftests",
             "wdspec": "web-platform-tests-wdspec",
         }
         for test_type in test_types:
             try_options, try_tests = self.try_args(test_type_suite[test_type])