File tree Expand file tree Collapse file tree 1 file changed +17
-1
lines changed Expand file tree Collapse file tree 1 file changed +17
-1
lines changed Original file line number Diff line number Diff line change @@ -413,10 +413,26 @@ fn triage_test(
413413 }
414414}
415415
416+ /// Try to find the hyperfine binary the user has installed.
417+ fn hyp_binary ( ) -> Option < Command > {
418+ const HYP_PATH : & str = "hyperfine" ;
419+ const HYP_HOME : & str = "~/.cargo/bin/hyperfine" ;
420+ if Command :: new ( HYP_PATH ) . output ( ) . is_err ( ) {
421+ if Command :: new ( HYP_HOME ) . output ( ) . is_err ( ) {
422+ None
423+ } else {
424+ Some ( Command :: new ( HYP_HOME ) )
425+ }
426+ } else {
427+ Some ( Command :: new ( HYP_PATH ) )
428+ }
429+ }
430+
416431/// Profiles a given test with hyperfine, returning the mean and standard deviation
417432/// for its runtime. If the test errors, returns `None` instead.
418433fn hyp_profile ( t_bin : & str , t_name : & str , iterations : NonZero < usize > ) -> Option < Timings > {
419- let mut perf_cmd = Command :: new ( "hyperfine" ) ;
434+ let mut perf_cmd = hyp_binary ( ) . expect ( "Couldn't find the Hyperfine binary on the system" ) ;
435+
420436 // Warm up the cache and print markdown output to stdout, which we parse.
421437 perf_cmd. args ( [
422438 "--style" ,
You can’t perform that action at this time.
0 commit comments