Bug 1048446 - [mochitest] Check for a modules dir in the parent directory even if there is a build, r?gbrown
MozReview-Commit-ID: Jqyhbj7nC6z
--- 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)