golang / go

The Go programming language
https://go.dev
BSD 3-Clause "New" or "Revised" License
123.09k stars 17.55k forks source link

cmd/dist: run all tests unless explicitly disabled on a platform #18503

Open mundaym opened 7 years ago

mundaym commented 7 years ago

Every now and again a test isn't enabled on a platform where it should be (for example: https://github.com/golang/go/commit/161cd34f788ee9c6b61565eb6f865434bc135306). A leading culprit of this is feature checks that only run a test if the GOOS/GOARCH combination is in a list:

pair := t.gohostos + "-" + t.goarch
switch (pair) {
case "android-arm", "darwin-arm", ...:
    // run test
default:
    // don't run test
}

If a GOOS/GOARCH combination isn't correctly added to one of the many lists like this, then the related tests simply won't run. This is not always obvious.

I think it would be good to refactor test.go so that it always defaults to running a test unless explicitly told not to for a given platform (preferably with an issue referencing the missing feature). This will make it harder to accidentally forget to enable a test.

bradfitz commented 7 years ago

SGTM

nilsmagnus commented 6 years ago

Is it ok if I have a look at this @mundaym ?

mundaym commented 6 years ago

@nilsmagnus Yep, feel free!