Skip to content

Commit

Permalink
set a path to speculos and app ELF for CI via env var
Browse files Browse the repository at this point in the history
  • Loading branch information
tzemanovic committed Sep 10, 2024
1 parent 21c9997 commit 1f1c16d
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 3 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -716,6 +716,8 @@ jobs:
id: e2e
run: cargo +${{ env.NIGHTLY }} test --lib "e2e::ledger_tests::pos_bonds" -- --exact
env:
NAMADA_SPECULOS_PATH: "/root/.local/pipx/venvs/speculos/bin/speculos"
NAMADA_SPECULOS_APP_ELF: "/ledger-namada/app_s2.elf"
NAMADA_DEVICE_AUTOMATION: "true"
NAMADA_DEVICE_TRANSPORT: "tcp"
NAMADA_E2E_USE_DEVICE: "true"
Expand Down
6 changes: 3 additions & 3 deletions crates/tests/src/e2e/ledger_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ use crate::e2e::helpers::{
};
use crate::e2e::setup::{
self, allow_duplicate_ips, apply_use_device, default_port_offset, sleep,
Bin, Who,
speculos_app_elf, speculos_path, Bin, Who,
};
use crate::strings::{
LEDGER_SHUTDOWN, LEDGER_STARTED, NON_VALIDATOR_NODE, TX_APPLIED_SUCCESS,
Expand Down Expand Up @@ -551,9 +551,9 @@ fn pos_bonds() -> Result<()> {

// Start Speculos with the automation
speculos = Some(
Command::new("speculos")
Command::new(speculos_path())
.args([
"app_s2.elf",
&speculos_app_elf(),
"--seed",
hw_wallet_automation::SEED,
"--automation",
Expand Down
21 changes: 21 additions & 0 deletions crates/tests/src/e2e/setup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,12 @@ const ENV_VAR_TEMP_PATH: &str = "NAMADA_E2E_TEMP_PATH";
pub const ENV_VAR_USE_PREBUILT_BINARIES: &str =
"NAMADA_E2E_USE_PREBUILT_BINARIES";

/// Env. var to set a path to `speculos` executable
pub const ENV_VAR_SPECULOS_PATH: &str = "NAMADA_SPECULOS_PATH";

/// Env. var to set a path to ledger-namada wallet ELF file for `speculos`
pub const ENV_VAR_SPECULOS_APP_ELF: &str = "NAMADA_SPECULOS_APP_ELF";

/// An E2E test network.
#[derive(Debug, Clone)]
pub struct Network {
Expand Down Expand Up @@ -1544,3 +1550,18 @@ pub fn get_all_wasms_hashes(
})
.collect()
}

/// Get the path to `speculos` executable from [`ENV_VAR_SPECULOS_PATH`] if set,
/// or default to `speculos.py`.
pub fn speculos_path() -> String {
env::var(ENV_VAR_SPECULOS_PATH)
.unwrap_or_else(|_| "speculos.py".to_string())
}

/// Get the path to ledger-namada wallet ELF file for `speculos` executable from
/// [`ENV_VAR_SPECULOS_APP_ELF`] if set, or default to `app_s2.elf` in working
/// dir or path.
pub fn speculos_app_elf() -> String {
env::var(ENV_VAR_SPECULOS_APP_ELF)
.unwrap_or_else(|_| "app_s2.elf".to_string())
}

0 comments on commit 1f1c16d

Please sign in to comment.