diff --git a/scripts/pylib/twister/twisterlib/runner.py b/scripts/pylib/twister/twisterlib/runner.py index 9e4cf2443ac..f5e2cabf74d 100644 --- a/scripts/pylib/twister/twisterlib/runner.py +++ b/scripts/pylib/twister/twisterlib/runner.py @@ -20,6 +20,7 @@ from multiprocessing import Lock, Process, Value from multiprocessing.managers import BaseManager from typing import List from packaging import version +import pathlib from colorama import Fore from domains import Domains @@ -363,7 +364,8 @@ class CMake: f'-DTC_NAME={self.instance.testsuite.name}', f'-D{warning_command}={warnings_as_errors}', f'-DEXTRA_GEN_EDT_ARGS={gen_edt_args}', - f'-G{self.env.generator}' + f'-G{self.env.generator}', + f'-DPython3_EXECUTABLE={pathlib.Path(sys.executable).as_posix()}' ] # If needed, run CMake using the package_helper script first, to only run diff --git a/scripts/tests/twister/test_runner.py b/scripts/tests/twister/test_runner.py index e0a0ca51194..d2d0143d189 100644 --- a/scripts/tests/twister/test_runner.py +++ b/scripts/tests/twister/test_runner.py @@ -373,6 +373,7 @@ TESTDATA_2_2 = [ '-B' + os.path.join('build', 'dir'), '-DTC_RUNID=1', '-DTC_NAME=testcase', '-DSB_CONFIG_COMPILER_WARNINGS_AS_ERRORS=y', '-DEXTRA_GEN_EDT_ARGS=--edtlib-Werror', '-Gdummy_generator', + f'-DPython3_EXECUTABLE={pathlib.Path(sys.executable).as_posix()}', '-S' + os.path.join('source', 'dir'), 'arg1', 'arg2', '-DBOARD=', @@ -387,6 +388,7 @@ TESTDATA_2_2 = [ '-B' + os.path.join('build', 'dir'), '-DTC_RUNID=1', '-DTC_NAME=testcase', '-DSB_CONFIG_COMPILER_WARNINGS_AS_ERRORS=n', '-DEXTRA_GEN_EDT_ARGS=', '-Gdummy_generator', + f'-DPython3_EXECUTABLE={pathlib.Path(sys.executable).as_posix()}', '-Szephyr_base/share/sysbuild', '-DAPP_DIR=' + os.path.join('source', 'dir'), 'arg1', 'arg2',