scripts: twister: set Python3_EXECUTABLE when calling cmake

When twister calls cmake, set Python3_EXECUTABLE so things work as expected
when using non-global python

Signed-off-by: Mara Furland <mara@fur.land>
This commit is contained in:
Mara Furland 2024-10-07 11:04:02 -04:00 committed by Carles Cufí
commit 7ac41a1b24
2 changed files with 5 additions and 1 deletions

View file

@ -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

View file

@ -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=<platform name>',
@ -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',