Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

force benchmarks to run on testsuite #19

Merged
merged 1 commit into from
Jan 14, 2025
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
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
Loading