Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions go-runner/src/builder/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ pub fn build_binary<P: AsRef<Path>>(runner_go_path: P) -> anyhow::Result<std::pa

let args = vec![
"build",
"-mod=mod",
"-tags=codspeed",
"-ldflags",
&ldflags,
Expand Down
1 change: 1 addition & 0 deletions go-runner/src/integration_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ fn assert_results_snapshots(profile_dir: &Path, project_name: &str) {
#[case::example_with_helper("example-with-helper")]
#[case::example_with_main("example-with-main")]
#[case::example_with_dot_go_folder("example-with-dot-go-folder")]
#[case::example_with_vendor("example-with-vendor")]
#[test_log::test]
fn test_build_and_run(#[case] project_name: &str) {
let project_dir = PathBuf::from(env!("CARGO_MANIFEST_DIR"))
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
---
source: go-runner/src/integration_tests.rs
expression: results
---
[
{
"creator": {
"name": "codspeed-go",
"version": "[version]",
"pid": "[pid]"
},
"instrument": {
"type": "walltime"
},
"benchmarks": [
{
"name": "BenchmarkAddWithAssert",
"uri": "go-runner/testdata/projects/example-with-vendor/main_test.go::BenchmarkAddWithAssert",
"config": {
"warmup_time_ns": null,
"min_round_time_ns": null,
"max_time_ns": null,
"max_rounds": null
},
"stats": "[stats]"
},
{
"name": "BenchmarkLocalFib",
"uri": "go-runner/testdata/projects/example-with-vendor/main_test.go::BenchmarkLocalFib",
"config": {
"warmup_time_ns": null,
"min_round_time_ns": null,
"max_time_ns": null,
"max_rounds": null
},
"stats": "[stats]"
}
]
}
]
11 changes: 11 additions & 0 deletions go-runner/testdata/projects/example-with-vendor/go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
module example-with-vendor

go 1.24.5

require github.com/stretchr/testify v1.10.0

require (
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
10 changes: 10 additions & 0 deletions go-runner/testdata/projects/example-with-vendor/go.sum
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA=
github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
14 changes: 14 additions & 0 deletions go-runner/testdata/projects/example-with-vendor/main.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package examplewithvendor

// LocalFib is a local implementation of Fibonacci
func LocalFib(n int) int {
if n <= 1 {
return n
}
return LocalFib(n-1) + LocalFib(n-2)
}

// Add is a simple addition function to use with testify assertions
func Add(a, b int) int {
return a + b
}
27 changes: 27 additions & 0 deletions go-runner/testdata/projects/example-with-vendor/main_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package examplewithvendor

import (
"testing"

"github.com/stretchr/testify/assert"
)

// TestAdd demonstrates using testify assert (vendored dependency)
func TestAdd(t *testing.T) {
assert.Equal(t, 5, Add(2, 3))
}

// BenchmarkLocalFib should be executed
func BenchmarkLocalFib(b *testing.B) {
for i := 0; i < b.N; i++ {
LocalFib(10)
}
}

// BenchmarkAddWithAssert uses testify assert in a benchmark
func BenchmarkAddWithAssert(b *testing.B) {
for i := 0; i < b.N; i++ {
result := Add(2, 3)
assert.Equal(b, 5, result)
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading