1
0
mirror of https://github.com/goreleaser/goreleaser.git synced 2025-02-01 13:07:49 +02:00

106 lines
2.1 KiB
Go
Raw Normal View History

package golang
2017-04-26 20:08:25 -03:00
import (
"fmt"
"testing"
"github.com/goreleaser/goreleaser/pkg/config"
2017-04-26 20:08:25 -03:00
"github.com/stretchr/testify/assert"
)
func TestAllBuildTargets(t *testing.T) {
2017-07-01 13:21:07 -03:00
var build = config.Build{
Goos: []string{
"linux",
"darwin",
"freebsd",
"openbsd",
2017-07-01 13:21:07 -03:00
},
Goarch: []string{
"386",
"amd64",
"arm",
"arm64",
},
Goarm: []string{
"6",
"7",
},
Ignore: []config.IgnoredBuild{
{
Goos: "darwin",
Goarch: "386",
}, {
Goos: "linux",
Goarch: "arm",
Goarm: "7",
}, {
Goos: "openbsd",
Goarch: "arm",
2017-04-26 20:08:25 -03:00
},
},
}
2018-01-21 22:44:06 -02:00
assert.Equal(t, []string{
"linux_386",
"linux_amd64",
"linux_arm_6",
"linux_arm64",
"darwin_amd64",
"freebsd_386",
"freebsd_amd64",
"freebsd_arm_6",
"freebsd_arm_7",
"openbsd_386",
"openbsd_amd64",
}, matrix(build))
2017-04-26 20:08:25 -03:00
}
2017-07-06 20:13:02 -03:00
func TestGoosGoarchCombos(t *testing.T) {
2017-04-26 20:08:25 -03:00
var platforms = []struct {
2017-07-06 20:13:02 -03:00
os string
arch string
valid bool
2017-04-26 20:08:25 -03:00
}{
2017-07-06 20:13:02 -03:00
// valid targets:
{"android", "arm", true},
{"darwin", "386", true},
{"darwin", "amd64", true},
{"dragonfly", "amd64", true},
{"freebsd", "386", true},
{"freebsd", "amd64", true},
{"freebsd", "arm", true},
{"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 01:04:03 -06:00
{"linux", "s390x", true},
2017-07-06 20:13:02 -03: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},
{"solaris", "amd64", true},
{"windows", "386", true},
{"windows", "amd64", true},
// invalid targets
{"darwin", "arm", false},
{"darwin", "arm64", false},
{"windows", "arm", false},
{"windows", "arm64", false},
2017-04-26 20:08:25 -03:00
}
for _, p := range platforms {
2017-07-06 20:13:02 -03:00
t.Run(fmt.Sprintf("%v %v valid=%v", p.os, p.arch, p.valid), func(t *testing.T) {
2018-01-21 22:44:06 -02:00
assert.Equal(t, p.valid, valid(target{p.os, p.arch, ""}))
2017-04-26 20:08:25 -03:00
})
}
}