Skip to content

Commit

Permalink
Fix the directory iteration in prepare_speculos_args when looking for…
Browse files Browse the repository at this point in the history
… the main app in plugin mode
  • Loading branch information
fbeutin-ledger committed Feb 21, 2024
1 parent 15a3774 commit 93389f8
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [1.14.4] - 2024-02-21

### Fixed
- Fix search tree for main app binary in library mode

## [1.14.3] - 2024-02-09

### Changed
Expand Down
9 changes: 5 additions & 4 deletions src/ragger/conftest/base_conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,12 +122,13 @@ def prepare_speculos_args(root_pytest_dir: Path, firmware: Firmware, display: bo
# project_root_dir / conf.OPTIONAL.APP_DIR. There should be only one subfolder in the path.
app_path = None
if conf.OPTIONAL.LOAD_MAIN_APP_AS_LIBRARY:
app_dir_children = list((project_root_dir / conf.OPTIONAL.APP_DIR).iterdir())
if len(app_dir_children) != 1:
app_dir_content = list((project_root_dir / conf.OPTIONAL.APP_DIR).iterdir())
app_dir_subdirectories = [child for child in app_dir_content if child.is_dir()]
if len(app_dir_subdirectories) != 1:
raise ValueError(
f"Expected a single folder in {conf.OPTIONAL.APP_DIR}, found {len(app_dir_children)}"
f"Expected a single folder in {conf.OPTIONAL.APP_DIR}, found {len(app_dir_subdirectories)}"
)
app_path = find_main_application(app_dir_children[0], device)
app_path = find_main_application(app_dir_subdirectories[0], device)
# If the app is standalone, the main app should be located in project_root_dir / conf.OPTIONAL.APP_DIR
else:
app_path = find_main_application(project_root_dir / conf.OPTIONAL.APP_DIR, device)
Expand Down
2 changes: 2 additions & 0 deletions tests/unit/conftests/test_base_conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ def prepare_base_dir(directory: Path) -> Tuple[Path, Path]:
(directory / "deps" / "dep" / "build" / "stax" / "bin").mkdir(parents=True, exist_ok=True)
dep_path = (directory / "deps" / "dep" / "build" / "stax" / "bin" / "app.elf")
dep_path.touch()
token_file_path = (directory / "deps" / ".ethereum_application_build_goes_there")
token_file_path.touch()
app_path = (directory / "build" / "stax" / "bin" / "app.elf")
app_path.touch()
return app_path, dep_path
Expand Down

0 comments on commit 93389f8

Please sign in to comment.