diff --git a/testing-framework/core/src/nodes/executor.rs b/testing-framework/core/src/nodes/executor.rs index c47da0d..644b034 100644 --- a/testing-framework/core/src/nodes/executor.rs +++ b/testing-framework/core/src/nodes/executor.rs @@ -1,5 +1,6 @@ use std::{ collections::HashSet, + env, path::PathBuf, process::{Child, Command, Stdio}, time::Duration, @@ -30,11 +31,24 @@ use crate::{IS_DEBUG_TRACING, adjust_timeout, nodes::LOGS_PREFIX}; const BIN_PATH: &str = "target/debug/nomos-executor"; fn binary_path() -> PathBuf { + if let Some(path) = env::var_os("NOMOS_EXECUTOR_BIN") { + return PathBuf::from(path); + } + if let Some(path) = which_on_path("nomos-executor") { + return path; + } PathBuf::from(env!("CARGO_MANIFEST_DIR")) .join("../../") .join(BIN_PATH) } +fn which_on_path(bin: &str) -> Option { + let path_env = env::var_os("PATH")?; + env::split_paths(&path_env) + .map(|p| p.join(bin)) + .find(|candidate| candidate.is_file()) +} + pub struct Executor { tempdir: tempfile::TempDir, child: Child, diff --git a/testing-framework/core/src/nodes/validator.rs b/testing-framework/core/src/nodes/validator.rs index ce99e76..4375c70 100644 --- a/testing-framework/core/src/nodes/validator.rs +++ b/testing-framework/core/src/nodes/validator.rs @@ -1,5 +1,6 @@ use std::{ collections::HashSet, + env, path::PathBuf, process::{Child, Command, Stdio}, time::Duration, @@ -29,11 +30,24 @@ use crate::{IS_DEBUG_TRACING, adjust_timeout, nodes::LOGS_PREFIX}; const BIN_PATH: &str = "target/debug/nomos-node"; fn binary_path() -> PathBuf { + if let Some(path) = env::var_os("NOMOS_NODE_BIN") { + return PathBuf::from(path); + } + if let Some(path) = which_on_path("nomos-node") { + return path; + } PathBuf::from(env!("CARGO_MANIFEST_DIR")) .join("../../") .join(BIN_PATH) } +fn which_on_path(bin: &str) -> Option { + let path_env = env::var_os("PATH")?; + env::split_paths(&path_env) + .map(|p| p.join(bin)) + .find(|candidate| candidate.is_file()) +} + pub enum Pool { Da, Mantle,