Skip to content

Commit 17587bb

Browse files
committed
fix(go-runner): use git-relative file paths
1 parent a9bba7f commit 17587bb

6 files changed

Lines changed: 446 additions & 2 deletions

go-runner/src/integration_tests.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ fn assert_results_snapshots(profile_dir: &Path, project_name: &str) {
6060
// Currently not producing results:
6161
#[case::fuego("fuego")]
6262
#[case::cli_runtime("cli-runtime")]
63+
#[case::example("example")]
6364
fn test_build_and_run(#[case] project_name: &str) {
6465
let project_dir = PathBuf::from(env!("CARGO_MANIFEST_DIR"))
6566
.join("testdata/projects")

go-runner/src/lib.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,10 @@ pub fn run_benchmarks(project_dir: &Path, cli: &crate::cli::Cli) -> anyhow::Resu
2727
let mut bench_name_to_path = HashMap::new();
2828
for package in &packages {
2929
for benchmark in &package.benchmarks {
30-
bench_name_to_path.insert(benchmark.name.clone(), benchmark.file_path.clone());
30+
// Create absolute path and immediately convert to git-relative path
31+
let abs_path = package.module.dir.join(&benchmark.file_path);
32+
let git_relative_path = crate::utils::get_git_relative_path(&abs_path);
33+
bench_name_to_path.insert(benchmark.name.clone(), git_relative_path);
3134
}
3235
}
3336

Lines changed: 203 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,203 @@
1+
---
2+
source: go-runner/src/integration_tests.rs
3+
expression: content
4+
---
5+
{
6+
"creator": {
7+
"name": "codspeed-go",
8+
"version": "0.1.0",
9+
"pid": "[pid]"
10+
},
11+
"instrument": {
12+
"type": "walltime"
13+
},
14+
"benchmarks": [
15+
{
16+
"name": "BenchmarkFibonacci10::fibonacci(10)::fibonacci(10)",
17+
"uri": "example/fib_test.go::BenchmarkFibonacci10::fibonacci(10)::fibonacci(10)",
18+
"config": {
19+
"warmup_time_ns": null,
20+
"min_round_time_ns": null,
21+
"max_time_ns": null,
22+
"max_rounds": null
23+
},
24+
"stats": "[stats]"
25+
},
26+
{
27+
"name": "BenchmarkFibonacci20_Loop",
28+
"uri": "example/fib_test.go::BenchmarkFibonacci20_Loop",
29+
"config": {
30+
"warmup_time_ns": null,
31+
"min_round_time_ns": null,
32+
"max_time_ns": null,
33+
"max_rounds": null
34+
},
35+
"stats": "[stats]"
36+
},
37+
{
38+
"name": "BenchmarkFibonacci20_bN",
39+
"uri": "example/fib_test.go::BenchmarkFibonacci20_bN",
40+
"config": {
41+
"warmup_time_ns": null,
42+
"min_round_time_ns": null,
43+
"max_time_ns": null,
44+
"max_rounds": null
45+
},
46+
"stats": "[stats]"
47+
},
48+
{
49+
"name": "BenchmarkSleep100ns",
50+
"uri": "example/sleep_test.go::BenchmarkSleep100ns",
51+
"config": {
52+
"warmup_time_ns": null,
53+
"min_round_time_ns": null,
54+
"max_time_ns": null,
55+
"max_rounds": null
56+
},
57+
"stats": "[stats]"
58+
},
59+
{
60+
"name": "BenchmarkSleep100ns_Loop",
61+
"uri": "example/sleep_test.go::BenchmarkSleep100ns_Loop",
62+
"config": {
63+
"warmup_time_ns": null,
64+
"min_round_time_ns": null,
65+
"max_time_ns": null,
66+
"max_rounds": null
67+
},
68+
"stats": "[stats]"
69+
},
70+
{
71+
"name": "BenchmarkSleep100us",
72+
"uri": "example/sleep_test.go::BenchmarkSleep100us",
73+
"config": {
74+
"warmup_time_ns": null,
75+
"min_round_time_ns": null,
76+
"max_time_ns": null,
77+
"max_rounds": null
78+
},
79+
"stats": "[stats]"
80+
},
81+
{
82+
"name": "BenchmarkSleep100us_Loop",
83+
"uri": "example/sleep_test.go::BenchmarkSleep100us_Loop",
84+
"config": {
85+
"warmup_time_ns": null,
86+
"min_round_time_ns": null,
87+
"max_time_ns": null,
88+
"max_rounds": null
89+
},
90+
"stats": "[stats]"
91+
},
92+
{
93+
"name": "BenchmarkSleep10ms",
94+
"uri": "example/sleep_test.go::BenchmarkSleep10ms",
95+
"config": {
96+
"warmup_time_ns": null,
97+
"min_round_time_ns": null,
98+
"max_time_ns": null,
99+
"max_rounds": null
100+
},
101+
"stats": "[stats]"
102+
},
103+
{
104+
"name": "BenchmarkSleep10ms_Loop",
105+
"uri": "example/sleep_test.go::BenchmarkSleep10ms_Loop",
106+
"config": {
107+
"warmup_time_ns": null,
108+
"min_round_time_ns": null,
109+
"max_time_ns": null,
110+
"max_rounds": null
111+
},
112+
"stats": "[stats]"
113+
},
114+
{
115+
"name": "BenchmarkSleep10us",
116+
"uri": "example/sleep_test.go::BenchmarkSleep10us",
117+
"config": {
118+
"warmup_time_ns": null,
119+
"min_round_time_ns": null,
120+
"max_time_ns": null,
121+
"max_rounds": null
122+
},
123+
"stats": "[stats]"
124+
},
125+
{
126+
"name": "BenchmarkSleep10us_Loop",
127+
"uri": "example/sleep_test.go::BenchmarkSleep10us_Loop",
128+
"config": {
129+
"warmup_time_ns": null,
130+
"min_round_time_ns": null,
131+
"max_time_ns": null,
132+
"max_rounds": null
133+
},
134+
"stats": "[stats]"
135+
},
136+
{
137+
"name": "BenchmarkSleep1ms",
138+
"uri": "example/sleep_test.go::BenchmarkSleep1ms",
139+
"config": {
140+
"warmup_time_ns": null,
141+
"min_round_time_ns": null,
142+
"max_time_ns": null,
143+
"max_rounds": null
144+
},
145+
"stats": "[stats]"
146+
},
147+
{
148+
"name": "BenchmarkSleep1ms_Loop",
149+
"uri": "example/sleep_test.go::BenchmarkSleep1ms_Loop",
150+
"config": {
151+
"warmup_time_ns": null,
152+
"min_round_time_ns": null,
153+
"max_time_ns": null,
154+
"max_rounds": null
155+
},
156+
"stats": "[stats]"
157+
},
158+
{
159+
"name": "BenchmarkSleep1us",
160+
"uri": "example/sleep_test.go::BenchmarkSleep1us",
161+
"config": {
162+
"warmup_time_ns": null,
163+
"min_round_time_ns": null,
164+
"max_time_ns": null,
165+
"max_rounds": null
166+
},
167+
"stats": "[stats]"
168+
},
169+
{
170+
"name": "BenchmarkSleep1us_Loop",
171+
"uri": "example/sleep_test.go::BenchmarkSleep1us_Loop",
172+
"config": {
173+
"warmup_time_ns": null,
174+
"min_round_time_ns": null,
175+
"max_time_ns": null,
176+
"max_rounds": null
177+
},
178+
"stats": "[stats]"
179+
},
180+
{
181+
"name": "BenchmarkSleep50ms",
182+
"uri": "example/sleep_test.go::BenchmarkSleep50ms",
183+
"config": {
184+
"warmup_time_ns": null,
185+
"min_round_time_ns": null,
186+
"max_time_ns": null,
187+
"max_rounds": null
188+
},
189+
"stats": "[stats]"
190+
},
191+
{
192+
"name": "BenchmarkSleep50ms_Loop",
193+
"uri": "example/sleep_test.go::BenchmarkSleep50ms_Loop",
194+
"config": {
195+
"warmup_time_ns": null,
196+
"min_round_time_ns": null,
197+
"max_time_ns": null,
198+
"max_rounds": null
199+
},
200+
"stats": "[stats]"
201+
}
202+
]
203+
}

0 commit comments

Comments
 (0)