Update to go1.23.3

This commit is contained in:
Vorapol Rinsatitnon
2024-11-09 19:25:36 +11:00
parent 998d564602
commit a95773b5a1
25 changed files with 685 additions and 151 deletions

View File

@@ -12,22 +12,29 @@ import (
"bytes"
"log"
"os/exec"
"runtime"
"strings"
)
func main() {
checkLinkOutput("", "-B argument must start with 0x")
// The cannot open file error indicates that the parsing of -B flag
// succeeded and it failed at a later step.
checkLinkOutput("0", "-B argument must start with 0x")
checkLinkOutput("0x", "usage")
checkLinkOutput("0x", "cannot open file nonexistent.o")
checkLinkOutput("0x0", "-B argument must have even number of digits")
checkLinkOutput("0x00", "usage")
checkLinkOutput("0x00", "cannot open file nonexistent.o")
checkLinkOutput("0xYZ", "-B argument contains invalid hex digit")
checkLinkOutput("0x"+strings.Repeat("00", 32), "usage")
checkLinkOutput("0x"+strings.Repeat("00", 33), "-B option too long (max 32 digits)")
maxLen := 32
if runtime.GOOS == "darwin" || runtime.GOOS == "ios" {
maxLen = 16
}
checkLinkOutput("0x"+strings.Repeat("00", maxLen), "cannot open file nonexistent.o")
checkLinkOutput("0x"+strings.Repeat("00", maxLen+1), "-B option too long")
}
func checkLinkOutput(buildid string, message string) {
cmd := exec.Command("go", "tool", "link", "-B", buildid)
cmd := exec.Command("go", "tool", "link", "-B", buildid, "nonexistent.o")
out, err := cmd.CombinedOutput()
if err == nil {
log.Fatalf("expected cmd/link to fail")
@@ -39,6 +46,6 @@ func checkLinkOutput(buildid string, message string) {
}
if !strings.Contains(firstLine, message) {
log.Fatalf("cmd/link output did not include expected message %q: %s", message, firstLine)
log.Fatalf("%s: cmd/link output did not include expected message %q: %s", buildid, message, firstLine)
}
}