Upgrade to Go 1.22.1

Closes #12250
This commit is contained in:
Bjørn Erik Pedersen
2024-03-14 20:25:16 +01:00
parent b1f8676347
commit 57206e7274
10 changed files with 114 additions and 56 deletions

View File

@@ -6,6 +6,7 @@ package testenv
import (
"context"
"errors"
"fmt"
"os"
"os/exec"
@@ -60,6 +61,13 @@ func tryExec() error {
// may as well use the same path so that this branch can be tested without
// an ios environment.
if !testing.Testing() {
// This isn't a standard 'go test' binary, so we don't know how to
// self-exec in a way that should succeed without side effects.
// Just forget it.
return errors.New("can't probe for exec support with a non-test executable")
}
// We know that this is a test executable. We should be able to run it with a
// no-op flag to check for overall exec support.
exe, err := os.Executable()

View File

@@ -17,5 +17,5 @@ import (
var Sigquit = os.Kill
func syscallIsNotSupported(err error) bool {
return errors.Is(err, fs.ErrPermission)
return errors.Is(err, fs.ErrPermission) || errors.Is(err, errors.ErrUnsupported)
}

View File

@@ -54,8 +54,8 @@ func TestGoToolLocation(t *testing.T) {
}
}
// Modified by Hugo.
func TestHasGoBuild(t *testing.T) {
// Removed by Hugo.
}
func TestMustHaveExec(t *testing.T) {
@@ -73,7 +73,7 @@ func TestMustHaveExec(t *testing.T) {
t.Errorf("expected MustHaveExec to skip on %v", runtime.GOOS)
}
case "ios":
if b := testenv.Builder(); strings.HasSuffix(b, "-corellium") && !hasExec {
if b := testenv.Builder(); isCorelliumBuilder(b) && !hasExec {
// Most ios environments can't exec, but the corellium builder can.
t.Errorf("expected MustHaveExec not to skip on %v", b)
}
@@ -106,3 +106,23 @@ func TestCleanCmdEnvPWD(t *testing.T) {
}
t.Error("PWD not set in cmd.Env")
}
func isCorelliumBuilder(builderName string) bool {
// Support both the old infra's builder names and the LUCI builder names.
// The former's names are ad-hoc so we could maintain this invariant on
// the builder side. The latter's names are structured, and "corellium" will
// appear as a "host" suffix after the GOOS and GOARCH, which always begin
// with an underscore.
return strings.HasSuffix(builderName, "-corellium") || strings.Contains(builderName, "_corellium")
}
func isEmulatedBuilder(builderName string) bool {
// Support both the old infra's builder names and the LUCI builder names.
// The former's names are ad-hoc so we could maintain this invariant on
// the builder side. The latter's names are structured, and the signifier
// of emulation "emu" will appear as a "host" suffix after the GOOS and
// GOARCH because it modifies the run environment in such a way that it
// the target GOOS and GOARCH may not match the host. This suffix always
// begins with an underscore.
return strings.HasSuffix(builderName, "-emu") || strings.Contains(builderName, "_emu")
}

View File

@@ -35,7 +35,7 @@ func syscallIsNotSupported(err error) bool {
}
}
if errors.Is(err, fs.ErrPermission) {
if errors.Is(err, fs.ErrPermission) || errors.Is(err, errors.ErrUnsupported) {
return true
}