2018-01-22 03:37:39 +02:00
|
|
|
package golang
|
2017-04-27 01:08:25 +02:00
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
"testing"
|
|
|
|
|
2018-08-15 04:50:20 +02:00
|
|
|
"github.com/goreleaser/goreleaser/pkg/config"
|
2017-04-27 01:08:25 +02:00
|
|
|
"github.com/stretchr/testify/assert"
|
|
|
|
)
|
|
|
|
|
|
|
|
func TestAllBuildTargets(t *testing.T) {
|
2017-07-01 18:21:07 +02:00
|
|
|
var build = config.Build{
|
|
|
|
Goos: []string{
|
|
|
|
"linux",
|
|
|
|
"darwin",
|
|
|
|
"freebsd",
|
2017-07-10 13:44:07 +02:00
|
|
|
"openbsd",
|
2019-10-01 21:00:44 +02:00
|
|
|
"js",
|
2017-07-01 18:21:07 +02:00
|
|
|
},
|
|
|
|
Goarch: []string{
|
|
|
|
"386",
|
|
|
|
"amd64",
|
|
|
|
"arm",
|
|
|
|
"arm64",
|
2019-10-01 21:00:44 +02:00
|
|
|
"wasm",
|
2020-01-26 19:36:00 +02:00
|
|
|
"mips",
|
|
|
|
"mips64",
|
|
|
|
"mipsle",
|
|
|
|
"mips64le",
|
2017-07-01 18:21:07 +02:00
|
|
|
},
|
|
|
|
Goarm: []string{
|
|
|
|
"6",
|
|
|
|
"7",
|
|
|
|
},
|
2020-01-26 19:36:00 +02:00
|
|
|
Gomips: []string{
|
|
|
|
"hardfloat",
|
|
|
|
"softfloat",
|
|
|
|
},
|
2017-07-01 18:21:07 +02:00
|
|
|
Ignore: []config.IgnoredBuild{
|
|
|
|
{
|
|
|
|
Goos: "darwin",
|
|
|
|
Goarch: "386",
|
|
|
|
}, {
|
|
|
|
Goos: "linux",
|
|
|
|
Goarch: "arm",
|
|
|
|
Goarm: "7",
|
2017-07-10 13:44:07 +02:00
|
|
|
}, {
|
|
|
|
Goos: "openbsd",
|
|
|
|
Goarch: "arm",
|
2020-01-26 19:36:00 +02:00
|
|
|
}, {
|
|
|
|
Goarch: "mips64",
|
|
|
|
Gomips: "hardfloat",
|
|
|
|
}, {
|
|
|
|
Goarch: "mips64le",
|
|
|
|
Gomips: "softfloat",
|
2017-04-27 01:08:25 +02:00
|
|
|
},
|
|
|
|
},
|
|
|
|
}
|
2018-01-22 02:44:06 +02:00
|
|
|
assert.Equal(t, []string{
|
|
|
|
"linux_386",
|
|
|
|
"linux_amd64",
|
|
|
|
"linux_arm_6",
|
|
|
|
"linux_arm64",
|
2020-01-26 19:36:00 +02:00
|
|
|
"linux_mips_hardfloat",
|
|
|
|
"linux_mips_softfloat",
|
|
|
|
"linux_mips64_softfloat",
|
|
|
|
"linux_mipsle_hardfloat",
|
|
|
|
"linux_mipsle_softfloat",
|
|
|
|
"linux_mips64le_hardfloat",
|
2018-01-22 02:44:06 +02:00
|
|
|
"darwin_amd64",
|
|
|
|
"freebsd_386",
|
|
|
|
"freebsd_amd64",
|
|
|
|
"freebsd_arm_6",
|
|
|
|
"freebsd_arm_7",
|
2020-03-04 21:01:57 +02:00
|
|
|
"freebsd_arm64",
|
2018-01-22 02:44:06 +02:00
|
|
|
"openbsd_386",
|
|
|
|
"openbsd_amd64",
|
2020-03-04 21:01:57 +02:00
|
|
|
"openbsd_arm64",
|
2019-10-01 21:00:44 +02:00
|
|
|
"js_wasm",
|
2018-01-22 03:37:39 +02:00
|
|
|
}, matrix(build))
|
2017-04-27 01:08:25 +02:00
|
|
|
}
|
|
|
|
|
2017-07-07 01:13:02 +02:00
|
|
|
func TestGoosGoarchCombos(t *testing.T) {
|
2017-04-27 01:08:25 +02:00
|
|
|
var platforms = []struct {
|
2017-07-07 01:13:02 +02:00
|
|
|
os string
|
|
|
|
arch string
|
|
|
|
valid bool
|
2017-04-27 01:08:25 +02:00
|
|
|
}{
|
2017-07-07 01:13:02 +02:00
|
|
|
// valid targets:
|
2019-10-01 21:25:13 +02:00
|
|
|
{"aix", "ppc64", true},
|
|
|
|
{"android", "386", true},
|
|
|
|
{"android", "amd64", true},
|
2017-07-07 01:13:02 +02:00
|
|
|
{"android", "arm", true},
|
2019-10-01 21:25:13 +02:00
|
|
|
{"android", "arm64", true},
|
2017-07-07 01:13:02 +02:00
|
|
|
{"darwin", "386", true},
|
|
|
|
{"darwin", "amd64", true},
|
|
|
|
{"dragonfly", "amd64", true},
|
|
|
|
{"freebsd", "386", true},
|
|
|
|
{"freebsd", "amd64", true},
|
|
|
|
{"freebsd", "arm", true},
|
2019-10-01 21:25:13 +02:00
|
|
|
{"illumos", "amd64", true},
|
2017-07-07 01:13:02 +02:00
|
|
|
{"linux", "386", true},
|
|
|
|
{"linux", "amd64", true},
|
|
|
|
{"linux", "arm", true},
|
|
|
|
{"linux", "arm64", true},
|
|
|
|
{"linux", "mips", true},
|
|
|
|
{"linux", "mipsle", true},
|
|
|
|
{"linux", "mips64", true},
|
|
|
|
{"linux", "mips64le", true},
|
|
|
|
{"linux", "ppc64", true},
|
|
|
|
{"linux", "ppc64le", true},
|
2017-07-26 09:04:03 +02:00
|
|
|
{"linux", "s390x", true},
|
2017-07-07 01:13:02 +02:00
|
|
|
{"netbsd", "386", true},
|
|
|
|
{"netbsd", "amd64", true},
|
|
|
|
{"netbsd", "arm", true},
|
|
|
|
{"openbsd", "386", true},
|
|
|
|
{"openbsd", "amd64", true},
|
|
|
|
{"openbsd", "arm", true},
|
|
|
|
{"plan9", "386", true},
|
|
|
|
{"plan9", "amd64", true},
|
2019-10-01 21:25:13 +02:00
|
|
|
{"plan9", "arm", true},
|
2017-07-07 01:13:02 +02:00
|
|
|
{"solaris", "amd64", true},
|
|
|
|
{"windows", "386", true},
|
|
|
|
{"windows", "amd64", true},
|
2019-10-01 21:00:44 +02:00
|
|
|
{"js", "wasm", true},
|
2017-07-07 01:13:02 +02:00
|
|
|
// invalid targets
|
|
|
|
{"darwin", "arm", false},
|
|
|
|
{"darwin", "arm64", false},
|
|
|
|
{"windows", "arm", false},
|
|
|
|
{"windows", "arm64", false},
|
2017-04-27 01:08:25 +02:00
|
|
|
}
|
|
|
|
for _, p := range platforms {
|
2017-07-07 01:13:02 +02:00
|
|
|
t.Run(fmt.Sprintf("%v %v valid=%v", p.os, p.arch, p.valid), func(t *testing.T) {
|
2020-01-26 19:36:00 +02:00
|
|
|
assert.Equal(t, p.valid, valid(target{p.os, p.arch, "", ""}))
|
2017-04-27 01:08:25 +02:00
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|