File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11use crate :: api_client:: CodSpeedAPIClient ;
2+ use crate :: binary_installer:: ensure_binary_installed;
23use crate :: config:: CodSpeedConfig ;
34use crate :: executor;
45use crate :: prelude:: * ;
@@ -10,6 +11,9 @@ mod poll_results;
1011/// We temporarily force this name for all exec runs
1112pub const DEFAULT_REPOSITORY_NAME : & str = "local-runs" ;
1213
14+ pub const EXEC_HARNESS_COMMAND : & str = "exec-harness" ;
15+ const EXEC_HARNESS_VERSION : & str = env ! ( "CARGO_PKG_VERSION" ) ;
16+
1317#[ derive( Args , Debug ) ]
1418pub struct ExecArgs {
1519 #[ command( flatten) ]
@@ -29,6 +33,8 @@ pub async fn run(
2933 codspeed_config : & CodSpeedConfig ,
3034 setup_cache_dir : Option < & Path > ,
3135) -> Result < ( ) > {
36+ // First, ensure the exec-harness is installed
37+ ensure_binary_installed ( EXEC_HARNESS_COMMAND , EXEC_HARNESS_VERSION , None ) . await ?;
3238 let config = crate :: executor:: Config :: try_from ( args) ?;
3339 let mut execution_context = executor:: ExecutionContext :: try_from ( ( config, codspeed_config) ) ?;
3440 let executor = executor:: get_executor_from_mode (
Original file line number Diff line number Diff line change 1- use crate :: exec:: DEFAULT_REPOSITORY_NAME ;
1+ use crate :: exec:: { DEFAULT_REPOSITORY_NAME , EXEC_HARNESS_COMMAND } ;
22use crate :: instruments:: Instruments ;
33use crate :: prelude:: * ;
44use crate :: run:: { RunArgs , UnwindingMode } ;
@@ -141,7 +141,7 @@ impl TryFrom<crate::exec::ExecArgs> for Config {
141141 . map_err ( |_| anyhow ! ( "Cannot append to upload URL" ) ) ?
142142 . push ( "project" ) ;
143143
144- let wrapped_command = std:: iter:: once ( "exec-harness" . to_string ( ) )
144+ let wrapped_command = std:: iter:: once ( EXEC_HARNESS_COMMAND . to_owned ( ) )
145145 . chain ( args. command )
146146 . collect :: < Vec < String > > ( )
147147 . join ( " " ) ;
Original file line number Diff line number Diff line change @@ -30,11 +30,7 @@ impl MemoryExecutor {
3030 ) -> Result < ( MemtrackIpcServer , CommandBuilder ) > {
3131 // FIXME: We only support native languages for now
3232
33- // Find memtrack binary - check env variable or use default command name
34- let memtrack_path = std:: env:: var ( "CODSPEED_MEMTRACK_BINARY" )
35- . unwrap_or_else ( |_| "codspeed-memtrack" . to_string ( ) ) ;
36-
37- let mut cmd_builder = CommandBuilder :: new ( memtrack_path) ;
33+ let mut cmd_builder = CommandBuilder :: new ( MEMTRACK_COMMAND ) ;
3834 cmd_builder. arg ( "track" ) ;
3935 cmd_builder. arg ( get_bench_command ( & execution_context. config ) ?) ;
4036 cmd_builder. arg ( "--output" ) ;
You can’t perform that action at this time.
0 commit comments