@@ -11,7 +11,6 @@ mod results;
11
11
/// Builds the specified go project and writes the benchmarks to the .codspeed folder.
12
12
pub fn build_benchmarks ( project_dir : & Path ) -> anyhow:: Result < Vec < PathBuf > > {
13
13
// 1. Benchmark and package discovery
14
- //
15
14
let benchmark_packages = builder:: discovery:: run ( project_dir) ?;
16
15
info ! ( "Discovered {} packages" , benchmark_packages. len( ) ) ;
17
16
debug ! ( "Packages: {:?}" , benchmark_packages. keys( ) ) ;
@@ -49,8 +48,7 @@ pub fn build_benchmarks(project_dir: &Path) -> anyhow::Result<Vec<PathBuf>> {
49
48
Ok ( binaries)
50
49
}
51
50
52
- /// This will be invoked by `codspeed run -- run_benchmarks`
53
- pub fn run_benchmarks ( ) -> anyhow:: Result < ( ) > {
51
+ pub fn run_benchmarks ( bench : & str ) -> anyhow:: Result < ( ) > {
54
52
// 1. Discover the benchmarks
55
53
let codspeed_dir = std:: env:: current_dir ( ) ?. join ( ".codspeed" ) . join ( "walltime" ) ;
56
54
let benchmark_packages = std:: fs:: read_dir ( & codspeed_dir) ?
@@ -64,7 +62,7 @@ pub fn run_benchmarks() -> anyhow::Result<()> {
64
62
info ! ( "Running: {}" , bench_path. display( ) ) ;
65
63
66
64
let cmd = std:: process:: Command :: new ( bench_path)
67
- . arg ( "-test.bench=." ) // TODO: Pass the args
65
+ . arg ( format ! ( "-test.bench={bench}" ) )
68
66
. output ( ) ?;
69
67
70
68
// Check if the command was successful
@@ -83,6 +81,7 @@ pub fn run_benchmarks() -> anyhow::Result<()> {
83
81
}
84
82
}
85
83
84
+ // 3. Collect the results
86
85
collect_walltime_results ( ) ?;
87
86
88
87
Ok ( ( ) )
0 commit comments