Skip to content

Commit

Permalink
force test suite to be run
Browse files Browse the repository at this point in the history
  • Loading branch information
awalterschulze committed Jan 14, 2025
1 parent ad0f960 commit f8ee49d
Show file tree
Hide file tree
Showing 10 changed files with 69 additions and 22 deletions.
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ checklicense:
install_protoc.sh

test:
go test ./...
TESTSUITE=MUST go test ./...

build:
go build ./...
Expand All @@ -38,7 +38,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=. ./...

clean:
go clean ./...
Expand Down
8 changes: 6 additions & 2 deletions testsuite/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 !testsuite.BenchSuiteExists() {
b.Skip("benchsuite not available")
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 testsuite/auto/suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,12 @@ import (
)

func TestSuite(t *testing.T) {
if !testsuite.TestSuiteExists() {
t.Skip("testsuite not avaliable")
exists, err := testsuite.TestSuiteExists()
if !exists {
if err != nil {
t.Fatal(err)
}
t.Skip()
}
tests, err := testsuite.ReadTestSuite()
if err != nil {
Expand Down
23 changes: 19 additions & 4 deletions testsuite/files.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,16 +39,31 @@ var benchpath string

func init() {
gopath := os.Getenv("GOPATH")
if gopath == "" {
gopath = "../../../../../../"
}
testpath = filepath.Join(gopath, "src/github.com/katydid/testsuite/validator/tests")
benchpath = filepath.Join(gopath, "src/github.com/katydid/testsuite/validator/benches")
}

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

func BenchSuiteExists() bool {
return exists(benchpath)
func BenchSuiteExists() (bool, error) {
if exists(testpath) {
return true, nil
}
if os.Getenv("TESTSUITE") == "MUST" {
return false, fmt.Errorf("testsuite 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
8 changes: 6 additions & 2 deletions testsuite/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 !testsuite.BenchSuiteExists() {
b.Skip("benchsuite not available")
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 testsuite/intern/suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,12 @@ import (
)

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

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

func TestSuite(t *testing.T) {
if !testsuite.TestSuiteExists() {
t.Skip("testsuite not avaliable")
exists, err := testsuite.TestSuiteExists()
if !exists {
if err != nil {
t.Fatal(err)
}
t.Skip()
}
tests, err := testsuite.ReadTestSuite()
if err != nil {
Expand Down

0 comments on commit f8ee49d

Please sign in to comment.