From 5d2f900befdf26e3bfe10186b172272f7dee3494 Mon Sep 17 00:00:00 2001 From: Ivan Grokhotkov Date: Tue, 1 Nov 2022 19:57:03 +0100 Subject: [PATCH 1/2] test_build_system: fix idf_copy fixture not changing IDF_PATH --- tools/test_build_system/conftest.py | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/test_build_system/conftest.py b/tools/test_build_system/conftest.py index a575cf5696..2236d4ca0a 100644 --- a/tools/test_build_system/conftest.py +++ b/tools/test_build_system/conftest.py @@ -120,6 +120,7 @@ def idf_copy(session_work_dir: Path, request: FixtureRequest) -> typing.Generato shutil.copytree(path_from, path_to, ignore=ignore, symlinks=True) orig_idf_path = os.environ['IDF_PATH'] + os.environ['IDF_PATH'] = str(path_to) yield Path(path_to) From 03c542ecf7b88be4a33ec0b195a9aeafea03de72 Mon Sep 17 00:00:00 2001 From: Ivan Grokhotkov Date: Tue, 1 Nov 2022 20:03:19 +0100 Subject: [PATCH 2/2] test_build_system: fix incomplete env returned by get_idf_build_env Previously get_idf_build_env didn't include the default environment (os.environ) in its output, so the environment only contained the variables returned by "idf_tools.py export". If PATH already contains all the right paths, "idf_tools.py export" doesn't return the PATH variable. Therefore the environment returned by get_idf_build_env was usually incomplete. Fix by combining the output of "idf_tools.py export" with os.environ. --- .../test_build_system_helpers/idf_utils.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/tools/test_build_system/test_build_system_helpers/idf_utils.py b/tools/test_build_system/test_build_system_helpers/idf_utils.py index 96cc33db9a..8cc0e3fa7c 100644 --- a/tools/test_build_system/test_build_system_helpers/idf_utils.py +++ b/tools/test_build_system/test_build_system_helpers/idf_utils.py @@ -43,8 +43,11 @@ def get_idf_build_env(idf_path: str) -> EnvDict: '--format=key-value' ] keys_values = subprocess.check_output(cmd, stderr=subprocess.PIPE).decode() - env_vars = {key: os.path.expandvars(value) for key, value in - [line.split('=') for line in keys_values.splitlines()]} + idf_tool_py_env = {key: os.path.expandvars(value) for key, value in + [line.split('=') for line in keys_values.splitlines()]} + env_vars = {} # type: EnvDict + env_vars.update(os.environ) + env_vars.update(idf_tool_py_env) # not set by idf_tools.py, normally set by export.sh env_vars['IDF_PATH'] = idf_path