mirror of
https://github.com/servo/servo.git
synced 2025-06-06 16:45:39 +00:00
Code coverage for decisionlib
This commit is contained in:
parent
62e4f7072b
commit
09d8339b46
7 changed files with 25 additions and 15 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -19,6 +19,7 @@
|
|||
*.csv
|
||||
*.rej
|
||||
*.orig
|
||||
.coverage
|
||||
.DS_Store
|
||||
Servo.app
|
||||
.config.mk.last
|
||||
|
|
0
etc/memory_reports_over_time.py
Normal file → Executable file
0
etc/memory_reports_over_time.py
Normal file → Executable file
|
@ -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"])
|
||||
|
|
|
@ -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):
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -2,6 +2,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++ \
|
||||
|
|
|
@ -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()})
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue