Bug 1261188 - support test suite setup commands r?dustin draft
authorRob Thijssen <rthijssen@mozilla.com>
Wed, 11 Jan 2017 10:55:49 +0000
changeset 467253 820f774b92169b2ce9e67b2d140d48ff89a87bd8
parent 458771 2963cf6be7f830c0d2155e2968cfc53585868a76
child 467254 112aeb0d9ff4ed7fb4bcaccf6cf66d10bceb9371
push id43126
push userrthijssen@mozilla.com
push dateFri, 27 Jan 2017 12:33:00 +0000
reviewersdustin
bugs1261188
milestone53.0a1
Bug 1261188 - support test suite setup commands r?dustin MozReview-Commit-ID: 6te0i7EKUDf
taskcluster/ci/test/tests.yml
taskcluster/taskgraph/transforms/tests.py
--- a/taskcluster/ci/test/tests.yml
+++ b/taskcluster/ci/test/tests.yml
@@ -1190,8 +1190,17 @@ xpcshell:
                             - remove_executables.py
                 extra-options:
                     by-test-platform:
                         linux64-ccov/opt:
                             - --xpcshell-suite=xpcshell
                             - --code-coverage
                         default:
                             - --xpcshell-suite=xpcshell
+    setup-commands:
+        by-test-platform:
+            windows10.*:
+                # this powershell command ensures that the MS Edge AppX package and Edge profile settings folders are available to the task user. See bug 1326434
+                - 'powershell -command "& {& Add-AppxPackage -DisableDevelopmentMode -Register C:\Windows\SystemApps\Microsoft.MicrosoftEdge_8wekyb3d8bbwe\AppXManifest.xml -Verbose }"'
+                # these registry entries mock some typed url history for the task user in Edge. See bug 1261188
+                - 'reg add "HKCU\SOFTWARE\Classes\Local Settings\Software\Microsoft\Windows\CurrentVersion\AppContainer\Storage\microsoft.microsoftedge_8wekyb3d8bbwe\MicrosoftEdge\TypedURLs" /f /v url1 /t REG_SZ /d "http://mozilla.org/"'
+                - 'reg add "HKCU\SOFTWARE\Classes\Local Settings\Software\Microsoft\Windows\CurrentVersion\AppContainer\Storage\microsoft.microsoftedge_8wekyb3d8bbwe\MicrosoftEdge\TypedURLs" /f /v url2 /t REG_SZ /d "http://firefox.com/"'
+            default: []
--- a/taskcluster/taskgraph/transforms/tests.py
+++ b/taskcluster/taskgraph/transforms/tests.py
@@ -280,16 +280,19 @@ test_description_schema = Schema({
     'test-platform': basestring,
 
     # the name of the test (the key in tests.yml)
     'test-name': basestring,
 
     # the product name, defaults to firefox
     Optional('product'): basestring,
 
+    # setup commands required before task run
+    Optional('setup-commands', default=[]): optionally_keyed_by('test-platform', [basestring]),
+
 }, required=True)
 
 
 @transforms.add
 def validate(config, tests):
     for test in tests:
         yield validate_schema(test_description_schema, test,
                               "In test {!r}:".format(test['test-name']))
@@ -328,16 +331,17 @@ def set_defaults(config, tests):
             test['allow-software-gl-layers'] = False
 
         test.setdefault('os-groups', [])
         test.setdefault('chunks', 1)
         test.setdefault('run-on-projects', ['all'])
         test.setdefault('instance-size', 'default')
         test.setdefault('max-run-time', 3600)
         test['mozharness'].setdefault('extra-options', [])
+        test.setdefault('setup-commands', [])
         yield test
 
 
 @transforms.add
 def set_target(config, tests):
     for test in tests:
         build_platform = test['build-platform']
         if build_platform.startswith('macosx'):
@@ -460,16 +464,17 @@ def handle_keyed_by(config, tests):
         'max-run-time',
         'chunks',
         'e10s',
         'suite',
         'run-on-projects',
         'os-groups',
         'mozharness.config',
         'mozharness.extra-options',
+        'setup-commands',
     ]
     for test in tests:
         for field in fields:
             resolve_keyed_by(test, field, item_name=test['test-name'])
         yield test
 
 
 @transforms.add
@@ -861,21 +866,26 @@ def generic_worker_setup(config, test, t
                 if isinstance(c, basestring) and c.startswith('--test-suite'):
                     mh_command[i] += suffix
 
     # bug 1311966 - symlink to artifacts until generic worker supports virtual artifact paths
     artifact_link_commands = ['mklink /d %cd%\\public\\test_info %cd%\\build\\blobber_upload_dir']
     for link in [a['path'] for a in artifacts if a['path'].startswith('public\\logs\\')]:
         artifact_link_commands.append('mklink %cd%\\{} %cd%\\{}'.format(link, link[7:]))
 
-    worker['command'] = artifact_link_commands + [
+    worker['command'] = artifact_link_commands
+
+    if test.get('setup-commands'):
+        worker['command'].extend(test['setup-commands'])
+
+    worker['command'].extend([
         {'task-reference': 'c:\\mozilla-build\\wget\\wget.exe {}'.format(mozharness_url)},
         'c:\\mozilla-build\\info-zip\\unzip.exe mozharness.zip',
         {'task-reference': ' '.join(mh_command)}
-    ]
+    ])
 
 
 @worker_setup_function("macosx-engine")
 def macosx_engine_setup(config, test, taskdesc):
     mozharness = test['mozharness']
 
     installer_url = ARTIFACT_URL.format('<build>', mozharness['build-artifact-name'])
     test_packages_url = ARTIFACT_URL.format('<build>',