File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -12,7 +12,10 @@ mod walltime;
1212
1313#[ derive( Parser , Debug ) ]
1414#[ command( name = "exec-harness" ) ]
15- #[ command( about = "CodSpeed exec harness - wraps commands with performance instrumentation" ) ]
15+ #[ command(
16+ version,
17+ about = "CodSpeed exec harness - wraps commands with performance instrumentation"
18+ ) ]
1619struct Args {
1720 /// Optional benchmark name (defaults to command filename)
1821 #[ arg( long) ]
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) ]
@@ -31,11 +35,15 @@ pub async fn run(
3135) -> Result < ( ) > {
3236 let config = crate :: executor:: Config :: try_from ( args) ?;
3337 let mut execution_context = executor:: ExecutionContext :: try_from ( ( config, codspeed_config) ) ?;
38+ debug ! ( "config: {:#?}" , execution_context. config) ;
3439 let executor = executor:: get_executor_from_mode (
3540 & execution_context. config . mode ,
3641 executor:: ExecutorCommand :: Exec ,
3742 ) ;
3843
44+ // Ensure the exec-harness is installed
45+ ensure_binary_installed ( EXEC_HARNESS_COMMAND , EXEC_HARNESS_VERSION , None ) . await ?;
46+
3947 let poll_results_fn = |run_id : String | poll_results:: poll_results ( api_client, run_id) ;
4048
4149 executor:: execute_benchmarks (
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