aboutsummaryrefslogtreecommitdiffstats
path: root/etc/taskcluster
diff options
context:
space:
mode:
Diffstat (limited to 'etc/taskcluster')
-rw-r--r--etc/taskcluster/decision_task.py9
-rw-r--r--etc/taskcluster/decisionlib.py13
-rw-r--r--etc/taskcluster/docker/base.dockerfile2
-rw-r--r--etc/taskcluster/docker/build.dockerfile3
-rwxr-xr-xetc/taskcluster/mock.py12
5 files changed, 24 insertions, 15 deletions
diff --git a/etc/taskcluster/decision_task.py b/etc/taskcluster/decision_task.py
index dd637859eaa..24aa16ac629 100644
--- a/etc/taskcluster/decision_task.py
+++ b/etc/taskcluster/decision_task.py
@@ -17,6 +17,7 @@ def main(task_for, mock=False):
if mock:
windows_release()
linux_wpt()
+ linux_build_task("Indexed by task definition").find_or_create()
# https://tools.taskcluster.net/hooks/project-servo/daily
elif task_for == "daily":
@@ -24,7 +25,7 @@ def main(task_for, mock=False):
with_rust_nightly()
android_arm32()
- else:
+ else: # pragma: no cover
raise ValueError("Unrecognized $TASK_FOR value: %r", task_for)
@@ -64,8 +65,8 @@ def linux_tidy_unit():
./mach test-unit
./mach package --dev
./mach test-tidy --no-progress --self-test
- python2.7 ./etc/memory_reports_over_time.py --test
- python3 ./etc/taskcluster/mock.py
+ ./etc/memory_reports_over_time.py --test
+ ./etc/taskcluster/mock.py
./etc/ci/lockfile_changed.sh
./etc/ci/check_no_panic.sh
""").create()
@@ -294,5 +295,5 @@ CONFIG.docker_images_expire_in = build_dependencies_artifacts_expire_in
CONFIG.repacked_msi_files_expire_in = build_dependencies_artifacts_expire_in
-if __name__ == "__main__":
+if __name__ == "__main__": # pragma: no cover
main(task_for=os.environ["TASK_FOR"])
diff --git a/etc/taskcluster/decisionlib.py b/etc/taskcluster/decisionlib.py
index 7303a9ba552..bdd5f1aebb8 100644
--- a/etc/taskcluster/decisionlib.py
+++ b/etc/taskcluster/decisionlib.py
@@ -82,8 +82,6 @@ class Shared:
CONFIG = Config()
SHARED = Shared()
-from_now_json = SHARED.from_now_json
-now = SHARED.now
def chaining(op, attr):
@@ -127,7 +125,7 @@ class Task:
with_extra = chaining(update_attr, "extra")
- def build_worker_payload(self):
+ def build_worker_payload(self): # pragma: no cover
raise NotImplementedError
def create(self):
@@ -184,10 +182,9 @@ class Task:
return task_id
try:
- result = SHARED.index_service.findTask(index_path)
- task_id = result["taskId"]
+ task_id = SHARED.index_service.findTask(index_path)["taskId"]
except taskcluster.TaskclusterRestFailure as e:
- if e.status_code != 404:
+ if e.status_code != 404: # pragma: no cover
raise
self.routes.append("index." + index_path)
task_id = self.create()
@@ -208,7 +205,7 @@ class GenericWorkerTask(Task):
with_mounts = chaining(append_to_attr, "mounts")
with_env = chaining(update_attr, "env")
- def build_command(self):
+ def build_command(self): # pragma: no cover
raise NotImplementedError
def build_worker_payload(self):
@@ -263,7 +260,7 @@ class GenericWorkerTask(Task):
raise ValueError(
"%r does not appear to be in one of the supported formats: %r"
% (url_or_artifact_name, ", ".join(supported_formats))
- )
+ ) # pragma: no cover
class WindowsGenericWorkerTask(GenericWorkerTask):
diff --git a/etc/taskcluster/docker/base.dockerfile b/etc/taskcluster/docker/base.dockerfile
index 891469e8df4..0d9385f4054 100644
--- a/etc/taskcluster/docker/base.dockerfile
+++ b/etc/taskcluster/docker/base.dockerfile
@@ -15,7 +15,7 @@ RUN \
ca-certificates \
#
# Running mach
- python2.7 \
+ python \
virtualenv \
#
# Installing rustup and sccache (build dockerfile) or fetching build artifacts (run tasks)
diff --git a/etc/taskcluster/docker/build.dockerfile b/etc/taskcluster/docker/build.dockerfile
index 8b7b3f75f6f..294adb44796 100644
--- a/etc/taskcluster/docker/build.dockerfile
+++ b/etc/taskcluster/docker/build.dockerfile
@@ -3,6 +3,9 @@
RUN \
apt-get install -qy --no-install-recommends \
#
+ # Testing decisionlib (see etc/taskcluster/mock.py)
+ python3-coverage \
+ #
# Multiple C/C++ dependencies built from source
g++ \
make \
diff --git a/etc/taskcluster/mock.py b/etc/taskcluster/mock.py
index 02d55beb1a6..d3e19d88080 100755
--- a/etc/taskcluster/mock.py
+++ b/etc/taskcluster/mock.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python3
+#!/bin/bash
# Copyright 2018 The Servo Project Developers. See the COPYRIGHT
# file at the top-level directory of this distribution.
@@ -9,6 +9,12 @@
# option. This file may not be copied, modified, or distributed
# except according to those terms.
+''''set -e
+python3 -m coverage run $0
+python3 -m coverage report -m --fail-under 100
+exit
+'''
+
"""
Run the decision task with fake Taskcluster APIs, to catch Python errors before pushing.
"""
@@ -29,7 +35,9 @@ class Index:
raise TaskclusterRestFailure
-Queue = stringDate = fromNow = slugId = MagicMock()
+stringDate = str
+slugId = b"id".lower
+Queue = fromNow = MagicMock()
sys.modules["taskcluster"] = sys.modules[__name__]
sys.dont_write_bytecode = True
os.environ.update(**{k: k for k in "TASK_ID TASK_OWNER TASK_SOURCE GIT_URL GIT_SHA".split()})