Skip to content

Commit

Permalink
twister: Use proper warnings-to-errors command for sysbuild
Browse files Browse the repository at this point in the history
If sysbuild is used a flag SB_CONFIG_COMPILER_WARNINGS_AS_ERRORS
has to be used in order to turn warings to errors on all images.
Align pytest tests with the change.

Fixes: zephyrproject-rtos#67360

Signed-off-by: Maciej Perkowski <[email protected]>
  • Loading branch information
PerMac authored and nordicjm committed Mar 15, 2024
1 parent bd06b74 commit 3777b86
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
6 changes: 5 additions & 1 deletion scripts/pylib/twister/twisterlib/runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -329,11 +329,15 @@ def run_cmake(self, args="", filter_stages=[]):
warnings_as_errors = 'n'
gen_defines_args = ""

warning_command = 'CONFIG_COMPILER_WARNINGS_AS_ERRORS'
if self.testsuite.sysbuild:
warning_command = 'SB_' + warning_command

logger.debug("Running cmake on %s for %s" % (self.source_dir, self.platform.name))
cmake_args = [
f'-B{self.build_dir}',
f'-DTC_RUNID={self.instance.run_id}',
f'-DCONFIG_COMPILER_WARNINGS_AS_ERRORS={warnings_as_errors}',
f'-D{warning_command}={warnings_as_errors}',
f'-DEXTRA_GEN_DEFINES_ARGS={gen_defines_args}',
f'-G{self.env.generator}'
]
Expand Down
4 changes: 2 additions & 2 deletions scripts/tests/twister/test_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,7 @@ def mock_popen(*args, **kwargs):
None, None,
[os.path.join('dummy', 'cmake'),
'-B' + os.path.join('build', 'dir'), '-DTC_RUNID=1',
'-DCONFIG_COMPILER_WARNINGS_AS_ERRORS=y',
'-DSB_CONFIG_COMPILER_WARNINGS_AS_ERRORS=y',
'-DEXTRA_GEN_DEFINES_ARGS=--edtlib-Werror', '-Gdummy_generator',
'-S' + os.path.join('source', 'dir'),
'arg1', 'arg2',
Expand All @@ -382,7 +382,7 @@ def mock_popen(*args, **kwargs):
'error', 'Cmake build failure',
[os.path.join('dummy', 'cmake'),
'-B' + os.path.join('build', 'dir'), '-DTC_RUNID=1',
'-DCONFIG_COMPILER_WARNINGS_AS_ERRORS=n',
'-DSB_CONFIG_COMPILER_WARNINGS_AS_ERRORS=n',
'-DEXTRA_GEN_DEFINES_ARGS=', '-Gdummy_generator',
'-Szephyr_base/share/sysbuild',
'-DAPP_DIR=' + os.path.join('source', 'dir'),
Expand Down

0 comments on commit 3777b86

Please sign in to comment.