Skip to content

Commit

Permalink
force benchmarks to run on testsuite
Browse files Browse the repository at this point in the history
  • Loading branch information
awalterschulze committed Jan 14, 2025
1 parent 210f46e commit a58d3ad
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 12 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ install:
go install ./...

bench:
go test -test.v -test.run=XXX -test.bench=. ./...
TESTSUITE=MUST go test -test.v -test.run=XXX -test.bench=. ./...

vet:
go vet ./gen/...
Expand Down
8 changes: 6 additions & 2 deletions validator/auto/bench_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,12 @@ import (
)

func BenchmarkSuite(b *testing.B) {
if err := testsuite.BenchSuiteExists(); err != nil {
b.Fatal(err)
exists, err := testsuite.BenchSuiteExists()
if !exists {
if err != nil {
b.Fatal(err)
}
b.Skip()
}
benches, err := testsuite.ReadBenchmarkSuite()
if err != nil {
Expand Down
8 changes: 6 additions & 2 deletions validator/intern/bench_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,12 @@ import (
)

func BenchmarkSuite(b *testing.B) {
if err := testsuite.BenchSuiteExists(); err != nil {
b.Fatal(err)
exists, err := testsuite.BenchSuiteExists()
if !exists {
if err != nil {
b.Fatal(err)
}
b.Skip()
}
benches, err := testsuite.ReadBenchmarkSuite()
if err != nil {
Expand Down
8 changes: 6 additions & 2 deletions validator/interp/bench_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,12 @@ import (
)

func BenchmarkSuite(b *testing.B) {
if err := testsuite.BenchSuiteExists(); err != nil {
b.Fatal(err)
exists, err := testsuite.BenchSuiteExists()
if !exists {
if err != nil {
b.Fatal(err)
}
b.Skip()
}
benches, err := testsuite.ReadBenchmarkSuite()
if err != nil {
Expand Down
8 changes: 6 additions & 2 deletions validator/mem/bench_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,12 @@ import (
func BenchmarkSuite(b *testing.B) {
var bN = flag.Int("b.N", 0, "the number of times the benchmark function's target code must run")
flag.Parse()
if err := testsuite.BenchSuiteExists(); err != nil {
b.Fatal(err)
exists, err := testsuite.BenchSuiteExists()
if !exists {
if err != nil {
b.Fatal(err)
}
b.Skip()
}
benches, err := testsuite.ReadBenchmarkSuite()
if err != nil {
Expand Down
9 changes: 6 additions & 3 deletions validator/testsuite/files.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,14 @@ func TestSuiteExists() (bool, error) {
return false, nil
}

func BenchSuiteExists() error {
func BenchSuiteExists() (bool, error) {
if exists(testpath) {
return nil
return true, nil
}
if os.Getenv("TESTSUITE") == "MUST" {
return false, fmt.Errorf("testsuite does not exist at %v", testpath)
}
return fmt.Errorf("benchsuite does not exist at %v", testpath)
return false, fmt.Errorf("benchsuite does not exist at %v", testpath)
}

func getFolders(path string) (map[string][]string, error) {
Expand Down

0 comments on commit a58d3ad

Please sign in to comment.