Bug 1286075: add a (temporary) marionette-harness kind; r=maja_zf draft
authorDustin J. Mitchell <dustin@mozilla.com>
Thu, 08 Sep 2016 00:32:50 +0000
changeset 412755 bf1b9c76da7d39d46672a130b031081999e97ed2
parent 412754 81f48fbd380d79773319781c5db84a0056c9341f
child 412756 30eb7ff4e0a44d33bf89276704ed1aa75e50391b
push id29252
push userdmitchell@mozilla.com
push dateMon, 12 Sep 2016 19:16:39 +0000
reviewersmaja_zf
bugs1286075
milestone51.0a1
Bug 1286075: add a (temporary) marionette-harness kind; r=maja_zf This has some notes for future work on the task, but will work for now. MozReview-Commit-ID: 7J4tQeKj3KJ
taskcluster/ci/marionette-harness/kind.yml
taskcluster/docs/kinds.rst
taskcluster/taskgraph/transforms/marionette_harness.py
taskcluster/taskgraph/transforms/task.py
taskcluster/taskgraph/try_option_syntax.py
new file mode 100644
--- /dev/null
+++ b/taskcluster/ci/marionette-harness/kind.yml
@@ -0,0 +1,55 @@
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+# NOTE: please write a description of this kind in taskcluster/docs/kinds.rst
+
+implementation: taskgraph.task.transform:TransformTask
+
+transforms:
+   - taskgraph.transforms.marionette_harness:transforms
+   - taskgraph.transforms.task:transforms
+
+# NOTE: this task should be refactored so that it is invoked as a job either
+# with a run.using of "mozharness", and combined with the source-check kind.
+
+jobs:
+    marionette-harness/opt:
+        description: "Marionette harness unit test"
+        attributes:
+            build_platform: marionette-harness
+            build_type: opt
+        index:
+            product: harness_test
+            job-name:
+                gecko-v2: marionette-harness-pytest-opt
+        treeherder:
+            platform: linux64/opt
+            kind: test
+            tier: 2
+            symbol: tc(Mn-h)
+        worker-type: aws-provisioner-v1/desktop-test-xlarge
+        worker:
+            implementation: docker-worker
+            docker-image: {in-tree: desktop-build}  # NOTE: better to use the lint image
+            env:
+                JOB_SCRIPT: "taskcluster/scripts/tester/harness-test-linux.sh"
+                MOZHARNESS_SCRIPT: "testing/mozharness/scripts/marionette_harness_tests.py\n" # NOTE: remove trailing newline
+                TOOLS_DISABLE: "true"
+                TOOLTOOL_REPO: "https://github.com/mozilla/build-tooltool"
+                TOOLTOOL_REV: "master"
+            artifacts:
+              - name: public/logs/
+                path: /home/worker/workspace/mozharness_workspace/upload/logs/
+                type: directory
+            command:
+              - "bash"
+              - "/home/worker/bin/build.sh"
+              - "--tests=testing/marionette/harness/marionette/tests/harness_unit"
+              - "--work-dir=mozharness_workspace"
+            max-run-time: 1800
+        when:
+            files-changed:
+              - "testing/marionette/harness/**"
+              - "testing/mozharness/scripts/marionette_harness_tests.py"
+              - "testing/config/marionette_harness_test_requirements.txt"
--- a/taskcluster/docs/kinds.rst
+++ b/taskcluster/docs/kinds.rst
@@ -72,16 +72,21 @@ spidermonkey portion.  Each task runs sp
 
 b2g-device
 ----------
 
 B2G device builds produce binaries targetted to specific devices.  These
 involve some device-specific binaries which are not redistributable, so the
 inputs to and outputs from these tasks are restricted.
 
+marionette-harness
+------------------
+
+TBD (Maja)
+
 Tests
 -----
 
 Test tasks for Gecko products are divided into several kinds, but share a
 common implementation.  The process goes like this, based on a set of YAML
 files named in ``kind.yml``:
 
  * For each build task, determine the related test platforms based on the build
new file mode 100644
--- /dev/null
+++ b/taskcluster/taskgraph/transforms/marionette_harness.py
@@ -0,0 +1,47 @@
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+"""
+Set dynamic task description properties of the marionette-harness task.
+"""
+
+from __future__ import absolute_import, print_function, unicode_literals
+
+import time
+from taskgraph.transforms.base import TransformSequence
+
+transforms = TransformSequence()
+
+
+@transforms.add
+def setup_task(config, tasks):
+    for task in tasks:
+        del task['name']
+        task['label'] = 'marionette-harness'
+        env = task['worker'].setdefault('env', {})
+        env.update({
+            'GECKO_BASE_REPOSITORY': config.params['base_repository'],
+            'GECKO_HEAD_REF': config.params['head_rev'],
+            'GECKO_HEAD_REPOSITORY': config.params['head_repository'],
+            'GECKO_HEAD_REV': config.params['head_rev'],
+            'MOZ_BUILD_DATE': time.strftime("%Y%m%d%H%M%S",
+                                            time.gmtime(config.params['pushdate'])),
+            'MOZ_SCM_LEVEL': config.params['level'],
+        })
+
+        task['worker']['caches'] = [{
+            'type': 'persistent',
+            'name': 'level-{}-{}-tc-vcs'.format(
+                config.params['level'], config.params['project']),
+            'mount-point': "/home/worker/.tc-vcs",
+        }]
+
+        if int(config.params['level']) > 1:
+            task['worker'].setdefault('caches', []).append({
+                'type': 'persistent',
+                'name': 'level-{}-{}-test-workspace'.format(
+                    config.params['level'], config.params['project']),
+                'mount-point': "/home/worker/workspace",
+            })
+
+        yield task
--- a/taskcluster/taskgraph/transforms/task.py
+++ b/taskcluster/taskgraph/transforms/task.py
@@ -78,18 +78,18 @@ task_description_schema = Schema({
         # treeherder environments (defaults to both staging and production)
         Required('environments', default=['production', 'staging']): ['production', 'staging'],
     },
 
     # information for indexing this build so its artifacts can be discovered;
     # if omitted, the build will not be indexed.
     Optional('index'): {
         # the name of the product this build produces
-        # TODO: remove lint when not used
-        'product': Any('firefox', 'mobile', 'b2g', 'lint'),
+        # TODO: remove lint, harnesss-test when not used
+        'product': Any('firefox', 'mobile', 'b2g', 'lint', 'harness_test'),
 
         # the names to use for this job in the TaskCluster index
         'job-name': Any(
             # Assuming the job is named "normally", this is the v2 job name,
             # and the v1 and buildbot routes will be determined appropriately.
             basestring,
 
             # otherwise, give separate names for each of the legacy index
--- a/taskcluster/taskgraph/try_option_syntax.py
+++ b/taskcluster/taskgraph/try_option_syntax.py
@@ -33,16 +33,17 @@ BUILD_KINDS = set([
     'spidermonkey',
     'b2g-device',
 ])
 
 # anything in this list is governed by -j
 JOB_KINDS = set([
     'source-check',
     'toolchain',
+    'marionette-harness',
 ])
 
 
 # mapping from shortcut name (usable with -u) to a boolean function identifying
 # matching test names
 def alias_prefix(prefix):
     return lambda name: name.startswith(prefix)