summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYuval Peress <peress@chromium.org>2021-06-21 22:03:29 -0600
committerCommit Bot <commit-bot@chromium.org>2021-06-22 17:28:53 +0000
commitfd2233665db303a406b5337b0f044b5275379f85 (patch)
tree03547f088872cb5fa151b7923d729a70e647144d
parent17f878e752c9ca275ff29d03e2802ef43c560dc2 (diff)
downloadchrome-ec-fd2233665db303a406b5337b0f044b5275379f85.tar.gz
zmake: block hypothesis health checks for CQ
Allow passing a --cq flag to zmake for running a CQ pass. When done, zmake will remove flaky features such as hypothesis health checks which cause pytests to fail when taking longer than "expected". Note that the health checks ignore the deadline set on each function and will still fail if they deem the test to have run too long. BRANCH=none BUG=b:190229270, b:190957007 TEST=sudo emerge chromeos-base/zephyr-build-tools && \ zmake --cq testall Signed-off-by: Yuval Peress <peress@chromium.org> Change-Id: Iaf9a38e0bbd65f0be9521019a615279d8b5fbb49 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2977586 Reviewed-by: Simon Glass <sjg@chromium.org>
-rwxr-xr-xzephyr/firmware_builder.py2
-rw-r--r--zephyr/zmake/tests/conftest.py8
-rw-r--r--zephyr/zmake/zmake/__main__.py4
-rw-r--r--zephyr/zmake/zmake/zmake.py8
4 files changed, 19 insertions, 3 deletions
diff --git a/zephyr/firmware_builder.py b/zephyr/firmware_builder.py
index b4dd5170f1..ce817f68a7 100755
--- a/zephyr/firmware_builder.py
+++ b/zephyr/firmware_builder.py
@@ -138,7 +138,7 @@ def test(opts):
return subprocess.run(
['zmake', '-D', 'coverage', build_dir], cwd=platform_ec).returncode
- return subprocess.run(['zmake', '-D', 'testall']).returncode
+ return subprocess.run(['zmake', '-D', '--cq', 'testall']).returncode
def main(args):
diff --git a/zephyr/zmake/tests/conftest.py b/zephyr/zmake/tests/conftest.py
new file mode 100644
index 0000000000..ad1c6aedfc
--- /dev/null
+++ b/zephyr/zmake/tests/conftest.py
@@ -0,0 +1,8 @@
+# Copyright 2021 The Chromium OS Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+import hypothesis
+
+hypothesis.settings.register_profile('cq',
+ suppress_health_check=hypothesis.HealthCheck.all())
diff --git a/zephyr/zmake/zmake/__main__.py b/zephyr/zmake/zmake/__main__.py
index b0ec24a1db..942fb1ea0d 100644
--- a/zephyr/zmake/zmake/__main__.py
+++ b/zephyr/zmake/zmake/__main__.py
@@ -77,6 +77,10 @@ def main(argv=None):
'checkout.')
parser.add_argument('--zephyr-base', type=pathlib.Path,
help='Path to Zephyr OS repository')
+ parser.add_argument('--cq', action='store_true',
+ default=False,
+ help='Run this pass from CQ (turns off some flaky '
+ 'features)')
sub = parser.add_subparsers(dest='subcommand', help='Subcommand')
sub.required = True
diff --git a/zephyr/zmake/zmake/zmake.py b/zephyr/zmake/zmake/zmake.py
index 17c460c6b5..2415c76d9f 100644
--- a/zephyr/zmake/zmake/zmake.py
+++ b/zephyr/zmake/zmake/zmake.py
@@ -139,10 +139,11 @@ class Zmake:
before launching more, False to just do this after all jobs complete
"""
def __init__(self, checkout=None, jobserver=None, jobs=0, modules_dir=None,
- zephyr_base=None):
+ zephyr_base=None, cq=False):
zmake.multiproc.reset()
self._checkout = checkout
self._zephyr_base = zephyr_base
+ self._is_cq = cq
if modules_dir:
self.module_paths = zmake.modules.locate_from_directory(modules_dir)
@@ -446,8 +447,11 @@ class Zmake:
def run_test(test_file):
with self.jobserver.get_job():
+ proc_args = ['pytest', '--verbose']
+ if self._is_cq:
+ proc_args.append('--hypothesis-profile=cq')
proc = self.jobserver.popen(
- ['pytest', '--verbose', test_file],
+ proc_args + [test_file],
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT,
encoding='utf-8',