Skip to content

Commit 6c9e74f

Browse files
committed
fix(go-runner): resolve path using first URI part
1 parent 27bb649 commit 6c9e74f

9 files changed

Lines changed: 119 additions & 113 deletions

go-runner/src/lib.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,14 @@ fn collect_walltime_results(bench_name_to_path: HashMap<String, PathBuf>) -> any
7575
let mut benchmarks_by_pid: HashMap<u32, Vec<results::walltime_results::WalltimeBenchmark>> =
7676
HashMap::new();
7777
for raw in raw_results {
78+
// We only parse the `func Benchmark*` name which is the first part of the URI
79+
let func_name = raw
80+
.benchmark_name
81+
.split("::")
82+
.next()
83+
.unwrap_or(&raw.benchmark_name);
7884
let file_path = bench_name_to_path
79-
.get(&raw.benchmark_name)
85+
.get(func_name)
8086
.map(|p| p.to_string_lossy().to_string());
8187
benchmarks_by_pid
8288
.entry(raw.pid)

go-runner/src/snapshots/go_runner__integration_tests__assert_results_snapshots@golang-benchmarks_1.snap

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
source: src/integration_tests.rs
2+
source: go-runner/src/integration_tests.rs
33
expression: content
44
---
55
{
@@ -69,7 +69,7 @@ expression: content
6969
},
7070
{
7171
"name": "BenchmarkContainsMethods::Bytes.Contains",
72-
"uri": "unknown::BenchmarkContainsMethods::Bytes.Contains",
72+
"uri": "contains/contains_test.go::BenchmarkContainsMethods::Bytes.Contains",
7373
"config": {
7474
"warmup_time_ns": null,
7575
"min_round_time_ns": null,
@@ -80,7 +80,7 @@ expression: content
8080
},
8181
{
8282
"name": "BenchmarkContainsMethods::RegexMatch",
83-
"uri": "unknown::BenchmarkContainsMethods::RegexMatch",
83+
"uri": "contains/contains_test.go::BenchmarkContainsMethods::RegexMatch",
8484
"config": {
8585
"warmup_time_ns": null,
8686
"min_round_time_ns": null,
@@ -91,7 +91,7 @@ expression: content
9191
},
9292
{
9393
"name": "BenchmarkContainsMethods::RegexMatchString",
94-
"uri": "unknown::BenchmarkContainsMethods::RegexMatchString",
94+
"uri": "contains/contains_test.go::BenchmarkContainsMethods::RegexMatchString",
9595
"config": {
9696
"warmup_time_ns": null,
9797
"min_round_time_ns": null,
@@ -102,7 +102,7 @@ expression: content
102102
},
103103
{
104104
"name": "BenchmarkContainsMethods::Strings.Contains",
105-
"uri": "unknown::BenchmarkContainsMethods::Strings.Contains",
105+
"uri": "contains/contains_test.go::BenchmarkContainsMethods::Strings.Contains",
106106
"config": {
107107
"warmup_time_ns": null,
108108
"min_round_time_ns": null,

go-runner/src/snapshots/go_runner__integration_tests__assert_results_snapshots@golang-benchmarks_2.snap

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
source: src/integration_tests.rs
2+
source: go-runner/src/integration_tests.rs
33
expression: content
44
---
55
{
@@ -14,7 +14,7 @@ expression: content
1414
"benchmarks": [
1515
{
1616
"name": "BenchmarkConcat::Buffer",
17-
"uri": "unknown::BenchmarkConcat::Buffer",
17+
"uri": "concat/concat_test.go::BenchmarkConcat::Buffer",
1818
"config": {
1919
"warmup_time_ns": null,
2020
"min_round_time_ns": null,
@@ -25,7 +25,7 @@ expression: content
2525
},
2626
{
2727
"name": "BenchmarkConcat::Builder",
28-
"uri": "unknown::BenchmarkConcat::Builder",
28+
"uri": "concat/concat_test.go::BenchmarkConcat::Builder",
2929
"config": {
3030
"warmup_time_ns": null,
3131
"min_round_time_ns": null,
@@ -36,7 +36,7 @@ expression: content
3636
},
3737
{
3838
"name": "BenchmarkConcat::String",
39-
"uri": "unknown::BenchmarkConcat::String",
39+
"uri": "concat/concat_test.go::BenchmarkConcat::String",
4040
"config": {
4141
"warmup_time_ns": null,
4242
"min_round_time_ns": null,

go-runner/src/snapshots/go_runner__integration_tests__assert_results_snapshots@hugo_5.snap

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
source: src/integration_tests.rs
2+
source: go-runner/src/integration_tests.rs
33
expression: content
44
---
55
{
@@ -36,7 +36,7 @@ expression: content
3636
},
3737
{
3838
"name": "BenchmarkWhereOps::eq",
39-
"uri": "unknown::BenchmarkWhereOps::eq",
39+
"uri": "tpl/collections/where_test.go::BenchmarkWhereOps::eq",
4040
"config": {
4141
"warmup_time_ns": null,
4242
"min_round_time_ns": null,
@@ -47,7 +47,7 @@ expression: content
4747
},
4848
{
4949
"name": "BenchmarkWhereOps::like",
50-
"uri": "unknown::BenchmarkWhereOps::like",
50+
"uri": "tpl/collections/where_test.go::BenchmarkWhereOps::like",
5151
"config": {
5252
"warmup_time_ns": null,
5353
"min_round_time_ns": null,
@@ -58,7 +58,7 @@ expression: content
5858
},
5959
{
6060
"name": "BenchmarkWhereOps::ne",
61-
"uri": "unknown::BenchmarkWhereOps::ne",
61+
"uri": "tpl/collections/where_test.go::BenchmarkWhereOps::ne",
6262
"config": {
6363
"warmup_time_ns": null,
6464
"min_round_time_ns": null,

go-runner/src/snapshots/go_runner__integration_tests__assert_results_snapshots@hugo_6.snap

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
source: src/integration_tests.rs
2+
source: go-runner/src/integration_tests.rs
33
expression: content
44
---
55
{
@@ -14,7 +14,7 @@ expression: content
1414
"benchmarks": [
1515
{
1616
"name": "BenchmarkTruncate::Plain_text",
17-
"uri": "unknown::BenchmarkTruncate::Plain_text",
17+
"uri": "tpl/strings/truncate_test.go::BenchmarkTruncate::Plain_text",
1818
"config": {
1919
"warmup_time_ns": null,
2020
"min_round_time_ns": null,
@@ -25,7 +25,7 @@ expression: content
2525
},
2626
{
2727
"name": "BenchmarkTruncate::With_link",
28-
"uri": "unknown::BenchmarkTruncate::With_link",
28+
"uri": "tpl/strings/truncate_test.go::BenchmarkTruncate::With_link",
2929
"config": {
3030
"warmup_time_ns": null,
3131
"min_round_time_ns": null,

go-runner/src/snapshots/go_runner__integration_tests__assert_results_snapshots@zerolog_0.snap

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
source: src/integration_tests.rs
2+
source: go-runner/src/integration_tests.rs
33
expression: content
44
---
55
{
@@ -14,7 +14,7 @@ expression: content
1414
"benchmarks": [
1515
{
1616
"name": "BenchmarkAppendBytes::EncodingFirst",
17-
"uri": "unknown::BenchmarkAppendBytes::EncodingFirst",
17+
"uri": "internal/json/bytes_test.go::BenchmarkAppendBytes::EncodingFirst",
1818
"config": {
1919
"warmup_time_ns": null,
2020
"min_round_time_ns": null,
@@ -25,7 +25,7 @@ expression: content
2525
},
2626
{
2727
"name": "BenchmarkAppendBytes::EncodingLast",
28-
"uri": "unknown::BenchmarkAppendBytes::EncodingLast",
28+
"uri": "internal/json/bytes_test.go::BenchmarkAppendBytes::EncodingLast",
2929
"config": {
3030
"warmup_time_ns": null,
3131
"min_round_time_ns": null,
@@ -36,7 +36,7 @@ expression: content
3636
},
3737
{
3838
"name": "BenchmarkAppendBytes::EncodingMiddle",
39-
"uri": "unknown::BenchmarkAppendBytes::EncodingMiddle",
39+
"uri": "internal/json/bytes_test.go::BenchmarkAppendBytes::EncodingMiddle",
4040
"config": {
4141
"warmup_time_ns": null,
4242
"min_round_time_ns": null,
@@ -47,7 +47,7 @@ expression: content
4747
},
4848
{
4949
"name": "BenchmarkAppendBytes::MultiBytesFirst",
50-
"uri": "unknown::BenchmarkAppendBytes::MultiBytesFirst",
50+
"uri": "internal/json/bytes_test.go::BenchmarkAppendBytes::MultiBytesFirst",
5151
"config": {
5252
"warmup_time_ns": null,
5353
"min_round_time_ns": null,
@@ -58,7 +58,7 @@ expression: content
5858
},
5959
{
6060
"name": "BenchmarkAppendBytes::MultiBytesLast",
61-
"uri": "unknown::BenchmarkAppendBytes::MultiBytesLast",
61+
"uri": "internal/json/bytes_test.go::BenchmarkAppendBytes::MultiBytesLast",
6262
"config": {
6363
"warmup_time_ns": null,
6464
"min_round_time_ns": null,
@@ -69,7 +69,7 @@ expression: content
6969
},
7070
{
7171
"name": "BenchmarkAppendBytes::MultiBytesMiddle",
72-
"uri": "unknown::BenchmarkAppendBytes::MultiBytesMiddle",
72+
"uri": "internal/json/bytes_test.go::BenchmarkAppendBytes::MultiBytesMiddle",
7373
"config": {
7474
"warmup_time_ns": null,
7575
"min_round_time_ns": null,
@@ -80,7 +80,7 @@ expression: content
8080
},
8181
{
8282
"name": "BenchmarkAppendBytes::NoEncoding",
83-
"uri": "unknown::BenchmarkAppendBytes::NoEncoding",
83+
"uri": "internal/json/bytes_test.go::BenchmarkAppendBytes::NoEncoding",
8484
"config": {
8585
"warmup_time_ns": null,
8686
"min_round_time_ns": null,
@@ -91,7 +91,7 @@ expression: content
9191
},
9292
{
9393
"name": "BenchmarkAppendString::EncodingFirst",
94-
"uri": "unknown::BenchmarkAppendString::EncodingFirst",
94+
"uri": "internal/json/string_test.go::BenchmarkAppendString::EncodingFirst",
9595
"config": {
9696
"warmup_time_ns": null,
9797
"min_round_time_ns": null,
@@ -102,7 +102,7 @@ expression: content
102102
},
103103
{
104104
"name": "BenchmarkAppendString::EncodingLast",
105-
"uri": "unknown::BenchmarkAppendString::EncodingLast",
105+
"uri": "internal/json/string_test.go::BenchmarkAppendString::EncodingLast",
106106
"config": {
107107
"warmup_time_ns": null,
108108
"min_round_time_ns": null,
@@ -113,7 +113,7 @@ expression: content
113113
},
114114
{
115115
"name": "BenchmarkAppendString::EncodingMiddle",
116-
"uri": "unknown::BenchmarkAppendString::EncodingMiddle",
116+
"uri": "internal/json/string_test.go::BenchmarkAppendString::EncodingMiddle",
117117
"config": {
118118
"warmup_time_ns": null,
119119
"min_round_time_ns": null,
@@ -124,7 +124,7 @@ expression: content
124124
},
125125
{
126126
"name": "BenchmarkAppendString::MultiBytesFirst",
127-
"uri": "unknown::BenchmarkAppendString::MultiBytesFirst",
127+
"uri": "internal/json/string_test.go::BenchmarkAppendString::MultiBytesFirst",
128128
"config": {
129129
"warmup_time_ns": null,
130130
"min_round_time_ns": null,
@@ -135,7 +135,7 @@ expression: content
135135
},
136136
{
137137
"name": "BenchmarkAppendString::MultiBytesLast",
138-
"uri": "unknown::BenchmarkAppendString::MultiBytesLast",
138+
"uri": "internal/json/string_test.go::BenchmarkAppendString::MultiBytesLast",
139139
"config": {
140140
"warmup_time_ns": null,
141141
"min_round_time_ns": null,
@@ -146,7 +146,7 @@ expression: content
146146
},
147147
{
148148
"name": "BenchmarkAppendString::MultiBytesMiddle",
149-
"uri": "unknown::BenchmarkAppendString::MultiBytesMiddle",
149+
"uri": "internal/json/string_test.go::BenchmarkAppendString::MultiBytesMiddle",
150150
"config": {
151151
"warmup_time_ns": null,
152152
"min_round_time_ns": null,
@@ -157,7 +157,7 @@ expression: content
157157
},
158158
{
159159
"name": "BenchmarkAppendString::NoEncoding",
160-
"uri": "unknown::BenchmarkAppendString::NoEncoding",
160+
"uri": "internal/json/string_test.go::BenchmarkAppendString::NoEncoding",
161161
"config": {
162162
"warmup_time_ns": null,
163163
"min_round_time_ns": null,

0 commit comments

Comments
 (0)