Bug 1395540 - Part 5: Enable DMD in automation. r=bc
authorEric Rahm <erahm@mozilla.com>
Fri, 15 Jun 2018 09:59:18 -0700
changeset 480146 fd922f7c07965ee775d8abb73b19df310dc261eb
parent 480145 3b8204a5fa3ab24e1d06db75a5748cb5c47a8475
child 480147 9253a827f52d262efee2f659095d38cf0b44fd0f
push id1757
push userffxbld-merge
push dateFri, 24 Aug 2018 17:02:43 +0000
treeherdermozilla-release@736023aebdb1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbc
bugs1395540
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 1395540 - Part 5: Enable DMD in automation. r=bc This adds support running AWSY with DMD in automation via mozharness. We use existence of dmd.py to detect whether or not dmd should be enabled. Additionally sandboxing has to be disabled in order to avoid crashes on Windows and OSX.
testing/awsy/conf/base-prefs.json
testing/awsy/conf/prefs.json
testing/awsy/mach_commands.py
testing/mozharness/scripts/awsy_script.py
--- a/testing/awsy/conf/base-prefs.json
+++ b/testing/awsy/conf/base-prefs.json
@@ -5,10 +5,11 @@
     "network.proxy.socks": "localhost",
     "network.proxy.socks_port": 90000,
     "network.proxy.socks_remote_dns": true,
     "network.proxy.type": 1,
     "plugin.disable": true,
     "startup.homepage_override_url": "",
     "startup.homepage_welcome_url": "",
     "browser.startup.homepage": "about:blank",
-    "browser.newtabpage.enabled": false
+    "browser.newtabpage.enabled": false,
+    "security.sandbox.content.level": 0
 }
--- a/testing/awsy/conf/prefs.json
+++ b/testing/awsy/conf/prefs.json
@@ -3,10 +3,11 @@
     "javascript.options.asyncstack": false,
     "image.mem.surfacecache.min_expiration_ms": 10000,
     "network.proxy.socks": "localhost",
     "network.proxy.socks_port": 90000,
     "network.proxy.socks_remote_dns": true,
     "network.proxy.type": 1,
     "plugin.disable": true,
     "startup.homepage_override_url": "",
-    "startup.homepage_welcome_url": ""
+    "startup.homepage_welcome_url": "",
+    "security.sandbox.content.level": 0
 }
--- a/testing/awsy/mach_commands.py
+++ b/testing/awsy/mach_commands.py
@@ -152,16 +152,22 @@ class MachCommands(MachCommandBase):
             if 'DMD' not in os.environ:
                 os.environ['DMD'] = '1'
 
             # Work around a startup crash with DMD on windows
             if mozinfo.os == 'win':
                 kwargs['pref'] = 'security.sandbox.content.level:0'
                 self.log(logging.WARNING, 'awsy', {},
                     'Forcing \'security.sandbox.content.level\' = 0 because DMD is enabled.')
+            elif mozinfo.os == 'mac':
+                # On mac binary is in MacOS and dmd.py is in Resources, ie:
+                #   Name.app/Contents/MacOS/libdmd.dylib
+                #   Name.app/Contents/Resources/dmd.py
+                bin_dir = os.path.join(bin_dir, "../Resources/")
+
 
             # Also add the bin dir to the python path so we can use dmd.py
             if bin_dir not in sys.path:
                 sys.path.append(bin_dir)
 
         for k, v in kwargs.iteritems():
             setattr(args, k, v)
 
--- a/testing/mozharness/scripts/awsy_script.py
+++ b/testing/mozharness/scripts/awsy_script.py
@@ -12,16 +12,18 @@ import copy
 import json
 import os
 import re
 import sys
 
 # load modules from parent dir
 sys.path.insert(1, os.path.dirname(sys.path[0]))
 
+import mozinfo
+
 from mozharness.base.script import PreScriptAction
 from mozharness.base.log import INFO, ERROR
 from mozharness.mozilla.testing.testbase import TestingMixin, testing_config_options
 from mozharness.base.vcs.vcsbase import MercurialScript
 from mozharness.mozilla.tooltool import TooltoolMixin
 from mozharness.mozilla.structuredlog import StructuredOutputParser
 from mozharness.mozilla.testing.codecoverage import (
     CodeCoverageMixin,
@@ -144,16 +146,39 @@ class AWSY(TestingMixin, MercurialScript
         '''
         dirs = self.abs_dirs
         env = {}
         error_summary_file = os.path.join(dirs['abs_blob_upload_dir'],
                                           'marionette_errorsummary.log')
 
         runtime_testvars = {'webRootDir': self.webroot_dir,
                             'resultsDir': self.results_dir}
+
+        # Check if this is a DMD build and if so enable it.
+        dmd_py_lib_dir = os.path.dirname(self.binary_path)
+        if mozinfo.os == 'mac':
+            # On mac binary is in MacOS and dmd.py is in Resources, ie:
+            #   Name.app/Contents/MacOS/libdmd.dylib
+            #   Name.app/Contents/Resources/dmd.py
+            dmd_py_lib_dir = os.path.join(dmd_py_lib_dir, "../Resources/")
+
+        dmd_path = os.path.join(dmd_py_lib_dir, "dmd.py")
+        if os.path.isfile(dmd_path):
+            runtime_testvars['dmd'] = True
+
+            # Allow the child process to import dmd.py
+            python_path = os.environ.get('PYTHONPATH')
+
+            if python_path:
+                os.environ['PYTHONPATH'] = "%s%s%s" % (python_path, os.pathsep, dmd_py_lib_dir)
+            else:
+                os.environ['PYTHONPATH'] = dmd_py_lib_dir
+
+            env['DMD']= "--mode=dark-matter --stacks=full"
+
         runtime_testvars_path = os.path.join(self.awsy_path, 'runtime-testvars.json')
         runtime_testvars_file = open(runtime_testvars_path, 'wb')
         runtime_testvars_file.write(json.dumps(runtime_testvars, indent=2))
         runtime_testvars_file.close()
 
         cmd = ['marionette']
 
         if self.config['test_about_blank']: