Bug 1048446 - [mochitest] Check for a modules dir in the parent directory even if there is a build, r=gbrown
authorAndrew Halberstadt <ahalberstadt@mozilla.com>
Mon, 29 May 2017 14:29:43 -0400
changeset 411393 91ce65d749ad9261dd36d287c84a61e799fd5295
parent 411392 525728eff624112eedff5009655cd837c09420bd
child 411394 455513c2cfe74b08d6bbb127b2c44d95b9f194f3
push id7391
push usermtabara@mozilla.com
push dateMon, 12 Jun 2017 13:08:53 +0000
treeherdermozilla-beta@2191d7f87e2e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgbrown
bugs1048446
milestone55.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 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)