External inports should also be considered as measurable variables
Change-Id: I138e87920189c121e59e5dbdc5caf08f9063fe0a
This commit is contained in:
parent
b42d107422
commit
01534e022f
212
NOTICE
212
NOTICE
@ -20,8 +20,9 @@ GitPython 3.1.44: https://github.com/gitpython-developers/GitPython : BSD 3-clau
|
||||
idna 3.10: https://github.com/kjd/idna : BSD 3-clause "New" or "Revised" License
|
||||
mccabe 0.7.0: http://pypi.python.org/pypi/mccabe : Expat License
|
||||
NumPy 1.24.4: https://numpy.org/ : BSD 3-clause "New" or "Revised" License
|
||||
Packaging 24.2: https://github.com/pypa/packaging : (BSD 2-clause "Simplified" License OR Apache License 2.0)
|
||||
Packaging 25.0: https://github.com/pypa/packaging : (Apache License 2.0 AND BSD 3-clause "New" or "Revised" License)
|
||||
pbr 6.1.1: http://openstack.org : Apache License 2.0
|
||||
powertrain-build 1.5.0: https://opendev.org/volvocars/powertrain-build : Apache License 2.0
|
||||
psf-requests 2.32.3: http://docs.python-requests.org : Apache License 2.0
|
||||
pycodestyle 2.13.0: https://pypi.python.org/pypi/pycodestyle : MIT License
|
||||
Pyflakes 3.3.2: https://github.com/pyflakes/pyflakes : MIT License
|
||||
@ -36,20 +37,84 @@ ruamel.yaml.clib 0.2.12: https://sourceforge.net/p/ruamel-yaml-clib/code/ci/defa
|
||||
SciPy 1.9.1: http://www.scipy.org : BSD 3-clause "New" or "Revised" License
|
||||
smmap 5.0.2: https://github.com/gitpython-developers/smmap : BSD 3-clause "New" or "Revised" License
|
||||
tomli 2.2.1: https://github.com/hukkin/tomli : MIT License
|
||||
urllib3 2.3.0: https://urllib3.readthedocs.io/en/stable : MIT License
|
||||
urllib3 2.4.0: https://urllib3.readthedocs.io/en/stable : MIT License
|
||||
voluptuous 0.15.2: http://pypi.python.org/pypi/voluptuous : BSD 3-clause "New" or "Revised" License
|
||||
|
||||
Copyright Text:
|
||||
|
||||
Coverage 7.8.0 pypi:coverage/7.8.0: http://nedbatchelder.com/code/modules/coverage.html
|
||||
No Copyrights found
|
||||
(c)
|
||||
else:
|
||||
c.post_fork()
|
||||
self._collectors[:] = keep_collectors
|
||||
|
||||
if self._collectors:
|
||||
|
||||
(c)
|
||||
yield code
|
||||
|
||||
|
||||
(c)
|
||||
else:
|
||||
c.post_fork()
|
||||
self._collectors[:] = keep_collectors
|
||||
|
||||
if self._collectors:
|
||||
|
||||
(c)
|
||||
yield code
|
||||
|
||||
|
||||
(c) for c in re.split(r"(\d
|
||||
|
||||
def human_sorted(strings: Iterable[str]) -> list[str]:
|
||||
|
||||
(c) for c in re.split(r"(\d
|
||||
|
||||
def human_sorted(strings: Iterable[str]) -> list[str]:
|
||||
|
||||
(c) for c in self.code)
|
||||
|
||||
def add_line(self, line: str) -> None:
|
||||
|
||||
(c) for c in self.code)
|
||||
|
||||
def add_line(self, line: str) -> None:
|
||||
|
||||
(c) for c in text
|
||||
print(u"All OK with {encoding}")
|
||||
encoding = "{encoding}"
|
||||
""",
|
||||
|
||||
(c) for c in text
|
||||
source_text = source.format(encoding=encoding, text=text, ords=ords)
|
||||
zf.writestr(filename, source_text.encode(encoding))
|
||||
|
||||
with zipfile.ZipFile("tests/zip1.zip", "w") as zf:
|
||||
|
||||
(c)?c:a(c)):null
|
||||
Copyright 2001 Gareth Rees. All rights reserved.
|
||||
|
||||
Copyright 2004-
|
||||
)
|
||||
|
||||
Copyright 2004-2025 Ned Batchelder. All rights reserved.
|
||||
|
||||
Copyright 2004.
|
||||
Copyright Software Freedom Conservancy, Inc.
|
||||
|
||||
©<>*<2A><>{ǰ(<28><><EFBFBD>2
|
||||
|
||||
exceptiongroup 1.2.2 pypi:exceptiongroup/1.2.2: https://github.com/python-trio/exceptiongroup
|
||||
Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
|
||||
|
||||
Copyright (c) 2022 Alex Gr
|
||||
|
||||
flake8 7.2.0 pypi:flake8/7.2.0: https://gitlab.com/pycqa/flake8
|
||||
No Copyrights found
|
||||
Copyright (C) 2011-2013 Tarek Ziade <tarek@ziade.org>
|
||||
|
||||
Copyright (C) 2012-2016 Ian Cordasco <graffatcolmingov@gmail.com>
|
||||
|
||||
gitdb 4.0.12 pypi:gitdb/4.0.12: http://github.com/gitpython-developers/gitdb
|
||||
(c)
|
||||
# end handle interpreter
|
||||
@ -2575,28 +2640,8 @@ modification, are permitted provided that the following conditions are met:
|
||||
|
||||
$HEADER$
|
||||
|
||||
Packaging 24.2 pypi:packaging/24.2: https://github.com/pypa/packaging
|
||||
Copyright (c) 2017-present Ofek Lev <oss@ofek.dev>
|
||||
|
||||
Copyright (c) Donald Stufft and individual contributors.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice,
|
||||
this list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
|
||||
copyright = ABOUT
|
||||
|
||||
# -- Options for HTML output --------------------------------------------------
|
||||
# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output
|
||||
|
||||
Packaging 25.0 pypi:packaging/25.0: https://github.com/pypa/packaging
|
||||
No Copyrights found
|
||||
pbr 6.1.1 pypi:pbr/6.1.1: http://openstack.org
|
||||
Copyright (C) 2005 Association of Universities for Research in Astronomy (AURA)
|
||||
|
||||
@ -2667,6 +2712,8 @@ add_function_parentheses = True
|
||||
# If true, '()' will be appended to :func: etc. cross-reference text.
|
||||
add_function_parentheses = True
|
||||
|
||||
powertrain-build 1.5.0 pypi:powertrain-build/1.5.0: https://opendev.org/volvocars/powertrain-build
|
||||
No Copyrights found
|
||||
psf-requests 2.32.3 pypi:requests/2.32.3: http://docs.python-requests.org
|
||||
(c)
|
||||
return c
|
||||
@ -2682,9 +2729,28 @@ psf-requests 2.32.3 pypi:requests/2.32.3: http://docs.python-requests.org
|
||||
copyright: (c) 2017 by Kenneth Reitz.
|
||||
|
||||
pycodestyle 2.13.0 pypi:pycodestyle/2.13.0: https://pypi.python.org/pypi/pycodestyle
|
||||
No Copyrights found
|
||||
Copyright (C) 2006-2009 Johann C. Rocholl <johann@rocholl.net>
|
||||
|
||||
Copyright (C) 2009-2014 Florent Xicluna <florent.xicluna@gmail.com>
|
||||
|
||||
Copyright (C) 2014-2016 Ian Lee <ianlee1521@gmail.com>
|
||||
|
||||
Copyright © 2006-2009 Johann C. Rocholl <johann@rocholl.net>
|
||||
|
||||
Copyright © 2009-2014 Florent Xicluna <florent.xicluna@gmail.com>
|
||||
|
||||
Copyright © 2014-2020 Ian Lee <IanLee1521@gmail.com>
|
||||
|
||||
Pyflakes 3.3.2 pypi:pyflakes/3.3.2: https://github.com/pyflakes/pyflakes
|
||||
No Copyrights found
|
||||
Copyright 2005-2011 Divmod, Inc.
|
||||
|
||||
Copyright 2013 Florent Xicluna. See LICENSE file for details
|
||||
import os.path
|
||||
|
||||
try:
|
||||
|
||||
Copyright 2013-2014 Florent Xicluna
|
||||
|
||||
pypi/setuptools 59.6.0 pypi:setuptools/59.6.0: https://pypi.org/project/setuptools/
|
||||
(c) *output
|
||||
}
|
||||
@ -2746,7 +2812,38 @@ pypi/setuptools 59.6.0 pypi:setuptools/59.6.0: https://pypi.org/project/setuptoo
|
||||
Copyright Jason R. Coombs
|
||||
|
||||
pytest 8.3.5 pypi:pytest/8.3.5: http://pytest.org
|
||||
No Copyrights found
|
||||
(c)
|
||||
|
||||
# ASCII fast path.
|
||||
if 0x20 <= o < 0x07F:
|
||||
|
||||
(c)
|
||||
|
||||
# Control characters.
|
||||
if category == "Cc":
|
||||
|
||||
(C)
|
||||
|
||||
assert all_marks ==
|
||||
|
||||
assert get_unpacked_marks(C, consider_mro=False) == [xfail("c").mark]
|
||||
|
||||
(c)
|
||||
if wc < 0:
|
||||
return -1
|
||||
width += wc
|
||||
|
||||
(c) in ("F", "W"):
|
||||
return 2
|
||||
|
||||
return 1
|
||||
|
||||
Copyright (c) 2004 Holger Krekel and others
|
||||
|
||||
Copyright (c) 2014, Gregory Boissinot
|
||||
|
||||
Copyright Holger Krekel and others, 2004.
|
||||
|
||||
python3-charset-normalizer 3.4.1 pypi:charset-normalizer/3.4.1: https://github.com/ousret/charset_normalizer
|
||||
(c) https://stackoverflow.com/questions/3041986/apt-command-line-interface-like-yes-no-input
|
||||
"""
|
||||
@ -2788,7 +2885,25 @@ python-pluggy 1.5.0 pypi:pluggy/1.5.0: https://pypi.python.org/pypi/pluggy
|
||||
Copyright (c) 2015 holger krekel (rather uses bitbucket/hpk42)
|
||||
|
||||
RonnyPfannschmidt/iniconfig 2.1.0 pypi:iniconfig/2.1.0: https://github.com/RonnyPfannschmidt/iniconfig
|
||||
No Copyrights found
|
||||
(C) Ronny Pfannschmidt, Holger Krekel -- MIT licensed
|
||||
"""
|
||||
from __future__ import annotations
|
||||
from typing import (
|
||||
Callable,
|
||||
Iterator,
|
||||
Mapping,
|
||||
Optional,
|
||||
Tuple,
|
||||
TypeVar,
|
||||
Union,
|
||||
TYPE_CHECKING,
|
||||
NoReturn,
|
||||
NamedTuple,
|
||||
overload,
|
||||
cast,
|
||||
|
||||
Copyright (c) 2010 - 2023 Holger Krekel and others
|
||||
|
||||
ruamel-yaml 0.18.6 pypi:ruamel.yaml/0.18.6: https://pypi.org/project/ruamel.yaml/
|
||||
No Copyrights found
|
||||
ruamel.yaml.clib 0.2.12 pypi:ruamel.yaml.clib/0.2.12: https://sourceforge.net/p/ruamel-yaml-clib/code/ci/default/tree/
|
||||
@ -13603,7 +13718,7 @@ tomli 2.2.1 pypi:tomli/2.2.1: https://github.com/hukkin/tomli
|
||||
|
||||
Copyright (c) 2021 Taneli Hukkinen
|
||||
|
||||
urllib3 2.3.0 pypi:urllib3/2.3.0: https://urllib3.readthedocs.io/en/stable
|
||||
urllib3 2.4.0 pypi:urllib3/2.4.0: https://urllib3.readthedocs.io/en/stable
|
||||
Copyright (c) 2008-2020 Andrey Petrov and contributors.
|
||||
|
||||
copyright = f"
|
||||
@ -13634,7 +13749,7 @@ modification, are permitted provided that the following conditions are met:
|
||||
Licenses:
|
||||
|
||||
Apache License 2.0
|
||||
(Coverage 7.8.0, Packaging 24.2, pbr 6.1.1, psf-requests 2.32.3)
|
||||
(Coverage 7.8.0, Packaging 25.0, pbr 6.1.1, powertrain-build 1.5.0, psf-requests 2.32.3)
|
||||
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
@ -13820,37 +13935,8 @@ third-party archives.
|
||||
|
||||
---
|
||||
|
||||
BSD 2-clause "Simplified" License
|
||||
(Packaging 24.2)
|
||||
|
||||
BSD Two Clause License
|
||||
======================
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice, this
|
||||
list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED
|
||||
WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
|
||||
SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||
OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
|
||||
DAMAGE.
|
||||
|
||||
---
|
||||
|
||||
BSD 3-clause "New" or "Revised" License
|
||||
(gitdb 4.0.12, GitPython 3.1.44, idna 3.10, NumPy 1.24.4, SciPy 1.9.1, smmap 5.0.2, voluptuous 0.15.2)
|
||||
(gitdb 4.0.12, GitPython 3.1.44, idna 3.10, NumPy 1.24.4, Packaging 25.0, SciPy 1.9.1, smmap 5.0.2, voluptuous 0.15.2)
|
||||
|
||||
Copyright (c) <YEAR>, <OWNER>
|
||||
All rights reserved.
|
||||
@ -13938,7 +14024,7 @@ IN THE SOFTWARE
|
||||
---
|
||||
|
||||
MIT License
|
||||
(exceptiongroup 1.2.2, flake8 7.2.0, pycodestyle 2.13.0, Pyflakes 3.3.2, pytest 8.3.5, python-pluggy 1.5.0, python3-charset-normalizer 3.4.1, RonnyPfannschmidt/iniconfig 2.1.0, ruamel-yaml 0.18.6, ruamel.yaml.clib 0.2.12, tomli 2.2.1, urllib3 2.3.0)
|
||||
(exceptiongroup 1.2.2, flake8 7.2.0, pycodestyle 2.13.0, Pyflakes 3.3.2, pytest 8.3.5, python-pluggy 1.5.0, python3-charset-normalizer 3.4.1, RonnyPfannschmidt/iniconfig 2.1.0, ruamel-yaml 0.18.6, ruamel.yaml.clib 0.2.12, tomli 2.2.1, urllib3 2.4.0)
|
||||
|
||||
The MIT License
|
||||
===============
|
||||
|
@ -917,8 +917,9 @@ def build(
|
||||
axis_data = merged_a2l.get_characteristic_axis_data()
|
||||
composition_yaml = CompositionYaml(
|
||||
build_cfg,
|
||||
signal_if.composition_spec,
|
||||
unit_cfg, zc_core,
|
||||
signal_if,
|
||||
unit_cfg,
|
||||
zc_core,
|
||||
zc_dids,
|
||||
zc_nvm,
|
||||
axis_data,
|
||||
|
@ -15,12 +15,12 @@ from powertrain_build.zone_controller.calibration import ZoneControllerCalibrati
|
||||
class CompositionYaml(ProblemLogger):
|
||||
"""Class for handling ZoneController composition yaml generation."""
|
||||
|
||||
def __init__(self, build_cfg, composition_spec, unit_cfg, zc_core, zc_dids, zc_nvm, a2l_axis_data, enums):
|
||||
def __init__(self, build_cfg, signal_if, unit_cfg, zc_core, zc_dids, zc_nvm, a2l_axis_data, enums):
|
||||
"""Init.
|
||||
|
||||
Args:
|
||||
build_cfg (BuildProjConfig): Object with build configuration settings.
|
||||
composition_spec (dict): Dict with port interface information.
|
||||
signal_if (SignalInterfaces): Class holding signal interface information.
|
||||
unit_cfg (UnitConfig): Object with unit configurations.
|
||||
zc_core (ZCCore): Object with zone controller diagnositic event information.
|
||||
zc_dids (ZCDIDs): Object with zone controller diagnostic DID information.
|
||||
@ -40,7 +40,8 @@ class CompositionYaml(ProblemLogger):
|
||||
}
|
||||
self.build_cfg = build_cfg
|
||||
self.unit_src_dirs = build_cfg.get_unit_src_dirs()
|
||||
self.composition_spec = composition_spec
|
||||
self.composition_spec = signal_if.composition_spec
|
||||
self.external_io = signal_if.get_external_io()
|
||||
self.unit_cfg = unit_cfg
|
||||
self.zc_core = zc_core
|
||||
self.zc_dids = zc_dids
|
||||
@ -561,6 +562,12 @@ class CompositionYaml(ProblemLogger):
|
||||
calibration_variables[signal_name] = info
|
||||
elif "CVC_DISP" in info["class"]:
|
||||
measurable_variables[signal_name] = info
|
||||
# External inports should also be considered as measurable variables
|
||||
for io_type in self.external_io:
|
||||
for signal_name in io_type.get("input", {}).keys():
|
||||
for signal_data in config["inports"][signal_name].values():
|
||||
measurable_variables[signal_name] = signal_data
|
||||
continue # Inports can appear in several units, pick first one
|
||||
return calibration_variables, measurable_variables
|
||||
|
||||
def _get_class_info(self, variable_dict):
|
||||
@ -620,7 +627,7 @@ class CompositionYaml(ProblemLogger):
|
||||
if not isinstance(info["width"], list):
|
||||
class_info[signal_name] = {
|
||||
"type": info["type"],
|
||||
"access": "READ-ONLY" if "CVC_DISP" in info["class"] else "READ-WRITE",
|
||||
"access": "READ-ONLY" if "CVC_DISP" in info["class"] or info["class"] == "CVC_EXT" else "READ-WRITE",
|
||||
"init": self.calibration_init_values.get(signal_name, max(min(0, upper), lower)),
|
||||
}
|
||||
return class_info, data_types
|
||||
|
@ -402,10 +402,69 @@ get_per_cfg_unit_cfg_return_value = {
|
||||
}
|
||||
}
|
||||
},
|
||||
"inports": {}
|
||||
"inports": {
|
||||
"yVcGpaDemo_B_InputOne": {
|
||||
"VcGpaDemo": {
|
||||
"name": "yVcGpaDemo_B_InputOne",
|
||||
"type": "Bool",
|
||||
"class": "CVC_EXT",
|
||||
"min": "-",
|
||||
"max": "-",
|
||||
"lsb": 1,
|
||||
"offset": 0,
|
||||
"width": 1
|
||||
}
|
||||
},
|
||||
"yVcGpaDemo_B_InputTwo": {
|
||||
"VcGpaDemo": {
|
||||
"name": "yVcGpaDemo_B_InputTwo",
|
||||
"type": "Bool",
|
||||
"class": "CVC_EXT",
|
||||
"min": "-",
|
||||
"max": "-",
|
||||
"lsb": 1,
|
||||
"offset": 0,
|
||||
"width": 1
|
||||
}
|
||||
},
|
||||
"yVcGpaDemo_B_InputThree": {
|
||||
"VcGpaDemo": {
|
||||
"name": "yVcGpaDemo_B_InputThree",
|
||||
"type": "Bool",
|
||||
"class": "CVC_EXT",
|
||||
"min": "-",
|
||||
"max": "-",
|
||||
"lsb": 1,
|
||||
"offset": 0,
|
||||
"width": 1
|
||||
}
|
||||
},
|
||||
"yVcGpaDemo_B_InputFour": {
|
||||
"VcGpaDemo": {
|
||||
"name": "yVcGpaDemo_B_InputFour",
|
||||
"type": "Bool",
|
||||
"class": "CVC_EXT",
|
||||
"min": "-",
|
||||
"max": "-",
|
||||
"lsb": 1,
|
||||
"offset": 0,
|
||||
"width": 1
|
||||
},
|
||||
"VcGpaDemoTwo": {
|
||||
"name": "yVcGpaDemo_B_InputFour",
|
||||
"type": "Bool",
|
||||
"class": "CVC_EXT",
|
||||
"min": "-",
|
||||
"max": "-",
|
||||
"lsb": 1,
|
||||
"offset": 0,
|
||||
"width": 1
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
zc_spec = {
|
||||
composition_spec = {
|
||||
"io": {
|
||||
"DUMMY1": {
|
||||
"DUMMY1": {
|
||||
|
@ -0,0 +1,125 @@
|
||||
# Copyright 2024 Volvo Car Corporation
|
||||
# Licensed under Apache 2.0.
|
||||
|
||||
"""Unit test data for powertrain_build.zone_controller.composition_yaml."""
|
||||
|
||||
from test_data.zone_controller.test_composition_yaml import composition_yaml_setup
|
||||
|
||||
external_io = (
|
||||
{
|
||||
"input": {
|
||||
"yVcGpaDemo_B_InputOne": {"dummy": "dummy"}
|
||||
},
|
||||
"output": {
|
||||
"yVcGpaDemo_B_OutputOne": {"dummy": "dummy"}
|
||||
},
|
||||
"status": {
|
||||
"yVcGpaDemo_B_StatusOne": {"dummy": "dummy"}
|
||||
},
|
||||
},
|
||||
{
|
||||
"input": {
|
||||
"yVcGpaDemo_B_InputTwo": {"dummy": "dummy"}
|
||||
},
|
||||
"output": {
|
||||
"yVcGpaDemo_B_OutputTwo": {"dummy": "dummy"}
|
||||
},
|
||||
"status": {
|
||||
"yVcGpaDemo_B_StatusTwo": {"dummy": "dummy"}
|
||||
},
|
||||
},
|
||||
{
|
||||
"input": {
|
||||
"yVcGpaDemo_B_InputThree": {"dummy": "dummy"}
|
||||
},
|
||||
"output": {
|
||||
"yVcGpaDemo_B_OutputThree": {"dummy": "dummy"}
|
||||
},
|
||||
"status": {
|
||||
"yVcGpaDemo_B_StatusThree": {"dummy": "dummy"}
|
||||
},
|
||||
},
|
||||
{
|
||||
"input": {
|
||||
"yVcGpaDemo_B_InputFour": {"dummy": "dummy"}
|
||||
},
|
||||
"output": {
|
||||
"yVcGpaDemo_B_OutputFour": {"dummy": "dummy"}
|
||||
},
|
||||
"status": {
|
||||
"yVcGpaDemo_B_StatusFour": {"dummy": "dummy"}
|
||||
},
|
||||
},
|
||||
)
|
||||
|
||||
expected_result = {
|
||||
"SoftwareComponents": {
|
||||
"testName_SC": {
|
||||
"type": "SWC",
|
||||
"template": "ARTCSC",
|
||||
"asil": "QM",
|
||||
"secure": False,
|
||||
"runnables": {
|
||||
"AR_prefix_VcExtINI": {
|
||||
"type": "INIT",
|
||||
"accesses": composition_yaml_setup.base_accesses
|
||||
},
|
||||
"AR_prefix_testRunnable": {
|
||||
"period": 10,
|
||||
"type": "PERIODIC",
|
||||
"accesses": composition_yaml_setup.base_accesses
|
||||
},
|
||||
},
|
||||
"diagnostics": {},
|
||||
"nv-needs": {},
|
||||
"static": {
|
||||
"sVcGpaDemo_D_BrkCtrlr": {
|
||||
"access": "READ-ONLY",
|
||||
"type": "UInt8",
|
||||
"init": 0
|
||||
},
|
||||
"yVcGpaDemo_B_InputOne": {
|
||||
"access": "READ-ONLY",
|
||||
"type": "Bool",
|
||||
"init": 0
|
||||
},
|
||||
"yVcGpaDemo_B_InputTwo": {
|
||||
"access": "READ-ONLY",
|
||||
"type": "Bool",
|
||||
"init": 0
|
||||
},
|
||||
"yVcGpaDemo_B_InputThree": {
|
||||
"access": "READ-ONLY",
|
||||
"type": "Bool",
|
||||
"init": 0
|
||||
},
|
||||
"yVcGpaDemo_B_InputFour": {
|
||||
"access": "READ-ONLY",
|
||||
"type": "Bool",
|
||||
"init": 0
|
||||
}
|
||||
},
|
||||
"shared": composition_yaml_setup.base_shared,
|
||||
"io": {
|
||||
"DUMMY1": {
|
||||
"DUMMY1": {
|
||||
"dataElement": "DUMMY1",
|
||||
"runnable": ["DummyRunnable"]
|
||||
},
|
||||
"PPortPrototype_IoHwAb_GetDUMMY1": {
|
||||
"operation": "Op_IoHwAb_GetDUMMY1",
|
||||
"runnable": ["DummyRunnable"],
|
||||
"timeout": 0,
|
||||
"calltype": "sync"
|
||||
}
|
||||
}
|
||||
},
|
||||
"ports": {
|
||||
"GlobSignNme": {"direction": "IN", "interface": "PIGlobSignNme"}
|
||||
},
|
||||
}
|
||||
},
|
||||
"DataTypes": composition_yaml_setup.base_data_types,
|
||||
"PortInterfaces": composition_yaml_setup.base_port_interfaces,
|
||||
"ExternalFiles": composition_yaml_setup.base_configuration
|
||||
}
|
@ -22,6 +22,7 @@ from test_data.zone_controller.test_composition_yaml import (
|
||||
composition_yaml_with_calls_no_optional_fields,
|
||||
composition_yaml_with_dids,
|
||||
composition_yaml_with_dtcs,
|
||||
composition_yaml_with_external_io,
|
||||
composition_yaml_with_nvm,
|
||||
)
|
||||
|
||||
@ -143,7 +144,8 @@ class TestCompositionYaml(unittest.TestCase):
|
||||
with patch.object(ZCDIDs, "_get_project_dids", return_value={}):
|
||||
self.zc_dids = ZCDIDs(self.build_cfg, self.unit_cfg)
|
||||
|
||||
self.zc_spec = copy.deepcopy(composition_yaml_setup.zc_spec)
|
||||
self.signal_interfaces = MagicMock()
|
||||
self.signal_interfaces.composition_spec = copy.deepcopy(composition_yaml_setup.composition_spec)
|
||||
|
||||
self.nvm_def = MagicMock()
|
||||
self.nvm_def.struct_member_prefix = "e_"
|
||||
@ -156,7 +158,7 @@ class TestCompositionYaml(unittest.TestCase):
|
||||
return_value=self.calibration_definitions
|
||||
):
|
||||
self.composition_yaml = CompositionYaml(
|
||||
self.build_cfg, self.zc_spec, self.unit_cfg, self.zc_core, self.zc_dids, self.nvm_def, {}, {}
|
||||
self.build_cfg, self.signal_interfaces, self.unit_cfg, self.zc_core, self.zc_dids, self.nvm_def, {}, {}
|
||||
)
|
||||
|
||||
def test_composition_yaml(self):
|
||||
@ -166,19 +168,18 @@ class TestCompositionYaml(unittest.TestCase):
|
||||
|
||||
def test_composition_yaml_extra_runnable_keys(self):
|
||||
"""Checking that the dict is generated correctly with extra runnable keys."""
|
||||
self.zc_spec["mode_switch_points"] = ["DummyPort"]
|
||||
self.signal_interfaces.composition_spec["mode_switch_points"] = ["DummyPort"]
|
||||
self.composition_yaml = CompositionYaml(
|
||||
self.build_cfg, self.zc_spec, self.unit_cfg, self.zc_core, self.zc_dids, self.nvm_def, {}, {}
|
||||
self.build_cfg, self.signal_interfaces, self.unit_cfg, self.zc_core, self.zc_dids, self.nvm_def, {}, {}
|
||||
)
|
||||
result = self.composition_yaml.gather_yaml_info()
|
||||
self.assertDictEqual(composition_yaml.expected_extra_runnable_keys_result, result)
|
||||
del self.zc_spec["mode_switch_points"]
|
||||
|
||||
def test_composition_yaml_with_custom_names(self):
|
||||
"""Checking that the dict is generated correctly with custom names."""
|
||||
self.build_cfg.get_composition_config.side_effect = mock_get_composition_config_custom_names
|
||||
self.composition_yaml = CompositionYaml(
|
||||
self.build_cfg, self.zc_spec, self.unit_cfg, self.zc_core, self.zc_dids, self.nvm_def, {}, {}
|
||||
self.build_cfg, self.signal_interfaces, self.unit_cfg, self.zc_core, self.zc_dids, self.nvm_def, {}, {}
|
||||
)
|
||||
result = self.composition_yaml.gather_yaml_info()
|
||||
self.assertDictEqual(composition_yaml.expected_custom_names_result, result)
|
||||
@ -193,7 +194,7 @@ class TestCompositionYaml(unittest.TestCase):
|
||||
return_value=self.calibration_definitions
|
||||
):
|
||||
self.composition_yaml = CompositionYaml(
|
||||
self.build_cfg, self.zc_spec, self.unit_cfg, self.zc_core, self.zc_dids, self.nvm_def, {}, {}
|
||||
self.build_cfg, self.signal_interfaces, self.unit_cfg, self.zc_core, self.zc_dids, self.nvm_def, {}, {}
|
||||
)
|
||||
result = self.composition_yaml.gather_yaml_info()
|
||||
self.assertDictEqual(composition_yaml.expected_cal_result, result)
|
||||
@ -208,7 +209,7 @@ class TestCompositionYaml(unittest.TestCase):
|
||||
return_value=self.calibration_definitions
|
||||
):
|
||||
self.composition_yaml = CompositionYaml(
|
||||
self.build_cfg, self.zc_spec, self.unit_cfg, self.zc_core, self.zc_dids, self.nvm_def, {}, {}
|
||||
self.build_cfg, self.signal_interfaces, self.unit_cfg, self.zc_core, self.zc_dids, self.nvm_def, {}, {}
|
||||
)
|
||||
result = self.composition_yaml.gather_yaml_info()
|
||||
self.assertDictEqual(composition_yaml.expected_result, result)
|
||||
@ -217,12 +218,18 @@ class TestCompositionYaml(unittest.TestCase):
|
||||
"""Checking that the dict is generated correctly, including a2l axis data."""
|
||||
self.unit_cfg.get_per_cfg_unit_cfg.return_value = \
|
||||
composition_yaml_with_a2l_axis_data.get_per_cfg_unit_cfg_return_value
|
||||
a2l_axis_data = composition_yaml_with_a2l_axis_data.a2l_axis_data
|
||||
calibration_definitions = \
|
||||
self.calibration_definitions + composition_yaml_with_a2l_axis_data.calibration_definitions
|
||||
with patch.object(CompositionYaml, "_get_all_calibration_definitions", return_value=calibration_definitions):
|
||||
self.composition_yaml = CompositionYaml(
|
||||
self.build_cfg, self.zc_spec, self.unit_cfg, self.zc_core, self.zc_dids, self.nvm_def, a2l_axis_data, {}
|
||||
self.build_cfg,
|
||||
self.signal_interfaces,
|
||||
self.unit_cfg,
|
||||
self.zc_core,
|
||||
self.zc_dids,
|
||||
self.nvm_def,
|
||||
composition_yaml_with_a2l_axis_data.a2l_axis_data,
|
||||
{}
|
||||
)
|
||||
|
||||
result = self.composition_yaml.gather_yaml_info()
|
||||
@ -230,7 +237,7 @@ class TestCompositionYaml(unittest.TestCase):
|
||||
|
||||
def test_composition_yaml_with_calls_all_fields(self):
|
||||
"""Checking that the dict is generated correctly, with calls including all fields."""
|
||||
self.zc_spec["calls"] = {
|
||||
self.signal_interfaces.composition_spec["calls"] = {
|
||||
"CallOne": {
|
||||
"interface": "InterfaceOne",
|
||||
"direction": "IN",
|
||||
@ -244,14 +251,14 @@ class TestCompositionYaml(unittest.TestCase):
|
||||
return_value=self.calibration_definitions
|
||||
):
|
||||
self.composition_yaml = CompositionYaml(
|
||||
self.build_cfg, self.zc_spec, self.unit_cfg, self.zc_core, self.zc_dids, self.nvm_def, {}, {}
|
||||
self.build_cfg, self.signal_interfaces, self.unit_cfg, self.zc_core, self.zc_dids, self.nvm_def, {}, {}
|
||||
)
|
||||
result = self.composition_yaml.gather_yaml_info()
|
||||
self.assertDictEqual(composition_yaml_with_calls_all_fields.expected_result, result)
|
||||
|
||||
def test_composition_yaml_with_calls_no_optional_fields(self):
|
||||
"""Checking that the dict is generated correctly, with calls without optional fields."""
|
||||
self.zc_spec["calls"] = {
|
||||
self.signal_interfaces.composition_spec["calls"] = {
|
||||
"CallOne": {
|
||||
"direction": "IN",
|
||||
"operation": "OperationOne",
|
||||
@ -263,7 +270,7 @@ class TestCompositionYaml(unittest.TestCase):
|
||||
return_value=self.calibration_definitions
|
||||
):
|
||||
self.composition_yaml = CompositionYaml(
|
||||
self.build_cfg, self.zc_spec, self.unit_cfg, self.zc_core, self.zc_dids, self.nvm_def, {}, {}
|
||||
self.build_cfg, self.signal_interfaces, self.unit_cfg, self.zc_core, self.zc_dids, self.nvm_def, {}, {}
|
||||
)
|
||||
result = self.composition_yaml.gather_yaml_info()
|
||||
self.assertDictEqual(composition_yaml_with_calls_no_optional_fields.expected_result, result)
|
||||
@ -271,14 +278,14 @@ class TestCompositionYaml(unittest.TestCase):
|
||||
def test_composition_yaml_with_dids(self):
|
||||
"""Checking that the dict is generated correctly, with DIDs."""
|
||||
self.zc_dids.project_dids = {"DID1": {"type": "UInt8"}}
|
||||
self.zc_spec["diagnostics"] = composition_yaml_with_dids.diagnostics
|
||||
self.signal_interfaces.composition_spec["diagnostics"] = composition_yaml_with_dids.diagnostics
|
||||
with patch.object(
|
||||
CompositionYaml,
|
||||
"_get_all_calibration_definitions",
|
||||
return_value=self.calibration_definitions
|
||||
):
|
||||
self.composition_yaml = CompositionYaml(
|
||||
self.build_cfg, self.zc_spec, self.unit_cfg, self.zc_core, self.zc_dids, self.nvm_def, {}, {}
|
||||
self.build_cfg, self.signal_interfaces, self.unit_cfg, self.zc_core, self.zc_dids, self.nvm_def, {}, {}
|
||||
)
|
||||
result = self.composition_yaml.gather_yaml_info()
|
||||
self.assertDictEqual(composition_yaml_with_dids.expected_result, result)
|
||||
@ -286,14 +293,14 @@ class TestCompositionYaml(unittest.TestCase):
|
||||
def test_composition_yaml_with_dtcs(self):
|
||||
"""Checking that the dict is generated correctly, with DTCs."""
|
||||
self.zc_core.project_dtcs = {"DTC1"}
|
||||
self.zc_spec["diagnostics"] = composition_yaml_with_dtcs.diagnostics
|
||||
self.signal_interfaces.composition_spec["diagnostics"] = composition_yaml_with_dtcs.diagnostics
|
||||
with patch.object(
|
||||
CompositionYaml,
|
||||
"_get_all_calibration_definitions",
|
||||
return_value=self.calibration_definitions
|
||||
):
|
||||
self.composition_yaml = CompositionYaml(
|
||||
self.build_cfg, self.zc_spec, self.unit_cfg, self.zc_core, self.zc_dids, self.nvm_def, {}, {}
|
||||
self.build_cfg, self.signal_interfaces, self.unit_cfg, self.zc_core, self.zc_dids, self.nvm_def, {}, {}
|
||||
)
|
||||
result = self.composition_yaml.gather_yaml_info()
|
||||
self.assertDictEqual(composition_yaml_with_dtcs.expected_result, result)
|
||||
@ -304,18 +311,32 @@ class TestCompositionYaml(unittest.TestCase):
|
||||
self.nvm_def.project_nvm_definitions = {
|
||||
f"prefix_{item['name']}": item for item in self.nvm_def.nvm_definitions
|
||||
}
|
||||
self.zc_spec["nv-needs"] = composition_yaml_with_nvm.yaml_nvm_definitions
|
||||
self.signal_interfaces.composition_spec["nv-needs"] = composition_yaml_with_nvm.yaml_nvm_definitions
|
||||
with patch.object(
|
||||
CompositionYaml,
|
||||
"_get_all_calibration_definitions",
|
||||
return_value=self.calibration_definitions
|
||||
):
|
||||
self.composition_yaml = CompositionYaml(
|
||||
self.build_cfg, self.zc_spec, self.unit_cfg, self.zc_core, self.zc_dids, self.nvm_def, {}, {}
|
||||
self.build_cfg, self.signal_interfaces, self.unit_cfg, self.zc_core, self.zc_dids, self.nvm_def, {}, {}
|
||||
)
|
||||
result = self.composition_yaml.gather_yaml_info()
|
||||
self.assertDictEqual(composition_yaml_with_nvm.expected_result, result)
|
||||
|
||||
def test_composition_yaml_with_external_io(self):
|
||||
"""Checking that the dict is generated correctly, with external IO."""
|
||||
self.signal_interfaces.get_external_io.return_value = composition_yaml_with_external_io.external_io
|
||||
with patch.object(
|
||||
CompositionYaml,
|
||||
"_get_all_calibration_definitions",
|
||||
return_value=self.calibration_definitions
|
||||
):
|
||||
self.composition_yaml = CompositionYaml(
|
||||
self.build_cfg, self.signal_interfaces, self.unit_cfg, self.zc_core, self.zc_dids, self.nvm_def, {}, {}
|
||||
)
|
||||
result = self.composition_yaml.gather_yaml_info()
|
||||
self.assertDictEqual(composition_yaml_with_external_io.expected_result, result)
|
||||
|
||||
def test_get_init_values_expecting_failure(self):
|
||||
"""Test CompositionYaml.get_init_values with a non-existing calibration definition."""
|
||||
self.composition_yaml.clear_log()
|
||||
|
Loading…
x
Reference in New Issue
Block a user