summaryrefslogtreecommitdiff
path: root/zephyr/zmake/tests/test_util.py
diff options
context:
space:
mode:
authorJack Rosenthal <jrosenth@chromium.org>2021-10-29 17:52:48 -0600
committerCommit Bot <commit-bot@chromium.org>2021-11-01 23:02:53 +0000
commit5ff00345b91a38a0288b13ac3574a890b4e557e7 (patch)
tree126659c3d3928796e430a9617184463fea31a0d4 /zephyr/zmake/tests/test_util.py
parenta9fe8ed20bce856ded8f251b19c9a0c238b490b1 (diff)
downloadchrome-ec-5ff00345b91a38a0288b13ac3574a890b4e557e7.tar.gz
zephyr: zmake: Upgrade to new BUILD.py format
go/zephyr-variants defines a BUILD.py format that replaces zmake.yaml. BUILD.py is inspired by Bazel build definitions, allowing for arbitrary Python code to be used as the config format. This enables defining multiple projects in a single directory, and projects to make program-specific customizations to the config definition functions. The other following changes are of note: - Projects can still be referenced by directory name, but can be referenced by the much shorter project name. For example, both of the following work equivalently: $ zmake configure -b zephyr/projects/volteer/delbin $ zmake configure -b delbin - The default build directory was changed to: build/zephyr/${name} This implements the new format, drops the old YAML+jsonschema, and migrates all our projects to the new format. BUG=b:193815337 BRANCH=none TEST=unit tests TEST=zmake testall Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Change-Id: Ib1e53d9abf558063117cc3f86a5d636e69cf77fe Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3253969 Reviewed-by: Jeremy Bettis <jbettis@chromium.org> Reviewed-by: Keith Short <keithshort@chromium.org>
Diffstat (limited to 'zephyr/zmake/tests/test_util.py')
-rw-r--r--zephyr/zmake/tests/test_util.py52
1 files changed, 0 insertions, 52 deletions
diff --git a/zephyr/zmake/tests/test_util.py b/zephyr/zmake/tests/test_util.py
index 0c4cd4dda5..438c5efcf0 100644
--- a/zephyr/zmake/tests/test_util.py
+++ b/zephyr/zmake/tests/test_util.py
@@ -3,7 +3,6 @@
# found in the LICENSE file.
import pathlib
-import re
import tempfile
import hypothesis
@@ -13,57 +12,6 @@ import pytest
import zmake.util as util
# Strategies for use with hypothesis
-relative_path = st.from_regex(
- regex=re.compile(r"\A\w{1,255}(/\w{1,255}){0,15}\Z", re.ASCII)
-)
-
-
-@hypothesis.given(relative_path, relative_path, relative_path)
-@hypothesis.settings(deadline=60000)
-def test_resolve_build_dir_with_build_dir(
- platform_ec_subdir, project_subdir, build_subdir
-):
- with tempfile.TemporaryDirectory() as temp_dir_name:
- platform_ec_dir = pathlib.Path(temp_dir_name) / platform_ec_subdir
- build_dir = util.resolve_build_dir(
- platform_ec_dir=platform_ec_dir,
- project_dir=platform_ec_dir / project_subdir,
- build_dir=platform_ec_dir / build_subdir,
- )
-
- assert build_dir == platform_ec_dir / build_subdir
-
-
-@hypothesis.given(relative_path, relative_path)
-@hypothesis.settings(deadline=60000)
-def test_resolve_build_dir_invalid_project(platform_ec_subdir, project_subdir):
- try:
- with tempfile.TemporaryDirectory() as temp_dir_name:
- platform_ec_dir = pathlib.Path(temp_dir_name) / platform_ec_subdir
- util.resolve_build_dir(
- platform_ec_dir=platform_ec_dir,
- project_dir=platform_ec_dir / project_subdir,
- build_dir=None,
- )
- pytest.fail()
- except Exception:
- pass
-
-
-@hypothesis.given(relative_path, relative_path)
-@hypothesis.settings(deadline=60000)
-def test_resolve_build_dir_from_project(platform_ec_subdir, project_subdir):
- with tempfile.TemporaryDirectory() as temp_dir_name:
- platform_ec_dir = pathlib.Path(temp_dir_name) / platform_ec_subdir
- project_dir = platform_ec_dir / project_subdir
- project_dir.mkdir(parents=True)
- (project_dir / "zmake.yaml").touch()
- build_dir = util.resolve_build_dir(
- platform_ec_dir=platform_ec_dir, project_dir=project_dir, build_dir=None
- )
- assert build_dir == platform_ec_dir / "build" / project_subdir
-
-
version_integers = st.integers(min_value=0)
version_tuples = st.tuples(version_integers, version_integers, version_integers)