mirror of
https://github.com/servo/servo.git
synced 2025-07-23 15:23:42 +01: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
|
*.csv
|
||||||
*.rej
|
*.rej
|
||||||
*.orig
|
*.orig
|
||||||
|
.coverage
|
||||||
.DS_Store
|
.DS_Store
|
||||||
Servo.app
|
Servo.app
|
||||||
.config.mk.last
|
.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:
|
if mock:
|
||||||
windows_release()
|
windows_release()
|
||||||
linux_wpt()
|
linux_wpt()
|
||||||
|
linux_build_task("Indexed by task definition").find_or_create()
|
||||||
|
|
||||||
# https://tools.taskcluster.net/hooks/project-servo/daily
|
# https://tools.taskcluster.net/hooks/project-servo/daily
|
||||||
elif task_for == "daily":
|
elif task_for == "daily":
|
||||||
|
@ -24,7 +25,7 @@ def main(task_for, mock=False):
|
||||||
with_rust_nightly()
|
with_rust_nightly()
|
||||||
android_arm32()
|
android_arm32()
|
||||||
|
|
||||||
else:
|
else: # pragma: no cover
|
||||||
raise ValueError("Unrecognized $TASK_FOR value: %r", task_for)
|
raise ValueError("Unrecognized $TASK_FOR value: %r", task_for)
|
||||||
|
|
||||||
|
|
||||||
|
@ -64,8 +65,8 @@ def linux_tidy_unit():
|
||||||
./mach test-unit
|
./mach test-unit
|
||||||
./mach package --dev
|
./mach package --dev
|
||||||
./mach test-tidy --no-progress --self-test
|
./mach test-tidy --no-progress --self-test
|
||||||
python2.7 ./etc/memory_reports_over_time.py --test
|
./etc/memory_reports_over_time.py --test
|
||||||
python3 ./etc/taskcluster/mock.py
|
./etc/taskcluster/mock.py
|
||||||
./etc/ci/lockfile_changed.sh
|
./etc/ci/lockfile_changed.sh
|
||||||
./etc/ci/check_no_panic.sh
|
./etc/ci/check_no_panic.sh
|
||||||
""").create()
|
""").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
|
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"])
|
main(task_for=os.environ["TASK_FOR"])
|
||||||
|
|
|
@ -82,8 +82,6 @@ class Shared:
|
||||||
|
|
||||||
CONFIG = Config()
|
CONFIG = Config()
|
||||||
SHARED = Shared()
|
SHARED = Shared()
|
||||||
from_now_json = SHARED.from_now_json
|
|
||||||
now = SHARED.now
|
|
||||||
|
|
||||||
|
|
||||||
def chaining(op, attr):
|
def chaining(op, attr):
|
||||||
|
@ -127,7 +125,7 @@ class Task:
|
||||||
|
|
||||||
with_extra = chaining(update_attr, "extra")
|
with_extra = chaining(update_attr, "extra")
|
||||||
|
|
||||||
def build_worker_payload(self):
|
def build_worker_payload(self): # pragma: no cover
|
||||||
raise NotImplementedError
|
raise NotImplementedError
|
||||||
|
|
||||||
def create(self):
|
def create(self):
|
||||||
|
@ -184,10 +182,9 @@ class Task:
|
||||||
return task_id
|
return task_id
|
||||||
|
|
||||||
try:
|
try:
|
||||||
result = SHARED.index_service.findTask(index_path)
|
task_id = SHARED.index_service.findTask(index_path)["taskId"]
|
||||||
task_id = result["taskId"]
|
|
||||||
except taskcluster.TaskclusterRestFailure as e:
|
except taskcluster.TaskclusterRestFailure as e:
|
||||||
if e.status_code != 404:
|
if e.status_code != 404: # pragma: no cover
|
||||||
raise
|
raise
|
||||||
self.routes.append("index." + index_path)
|
self.routes.append("index." + index_path)
|
||||||
task_id = self.create()
|
task_id = self.create()
|
||||||
|
@ -208,7 +205,7 @@ class GenericWorkerTask(Task):
|
||||||
with_mounts = chaining(append_to_attr, "mounts")
|
with_mounts = chaining(append_to_attr, "mounts")
|
||||||
with_env = chaining(update_attr, "env")
|
with_env = chaining(update_attr, "env")
|
||||||
|
|
||||||
def build_command(self):
|
def build_command(self): # pragma: no cover
|
||||||
raise NotImplementedError
|
raise NotImplementedError
|
||||||
|
|
||||||
def build_worker_payload(self):
|
def build_worker_payload(self):
|
||||||
|
@ -263,7 +260,7 @@ class GenericWorkerTask(Task):
|
||||||
raise ValueError(
|
raise ValueError(
|
||||||
"%r does not appear to be in one of the supported formats: %r"
|
"%r does not appear to be in one of the supported formats: %r"
|
||||||
% (url_or_artifact_name, ", ".join(supported_formats))
|
% (url_or_artifact_name, ", ".join(supported_formats))
|
||||||
)
|
) # pragma: no cover
|
||||||
|
|
||||||
|
|
||||||
class WindowsGenericWorkerTask(GenericWorkerTask):
|
class WindowsGenericWorkerTask(GenericWorkerTask):
|
||||||
|
|
|
@ -15,7 +15,7 @@ RUN \
|
||||||
ca-certificates \
|
ca-certificates \
|
||||||
#
|
#
|
||||||
# Running mach
|
# Running mach
|
||||||
python2.7 \
|
python \
|
||||||
virtualenv \
|
virtualenv \
|
||||||
#
|
#
|
||||||
# Installing rustup and sccache (build dockerfile) or fetching build artifacts (run tasks)
|
# Installing rustup and sccache (build dockerfile) or fetching build artifacts (run tasks)
|
||||||
|
|
|
@ -2,6 +2,9 @@
|
||||||
|
|
||||||
RUN \
|
RUN \
|
||||||
apt-get install -qy --no-install-recommends \
|
apt-get install -qy --no-install-recommends \
|
||||||
|
#
|
||||||
|
# Testing decisionlib (see etc/taskcluster/mock.py)
|
||||||
|
python3-coverage \
|
||||||
#
|
#
|
||||||
# Multiple C/C++ dependencies built from source
|
# Multiple C/C++ dependencies built from source
|
||||||
g++ \
|
g++ \
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#!/usr/bin/python3
|
#!/bin/bash
|
||||||
|
|
||||||
# Copyright 2018 The Servo Project Developers. See the COPYRIGHT
|
# Copyright 2018 The Servo Project Developers. See the COPYRIGHT
|
||||||
# file at the top-level directory of this distribution.
|
# file at the top-level directory of this distribution.
|
||||||
|
@ -9,6 +9,12 @@
|
||||||
# option. This file may not be copied, modified, or distributed
|
# option. This file may not be copied, modified, or distributed
|
||||||
# except according to those terms.
|
# 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.
|
Run the decision task with fake Taskcluster APIs, to catch Python errors before pushing.
|
||||||
"""
|
"""
|
||||||
|
@ -29,7 +35,9 @@ class Index:
|
||||||
raise TaskclusterRestFailure
|
raise TaskclusterRestFailure
|
||||||
|
|
||||||
|
|
||||||
Queue = stringDate = fromNow = slugId = MagicMock()
|
stringDate = str
|
||||||
|
slugId = b"id".lower
|
||||||
|
Queue = fromNow = MagicMock()
|
||||||
sys.modules["taskcluster"] = sys.modules[__name__]
|
sys.modules["taskcluster"] = sys.modules[__name__]
|
||||||
sys.dont_write_bytecode = True
|
sys.dont_write_bytecode = True
|
||||||
os.environ.update(**{k: k for k in "TASK_ID TASK_OWNER TASK_SOURCE GIT_URL GIT_SHA".split()})
|
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