-
Notifications
You must be signed in to change notification settings - Fork 157
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
cmd/releasebot, cmd/release: add darwin-arm64 target for Go 1.16
For golang/go#42756. Change-Id: Ia28fb6878617715fb674ccfad0c5801c8925270b Reviewed-on: https://go-review.googlesource.com/c/build/+/278436 Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Alexander Rakoczy <alex@golang.org> Trust: Dmitri Shuralyov <dmitshur@golang.org>
- Loading branch information
Showing
3 changed files
with
152 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
// Copyright 2020 The Go Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style | ||
// license that can be found in the LICENSE file. | ||
|
||
package main | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/google/go-cmp/cmp" | ||
) | ||
|
||
func TestTargetSelectionPerGoVersion(t *testing.T) { | ||
targetNames := func(targets []Target) (names []string) { | ||
for _, t := range targets { | ||
names = append(names, t.Name) | ||
} | ||
return names | ||
} | ||
|
||
for _, tc := range []struct { | ||
goVer []string // Go versions to test. | ||
want []string // Expected release targets. | ||
}{ | ||
{ | ||
goVer: []string{"go1.16beta1", "go1.16rc1", "go1.16", "go1.16.1"}, | ||
want: []string{ | ||
"src", | ||
"linux-386", | ||
"linux-armv6l", | ||
"linux-amd64", | ||
"linux-arm64", | ||
"freebsd-386", | ||
"freebsd-amd64", | ||
"windows-386", | ||
"windows-amd64", | ||
"darwin-amd64", | ||
"darwin-arm64", // New to Go 1.16. | ||
"linux-s390x", | ||
"linux-ppc64le", | ||
"linux-amd64-longtest", | ||
"windows-amd64-longtest", | ||
}, | ||
}, | ||
{ | ||
goVer: []string{"go1.15.7", "go1.14.14"}, | ||
want: []string{ | ||
"src", | ||
"linux-386", | ||
"linux-armv6l", | ||
"linux-amd64", | ||
"linux-arm64", | ||
"freebsd-386", | ||
"freebsd-amd64", | ||
"windows-386", | ||
"windows-amd64", | ||
"darwin-amd64", | ||
"linux-s390x", | ||
"linux-ppc64le", | ||
"linux-amd64-longtest", | ||
"windows-amd64-longtest", | ||
}, | ||
}, | ||
} { | ||
for _, goVer := range tc.goVer { | ||
t.Run(goVer, func(t *testing.T) { | ||
got := matchTargets(goVer) | ||
if diff := cmp.Diff(tc.want, targetNames(got)); diff != "" { | ||
t.Errorf("release target mismatch (-want +got):\n%s", diff) | ||
} | ||
}) | ||
} | ||
} | ||
} | ||
|
||
func TestAllQueriesSupported(t *testing.T) { | ||
for _, r := range releaseTargets { | ||
t.Run(r.Name, func(t *testing.T) { | ||
defer func() { | ||
if err := recover(); err != nil { | ||
t.Errorf("target %s uses an unsupported version query:\n%v", r.Name, err) | ||
} | ||
}() | ||
match(r.GoQuery, "go1.15.7") // Shouldn't panic for any r.GoQuery. | ||
}) | ||
} | ||
} |