Skip to content

Commit

Permalink
fix: generated board-related .conf files for build types
Browse files Browse the repository at this point in the history
Before this fix the _construct_required_cmake_args function would
silently avoid adding the conf/<board>.conf to the OVERLAY_CONFIG
for the hw v2 names, since the below check would expect a name with the
'/' in it, which is not possible.

if os.path.isfile(board_conf):
    overlay_configs.append(f"{board}.conf")
  • Loading branch information
MarkoSagadin committed Aug 20, 2024
1 parent c257a43 commit 6028e13
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 0 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)

## [Unreleased]

### Fixed

- `east build` command silently dropped the board-related .conf files when build types
were used. This bug was introduced in the v0.20.0. with the adoption of the new hardware
model naming.

## [0.21.1] - 2024-08-20

### Fixed
Expand Down
2 changes: 2 additions & 0 deletions src/east/workspace_commands/build_type_flag.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ def _construct_required_cmake_args(
if board:
# Sanitize the board input, user might gave hv version
board = board.split("@")[0]
# Cleanup also hw v2 board names
board = board.replace("/", "_")

# Location of the board file depends on the source_dir and prefix
board_prefix = f"{source_dir}/{prefix}" if source_dir else f"{prefix}"
Expand Down
47 changes: 47 additions & 0 deletions tests/test_release.py
Original file line number Diff line number Diff line change
Expand Up @@ -515,3 +515,50 @@ def test_hw_model_v2_only_apps(west_workplace, monkeypatch, mocker):
"release",
expected_west_cmds=expected_hw_v2_only_apps_release_west_commands,
)


east_yaml_hw_model_v2_with_build_types = """
apps:
- name: test_one
west-boards:
- nrf52840dk/nrf52840
build-types:
- type: debug
conf-files:
- debug.conf
"""

expected_hw_v2_with_build_types_release_west_commands = [
(
"build -b nrf52840dk/nrf52840 app -- -DCONF_FILE=conf/common.conf"
' -DOVERLAY_CONFIG="conf/nrf52840dk_nrf52840.conf;conf/debug.conf"'
' -DEAST_BUILD_TYPE="debug"'
),
(
"build -b nrf52840dk/nrf52840 app -- -DCONF_FILE=conf/common.conf"
' -DOVERLAY_CONFIG="conf/nrf52840dk_nrf52840.conf"'
' -DEAST_BUILD_TYPE="release"'
),
]


def test_hw_model_v2_with_build_types(west_workplace, monkeypatch, mocker):
"""Running east release with build types, where the board names are in the new
hardware model v2 format, should work.
"""
helpers.create_and_write(
west_workplace,
"east.yml",
east_yaml_hw_model_v2_with_build_types,
)

monkeypatch.setattr(east.workspace_commands.release_commands, "RUNNING_TESTS", True)

helper_test_against_west_run(
monkeypatch,
mocker,
west_workplace,
"release",
expected_west_cmds=expected_hw_v2_with_build_types_release_west_commands,
)

0 comments on commit 6028e13

Please sign in to comment.