Skip to content

Commit

Permalink
testsuite exists returns an error
Browse files Browse the repository at this point in the history
  • Loading branch information
awalterschulze committed Jan 14, 2025
1 parent d2af3ce commit 3a4d7d0
Show file tree
Hide file tree
Showing 9 changed files with 26 additions and 20 deletions.
4 changes: 2 additions & 2 deletions validator/auto/bench_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ import (
)

func BenchmarkSuite(b *testing.B) {
if !testsuite.BenchSuiteExists() {
b.Skip("benchsuite not available")
if err := testsuite.BenchSuiteExists(); err != nil {
b.Fatal(err)
}
benches, err := testsuite.ReadBenchmarkSuite()
if err != nil {
Expand Down
4 changes: 2 additions & 2 deletions validator/auto/suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ import (
)

func TestSuite(t *testing.T) {
if !testsuite.TestSuiteExists() {
t.Skip("testsuite not avaliable")
if err := testsuite.TestSuiteExists(); err != nil {
t.Fatal(err)
}
tests, err := testsuite.ReadTestSuite()
if err != nil {
Expand Down
4 changes: 2 additions & 2 deletions validator/intern/bench_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ import (
)

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

func TestSuite(t *testing.T) {
if !testsuite.TestSuiteExists() {
t.Skip("testsuite not avaliable")
if err := testsuite.TestSuiteExists(); err != nil {
t.Fatal(err)
}
tests, err := testsuite.ReadTestSuite()
if err != nil {
Expand Down
4 changes: 2 additions & 2 deletions validator/interp/bench_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ import (
)

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

func TestSuite(t *testing.T) {
if !testsuite.TestSuiteExists() {
t.Skip("testsuite not avaliable")
if err := testsuite.TestSuiteExists(); err != nil {
t.Fatal(err)
}
tests, err := testsuite.ReadTestSuite()
if err != nil {
Expand Down
4 changes: 2 additions & 2 deletions validator/mem/bench_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ 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 !testsuite.BenchSuiteExists() {
b.Skip("benchsuite not available")
if err := testsuite.BenchSuiteExists(); err != nil {
b.Fatal(err)
}
benches, err := testsuite.ReadBenchmarkSuite()
if err != nil {
Expand Down
4 changes: 2 additions & 2 deletions validator/mem/suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ import (
)

func TestSuite(t *testing.T) {
if !testsuite.TestSuiteExists() {
t.Fatal("testsuite not avaliable")
if err := testsuite.TestSuiteExists(); err != nil {
t.Fatal(err)
}
tests, err := testsuite.ReadTestSuite()
if err != nil {
Expand Down
14 changes: 10 additions & 4 deletions validator/testsuite/files.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,18 @@ func init() {
benchpath = filepath.Join(gopath, "src/github.com/katydid/testsuite/validator/benches")
}

func TestSuiteExists() bool {
return exists(testpath)
func TestSuiteExists() error {
if exists(testpath) {
return nil
}
return fmt.Errorf("testsuite does not exist at %v", testpath)
}

func BenchSuiteExists() bool {
return exists(benchpath)
func BenchSuiteExists() error {
if exists(testpath) {
return nil
}
return fmt.Errorf("benchsuite does not exist at %v", testpath)
}

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

0 comments on commit 3a4d7d0

Please sign in to comment.