From d7c2aaf3d86a3e220ec5e7759fdaf78b16578105 Mon Sep 17 00:00:00 2001 From: Francois Beutin Date: Tue, 23 Dec 2025 11:49:04 +0100 Subject: [PATCH] Added explicit way to forward self app name to Ragger/Speculos if it is not readable in the elf file --- CHANGELOG.md | 6 ++++++ src/ragger/conftest/base_conftest.py | 6 +++++- src/ragger/conftest/configuration.py | 10 ++++++++++ 3 files changed, 21 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4d570e96..c28740d3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,12 @@ 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.42.0] - 2025-12-23 + +### Added + +- Added explicit way to forward self app name to Ragger/Speculos if it is not readable in the elf file + ## [1.41.1] - 2025-12-12 ### Fixed diff --git a/src/ragger/conftest/base_conftest.py b/src/ragger/conftest/base_conftest.py index 0da2310c..bafe3995 100644 --- a/src/ragger/conftest/base_conftest.py +++ b/src/ragger/conftest/base_conftest.py @@ -279,7 +279,11 @@ def prepare_speculos_args(root_pytest_dir: Path, if conf.OPTIONAL.MAIN_APP_DIR is not None: # This repo holds the library, not the standalone app: search in root_dir/build lib_path = find_application(project_root_dir, device_name, manifest.app.sdk) - speculos_args.append(f"-l{lib_path}") + load_name = "" + if conf.OPTIONAL.SELF_APP_NAME is not None: + # This repo wants to set a specific library name + load_name = f"{conf.OPTIONAL.SELF_APP_NAME}:" + speculos_args.append(f"-l{load_name}{lib_path}") # Legacy lib method, remove once exchange is ported if len(conf.OPTIONAL.SIDELOADED_APPS) != 0: diff --git a/src/ragger/conftest/configuration.py b/src/ragger/conftest/configuration.py index bf90e87e..39f22625 100644 --- a/src/ragger/conftest/configuration.py +++ b/src/ragger/conftest/configuration.py @@ -6,6 +6,7 @@ class OptionalOptions: APP_NAME: str MAIN_APP_DIR: Optional[str] + SELF_APP_NAME: Optional[str] SIDELOADED_APPS: dict SIDELOADED_APPS_DIR: Optional[str] BACKEND_SCOPE: str @@ -30,6 +31,15 @@ class OptionalOptions: # There must be exactly one application cloned inside this directory. MAIN_APP_DIR=None, + # If not None, this parameter specifies the name of the library application (the one in the + # current repository) when loaded by Speculos. This is only used when MAIN_APP_DIR is set. + # + # example: configuration.OPTIONAL.SELF_APP_NAME = "Bitcoin" + # Speculos will then load the library with the "-lBitcoin:" argument. + # + # This is unnecessary for C applications as the application name is read from the ELF file. + SELF_APP_NAME=None, + # Deprecated SIDELOADED_APPS=dict(),