Bug 1048446 - [mochitest] Check for a modules dir in the parent directory even if there is a build, r?gbrown draft
authorAndrew Halberstadt <ahalberstadt@mozilla.com>
Mon, 29 May 2017 14:29:43 -0400
changeset 591740 9bdde9c16d10d0a0c3dabb915a75cd20f80b7582
parent 591739 0bd0a111e3e236116d4a81bc137da617984f1442
child 591741 83ad9475ab0e994fd363846e6e1dee27781b49bc
push id63159
push userahalberstadt@mozilla.com
push dateFri, 09 Jun 2017 15:00:30 +0000
reviewersgbrown
bugs1048446
milestone55.0a1
Bug 1048446 - [mochitest] Check for a modules dir in the parent directory even if there is a build, r?gbrown MozReview-Commit-ID: Jqyhbj7nC6z
testing/mochitest/mochitest_options.py
--- a/testing/mochitest/mochitest_options.py
+++ b/testing/mochitest/mochitest_options.py
@@ -760,34 +760,29 @@ class MochitestArguments(ArgumentContain
         if options.jscov_dir_prefix:
             options.jscov_dir_prefix = os.path.abspath(options.jscov_dir_prefix)
             if not os.path.isdir(options.jscov_dir_prefix):
                 parser.error(
                     "directory %s does not exist as a destination for coverage "
                     "data." % options.jscov_dir_prefix)
 
         if options.testingModulesDir is None:
+            # Try to guess the testing modules directory.
+            possible = [os.path.join(here, os.path.pardir, 'modules')]
             if build_obj:
-                options.testingModulesDir = os.path.join(
-                    build_obj.topobjdir, '_tests', 'modules')
-            else:
-                # Try to guess the testing modules directory.
-                # This somewhat grotesque hack allows the buildbot machines to find the
-                # modules directory without having to configure the buildbot hosts. This
-                # code should never be executed in local runs because the build system
-                # should always set the flag that populates this variable. If buildbot ever
-                # passes this argument, this code can be deleted.
-                possible = os.path.join(here, os.path.pardir, 'modules')
+                possible.insert(0, os.path.join(build_obj.topobjdir, '_tests', 'modules'))
 
-                if os.path.isdir(possible):
-                    options.testingModulesDir = possible
+            for p in possible:
+                if os.path.isdir(p):
+                    options.testingModulesDir = p
+                    break
 
         if build_obj:
             plugins_dir = os.path.join(build_obj.distdir, 'plugins')
-            if plugins_dir not in options.extraProfileFiles:
+            if os.path.isdir(plugins_dir) and plugins_dir not in options.extraProfileFiles:
                 options.extraProfileFiles.append(plugins_dir)
 
         # Even if buildbot is updated, we still want this, as the path we pass in
         # to the app must be absolute and have proper slashes.
         if options.testingModulesDir is not None:
             options.testingModulesDir = os.path.normpath(
                 options.testingModulesDir)