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

skip race detector test on unsupported platform #642

Merged
merged 1 commit into from
Mar 15, 2020
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
3 changes: 3 additions & 0 deletions integration/flags_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,9 @@ var _ = Describe("Flags Specs", func() {
})

It("should run the race detector when told to", func() {
if !raceDetectorSupported() {
Skip("race detection is not supported")
}
session := startGinkgo(pathToTest, "--noColor", "--race")
Eventually(session).Should(gexec.Exit(types.GINKGO_FOCUS_EXIT_CODE))
output := string(session.Out.Contents())
Expand Down
13 changes: 13 additions & 0 deletions integration/integration_suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"os"
"os/exec"
"path/filepath"
"runtime"

. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
Expand Down Expand Up @@ -127,3 +128,15 @@ func removeSuccessfully(path string) {
err := os.RemoveAll(path)
Expect(err).NotTo(HaveOccurred())
}

func raceDetectorSupported() bool {
// https://github.com/golang/go/blob/1a370950/src/cmd/internal/sys/supported.go#L12
switch runtime.GOOS {
case "linux":
return runtime.GOARCH == "amd64" || runtime.GOARCH == "ppc64le" || runtime.GOARCH == "arm64"
case "darwin", "freebsd", "netbsd", "windows":
return runtime.GOARCH == "amd64"
default:
return false
}
}