Update linux-x86 Go prebuilts from ab/8921581
https://ci.android.com/builds/branches/aosp-build-tools-release/grid?head=8921581&tail=8921581
Update script: toolchain/go/update-prebuilts.sh
Test: Treehugger presubmit
Change-Id: Ieac5e31af3fa5d5e6122345d7e22913f1e187662
diff --git a/test/run.go b/test/run.go
index ae5afc7..b2902f1 100644
--- a/test/run.go
+++ b/test/run.go
@@ -14,6 +14,7 @@
"flag"
"fmt"
"go/build"
+ "go/build/constraint"
"hash/fnv"
"io"
"io/fs"
@@ -32,10 +33,6 @@
"unicode"
)
-// CompilerDefaultGLevel is the -G level used by default when not overridden by a
-// command-line flag
-const CompilerDefaultGLevel = 3
-
var (
verbose = flag.Bool("v", false, "verbose. if set, parallelism is set to 1.")
keep = flag.Bool("k", false, "keep. keep temporary directory.")
@@ -48,7 +45,6 @@
updateErrors = flag.Bool("update_errors", false, "update error messages in test file based on compiler output")
runoutputLimit = flag.Int("l", defaultRunOutputLimit(), "number of parallel runoutput tests to run")
force = flag.Bool("f", false, "ignore expected-failure test lists")
- generics = flag.String("G", defaultGLevels, "a comma-separated list of -G compiler flags to test with")
shard = flag.Int("shard", 0, "shard index to run. Only applicable if -shards is non-zero.")
shards = flag.Int("shards", 0, "number of shards. If 0, all tests are run. This is used by the continuous build.")
@@ -62,7 +58,7 @@
}
var env = func() (res envVars) {
- cmd := exec.Command("go", "env", "-json")
+ cmd := exec.Command(goTool(), "env", "-json")
stdout, err := cmd.StdoutPipe()
if err != nil {
log.Fatal("StdoutPipe:", err)
@@ -79,22 +75,10 @@
return
}()
-var unifiedEnabled, defaultGLevels = func() (bool, string) {
- // TODO(mdempsky): This will give false negatives if the unified
- // experiment is enabled by default, but presumably at that point we
- // won't need to disable tests for it anymore anyway.
- enabled := strings.Contains(","+env.GOEXPERIMENT+",", ",unified,")
-
- // Test both -G=0 and -G=3 on the longtest builders, to make sure we
- // don't accidentally break -G=0 mode until we're ready to remove it
- // completely. But elsewhere, testing -G=3 alone should be enough.
- glevels := "3"
- if strings.Contains(os.Getenv("GO_BUILDER_NAME"), "longtest") {
- glevels = "0,3"
- }
-
- return enabled, glevels
-}()
+// TODO(mdempsky): This will give false negatives if the unified
+// experiment is enabled by default, but presumably at that point we
+// won't need to disable tests for it anymore anyway.
+var unifiedEnabled = strings.Contains(","+env.GOEXPERIMENT+",", ",unified,")
// defaultAllCodeGen returns the default value of the -all_codegen
// flag. By default, we prefer to be fast (returning false), except on
@@ -132,15 +116,6 @@
func main() {
flag.Parse()
- var glevels []int
- for _, s := range strings.Split(*generics, ",") {
- glevel, err := strconv.Atoi(s)
- if err != nil {
- log.Fatalf("invalid -G flag: %v", err)
- }
- glevels = append(glevels, glevel)
- }
-
findExecCmd()
// Disable parallelism if printing or if using a simulator.
@@ -165,11 +140,11 @@
}
if fi, err := os.Stat(arg); err == nil && fi.IsDir() {
for _, baseGoFile := range goFiles(arg) {
- tests = append(tests, startTests(arg, baseGoFile, glevels)...)
+ tests = append(tests, startTest(arg, baseGoFile))
}
} else if strings.HasSuffix(arg, ".go") {
dir, file := filepath.Split(arg)
- tests = append(tests, startTests(dir, file, glevels)...)
+ tests = append(tests, startTest(dir, file))
} else {
log.Fatalf("can't yet deal with non-directory and non-go file %q", arg)
}
@@ -177,7 +152,7 @@
} else {
for _, dir := range dirs {
for _, baseGoFile := range goFiles(dir) {
- tests = append(tests, startTests(dir, baseGoFile, glevels)...)
+ tests = append(tests, startTest(dir, baseGoFile))
}
}
}
@@ -210,8 +185,7 @@
resCount[status]++
dt := fmt.Sprintf("%.3fs", test.dt.Seconds())
if status == "FAIL" {
- fmt.Printf("# go run run.go -G=%v %s\n%s\nFAIL\t%s\t%s\n",
- test.glevel,
+ fmt.Printf("# go run run.go -- %s\n%s\nFAIL\t%s\t%s\n",
path.Join(test.dir, test.gofile),
errStr, test.goFileName(), dt)
continue
@@ -281,7 +255,7 @@
type runCmd func(...string) ([]byte, error)
func compileFile(runcmd runCmd, longname string, flags []string) (out []byte, err error) {
- cmd := []string{goTool(), "tool", "compile", "-e"}
+ cmd := []string{goTool(), "tool", "compile", "-e", "-p=p"}
cmd = append(cmd, flags...)
if *linkshared {
cmd = append(cmd, "-dynlink", "-installsuffix=dynlink")
@@ -290,11 +264,13 @@
return runcmd(cmd...)
}
-func compileInDir(runcmd runCmd, dir string, flags []string, localImports bool, names ...string) (out []byte, err error) {
- cmd := []string{goTool(), "tool", "compile", "-e"}
- if localImports {
- // Set relative path for local imports and import search path to current dir.
- cmd = append(cmd, "-D", ".", "-I", ".")
+func compileInDir(runcmd runCmd, dir string, flags []string, pkgname string, names ...string) (out []byte, err error) {
+ cmd := []string{goTool(), "tool", "compile", "-e", "-D", "test", "-I", "."}
+ if pkgname == "main" {
+ cmd = append(cmd, "-p=main")
+ } else {
+ pkgname = path.Join("test", strings.TrimSuffix(names[0], ".go"))
+ cmd = append(cmd, "-o", pkgname+".a", "-p", pkgname)
}
cmd = append(cmd, flags...)
if *linkshared {
@@ -330,7 +306,6 @@
dir, gofile string
donec chan bool // closed when done
dt time.Duration
- glevel int // what -G level this test should use
src string
@@ -338,37 +313,31 @@
err error
// expectFail indicates whether the (overall) test recipe is
- // expected to fail under the current test configuration (e.g., -G=3
- // or GOEXPERIMENT=unified).
+ // expected to fail under the current test configuration (e.g.,
+ // GOEXPERIMENT=unified).
expectFail bool
}
// initExpectFail initializes t.expectFail based on the build+test
// configuration.
-func (t *test) initExpectFail(hasGFlag bool) {
+func (t *test) initExpectFail() {
if *force {
return
}
- var failureSets []map[string]bool
+ failureSets := []map[string]bool{types2Failures}
- if t.glevel == 0 && !hasGFlag && !unifiedEnabled {
- failureSets = append(failureSets, g0Failures)
+ // Note: gccgo supports more 32-bit architectures than this, but
+ // hopefully the 32-bit failures are fixed before this matters.
+ switch goarch {
+ case "386", "arm", "mips", "mipsle":
+ failureSets = append(failureSets, types2Failures32Bit)
+ }
+
+ if unifiedEnabled {
+ failureSets = append(failureSets, unifiedFailures)
} else {
- failureSets = append(failureSets, types2Failures)
-
- // Note: gccgo supports more 32-bit architectures than this, but
- // hopefully the 32-bit failures are fixed before this matters.
- switch goarch {
- case "386", "arm", "mips", "mipsle":
- failureSets = append(failureSets, types2Failures32Bit)
- }
-
- if unifiedEnabled {
- failureSets = append(failureSets, unifiedFailures)
- } else {
- failureSets = append(failureSets, g3Failures)
- }
+ failureSets = append(failureSets, go118Failures)
}
filename := strings.Replace(t.goFileName(), "\\", "/", -1) // goFileName() uses \ on Windows
@@ -381,27 +350,22 @@
}
}
-func startTests(dir, gofile string, glevels []int) []*test {
- tests := make([]*test, len(glevels))
- for i, glevel := range glevels {
- t := &test{
- dir: dir,
- gofile: gofile,
- glevel: glevel,
- donec: make(chan bool, 1),
- }
- if toRun == nil {
- toRun = make(chan *test, maxTests)
- go runTests()
- }
- select {
- case toRun <- t:
- default:
- panic("toRun buffer size (maxTests) is too small")
- }
- tests[i] = t
+func startTest(dir, gofile string) *test {
+ t := &test{
+ dir: dir,
+ gofile: gofile,
+ donec: make(chan bool, 1),
}
- return tests
+ if toRun == nil {
+ toRun = make(chan *test, maxTests)
+ go runTests()
+ }
+ select {
+ case toRun <- t:
+ default:
+ panic("toRun buffer size (maxTests) is too small")
+ }
+ return t
}
// runTests runs tests in parallel, but respecting the order they
@@ -454,28 +418,33 @@
return pkgname[1], nil
}
+type goDirPkg struct {
+ name string
+ files []string
+}
+
// If singlefilepkgs is set, each file is considered a separate package
// even if the package names are the same.
-func goDirPackages(longdir string, singlefilepkgs bool) ([][]string, error) {
+func goDirPackages(longdir string, singlefilepkgs bool) ([]*goDirPkg, error) {
files, err := goDirFiles(longdir)
if err != nil {
return nil, err
}
- var pkgs [][]string
- m := make(map[string]int)
+ var pkgs []*goDirPkg
+ m := make(map[string]*goDirPkg)
for _, file := range files {
name := file.Name()
pkgname, err := getPackageNameFromSource(filepath.Join(longdir, name))
if err != nil {
log.Fatal(err)
}
- i, ok := m[pkgname]
+ p, ok := m[pkgname]
if singlefilepkgs || !ok {
- i = len(pkgs)
- pkgs = append(pkgs, nil)
- m[pkgname] = i
+ p = &goDirPkg{name: pkgname}
+ pkgs = append(pkgs, p)
+ m[pkgname] = p
}
- pkgs[i] = append(pkgs[i], name)
+ p.files = append(p.files, name)
}
return pkgs, nil
}
@@ -494,40 +463,24 @@
return true, ""
}
for _, line := range strings.Split(src, "\n") {
- line = strings.TrimSpace(line)
- if strings.HasPrefix(line, "//") {
- line = line[2:]
- } else {
- continue
- }
- line = strings.TrimSpace(line)
- if len(line) == 0 || line[0] != '+' {
- continue
- }
- gcFlags := os.Getenv("GO_GCFLAGS")
- ctxt := &context{
- GOOS: goos,
- GOARCH: goarch,
- cgoEnabled: cgoEnabled,
- noOptEnv: strings.Contains(gcFlags, "-N") || strings.Contains(gcFlags, "-l"),
+ if strings.HasPrefix(line, "package ") {
+ break
}
- words := strings.Fields(line)
- if words[0] == "+build" {
- ok := false
- for _, word := range words[1:] {
- if ctxt.match(word) {
- ok = true
- break
- }
+ if expr, err := constraint.Parse(line); err == nil {
+ gcFlags := os.Getenv("GO_GCFLAGS")
+ ctxt := &context{
+ GOOS: goos,
+ GOARCH: goarch,
+ cgoEnabled: cgoEnabled,
+ noOptEnv: strings.Contains(gcFlags, "-N") || strings.Contains(gcFlags, "-l"),
}
- if !ok {
- // no matching tag found.
+
+ if !expr.Eval(ctxt.match) {
return false, line
}
}
}
- // no build tags
return true, ""
}
@@ -535,16 +488,6 @@
if name == "" {
return false
}
- if first, rest, ok := strings.Cut(name, ","); ok {
- // comma-separated list
- return ctxt.match(first) && ctxt.match(rest)
- }
- if strings.HasPrefix(name, "!!") { // bad syntax, reject always
- return false
- }
- if strings.HasPrefix(name, "!") { // negation
- return len(name) > 1 && !ctxt.match(name[1:])
- }
// Tags must be letters, digits, underscores or dots.
// Unlike in Go identifiers, all digits are fine (e.g., "386").
@@ -589,15 +532,11 @@
// or else the commands will rebuild any needed packages (like runtime)
// over and over.
func (t *test) goGcflags() string {
- flags := os.Getenv("GO_GCFLAGS")
- if t.glevel != CompilerDefaultGLevel {
- flags = fmt.Sprintf("%s -G=%v", flags, t.glevel)
- }
- return "-gcflags=all=" + flags
+ return "-gcflags=all=" + os.Getenv("GO_GCFLAGS")
}
func (t *test) goGcflagsIsEmpty() bool {
- return "" == os.Getenv("GO_GCFLAGS") && t.glevel == CompilerDefaultGLevel
+ return "" == os.Getenv("GO_GCFLAGS")
}
var errTimeout = errors.New("command exceeded time limit")
@@ -650,8 +589,6 @@
wantError := false
wantAuto := false
singlefilepkgs := false
- setpkgpaths := false
- localImports := true
f, err := splitQuoted(action)
if err != nil {
t.err = fmt.Errorf("invalid test recipe: %v", err)
@@ -695,14 +632,6 @@
wantError = false
case "-s":
singlefilepkgs = true
- case "-P":
- setpkgpaths = true
- case "-n":
- // Do not set relative path for local imports to current dir,
- // e.g. do not pass -D . -I . to the compiler.
- // Used in fixedbugs/bug345.go to allow compilation and import of local pkg.
- // See golang.org/issue/25635
- localImports = false
case "-t": // timeout in seconds
args = args[1:]
var err error
@@ -744,60 +673,7 @@
}
}
- type Tool int
-
- const (
- _ Tool = iota
- AsmCheck
- Build
- Run
- Compile
- )
-
- // validForGLevel reports whether the current test is valid to run
- // at the specified -G level. If so, it may update flags as
- // necessary to test with -G.
- validForGLevel := func(tool Tool) bool {
- hasGFlag := false
- for _, flag := range flags {
- if strings.Contains(flag, "-G") {
- hasGFlag = true
- }
- }
-
- // In unified IR mode, run the test regardless of explicit -G flag.
- if !unifiedEnabled && hasGFlag && t.glevel != CompilerDefaultGLevel {
- // test provides explicit -G flag already; don't run again
- if *verbose {
- fmt.Printf("excl\t%s\n", t.goFileName())
- }
- return false
- }
-
- t.initExpectFail(hasGFlag)
-
- switch tool {
- case Build, Run:
- // ok; handled in goGcflags
-
- case Compile:
- if !hasGFlag {
- flags = append(flags, fmt.Sprintf("-G=%v", t.glevel))
- }
-
- default:
- if t.glevel != CompilerDefaultGLevel {
- // we don't know how to add -G for this test yet
- if *verbose {
- fmt.Printf("excl\t%s\n", t.goFileName())
- }
- return false
- }
- }
-
- return true
- }
-
+ t.initExpectFail()
t.makeTempDir()
if !*keep {
defer os.RemoveAll(t.tempDir)
@@ -834,6 +710,22 @@
if tempDirIsGOPATH {
cmd.Env = append(cmd.Env, "GOPATH="+t.tempDir)
}
+ // Put the bin directory of the GOROOT that built this program
+ // first in the path. This ensures that tests that use the "go"
+ // tool use the same one that built this program. This ensures
+ // that if you do "../bin/go run run.go" in this directory, all
+ // the tests that start subprocesses that "go tool compile" or
+ // whatever, use ../bin/go as their go tool, not whatever happens
+ // to be first in the user's path.
+ path := os.Getenv("PATH")
+ newdir := filepath.Join(runtime.GOROOT(), "bin")
+ if path != "" {
+ path = newdir + string(filepath.ListSeparator) + path
+ } else {
+ path = newdir
+ }
+ cmd.Env = append(cmd.Env, "PATH="+path)
+
cmd.Env = append(cmd.Env, runenv...)
var err error
@@ -881,10 +773,6 @@
t.err = fmt.Errorf("unimplemented action %q", action)
case "asmcheck":
- if !validForGLevel(AsmCheck) {
- return
- }
-
// Compile Go file and match the generated assembly
// against a set of regexps in comments.
ops := t.wantedAsmOpcodes(long)
@@ -939,15 +827,11 @@
return
case "errorcheck":
- if !validForGLevel(Compile) {
- return
- }
-
// Compile Go file.
// Fail if wantError is true and compilation was successful and vice versa.
// Match errors produced by gc against errors in comments.
// TODO(gri) remove need for -C (disable printing of columns in error messages)
- cmdline := []string{goTool(), "tool", "compile", "-d=panic", "-C", "-e", "-o", "a.o"}
+ cmdline := []string{goTool(), "tool", "compile", "-p=p", "-d=panic", "-C", "-e", "-o", "a.o"}
// No need to add -dynlink even if linkshared if we're just checking for errors...
cmdline = append(cmdline, flags...)
cmdline = append(cmdline, long)
@@ -973,18 +857,10 @@
t.err = t.errorCheck(string(out), wantAuto, long, t.gofile)
case "compile":
- if !validForGLevel(Compile) {
- return
- }
-
// Compile Go file.
_, t.err = compileFile(runcmd, long, flags)
case "compiledir":
- if !validForGLevel(Compile) {
- return
- }
-
// Compile all files in the directory as packages in lexicographic order.
longdir := filepath.Join(cwd, t.goDirName())
pkgs, err := goDirPackages(longdir, singlefilepkgs)
@@ -992,18 +868,14 @@
t.err = err
return
}
- for _, gofiles := range pkgs {
- _, t.err = compileInDir(runcmd, longdir, flags, localImports, gofiles...)
+ for _, pkg := range pkgs {
+ _, t.err = compileInDir(runcmd, longdir, flags, pkg.name, pkg.files...)
if t.err != nil {
return
}
}
case "errorcheckdir", "errorcheckandrundir":
- if !validForGLevel(Compile) {
- return
- }
-
flags = append(flags, "-d=panic")
// Compile and errorCheck all files in the directory as packages in lexicographic order.
// If errorcheckdir and wantError, compilation of the last package must fail.
@@ -1020,8 +892,8 @@
// Preceding pkg must return an error from compileInDir.
errPkg--
}
- for i, gofiles := range pkgs {
- out, err := compileInDir(runcmd, longdir, flags, localImports, gofiles...)
+ for i, pkg := range pkgs {
+ out, err := compileInDir(runcmd, longdir, flags, pkg.name, pkg.files...)
if i == errPkg {
if wantError && err == nil {
t.err = fmt.Errorf("compilation succeeded unexpectedly\n%s", out)
@@ -1035,7 +907,7 @@
return
}
var fullshort []string
- for _, name := range gofiles {
+ for _, name := range pkg.files {
fullshort = append(fullshort, filepath.Join(longdir, name), name)
}
t.err = t.errorCheck(string(out), wantAuto, fullshort...)
@@ -1049,10 +921,6 @@
fallthrough
case "rundir":
- if !validForGLevel(Run) {
- return
- }
-
// Compile all files in the directory as packages in lexicographic order.
// In case of errorcheckandrundir, ignore failed compilation of the package before the last.
// Link as if the last file is the main package, run it.
@@ -1073,18 +941,8 @@
}
}
- for i, gofiles := range pkgs {
- pflags := []string{}
- pflags = append(pflags, flags...)
- if setpkgpaths {
- fp := filepath.Join(longdir, gofiles[0])
- pkgname, err := getPackageNameFromSource(fp)
- if err != nil {
- log.Fatal(err)
- }
- pflags = append(pflags, "-p", pkgname)
- }
- _, err := compileInDir(runcmd, longdir, pflags, localImports, gofiles...)
+ for i, pkg := range pkgs {
+ _, err := compileInDir(runcmd, longdir, flags, pkg.name, pkg.files...)
// Allow this package compilation fail based on conditions below;
// its errors were checked in previous case.
if err != nil && !(wantError && action == "errorcheckandrundir" && i == len(pkgs)-2) {
@@ -1092,7 +950,7 @@
return
}
if i == len(pkgs)-1 {
- err = linkFile(runcmd, gofiles[0], ldflags)
+ err = linkFile(runcmd, pkg.files[0], ldflags)
if err != nil {
t.err = err
return
@@ -1111,10 +969,6 @@
}
case "runindir":
- if !validForGLevel(Run) {
- return
- }
-
// Make a shallow copy of t.goDirName() in its own module and GOPATH, and
// run "go run ." in it. The module path (and hence import path prefix) of
// the copy is equal to the basename of the source directory.
@@ -1154,21 +1008,16 @@
t.checkExpectedOutput(out)
case "build":
- if !validForGLevel(Build) {
- return
- }
-
// Build Go file.
- _, err := runcmd(goTool(), "build", t.goGcflags(), "-o", "a.exe", long)
+ cmd := []string{goTool(), "build", t.goGcflags()}
+ cmd = append(cmd, flags...)
+ cmd = append(cmd, "-o", "a.exe", long)
+ _, err := runcmd(cmd...)
if err != nil {
t.err = err
}
case "builddir", "buildrundir":
- if !validForGLevel(Build) {
- return
- }
-
// Build an executable from all the .go and .s files in a subdirectory.
// Run it and verify its output in the buildrundir case.
longdir := filepath.Join(cwd, t.goDirName())
@@ -1194,7 +1043,7 @@
t.err = fmt.Errorf("write empty go_asm.h: %s", err)
return
}
- cmd := []string{goTool(), "tool", "asm", "-gensymabis", "-o", "symabis"}
+ cmd := []string{goTool(), "tool", "asm", "-p=main", "-gensymabis", "-o", "symabis"}
cmd = append(cmd, asms...)
_, err = runcmd(cmd...)
if err != nil {
@@ -1203,7 +1052,7 @@
}
}
var objs []string
- cmd := []string{goTool(), "tool", "compile", "-e", "-D", ".", "-I", ".", "-o", "go.o"}
+ cmd := []string{goTool(), "tool", "compile", "-p=main", "-e", "-D", ".", "-I", ".", "-o", "go.o"}
if len(asms) > 0 {
cmd = append(cmd, "-asmhdr", "go_asm.h", "-symabis", "symabis")
}
@@ -1215,7 +1064,7 @@
}
objs = append(objs, "go.o")
if len(asms) > 0 {
- cmd = []string{goTool(), "tool", "asm", "-e", "-I", ".", "-o", "asm.o"}
+ cmd = []string{goTool(), "tool", "asm", "-p=main", "-e", "-I", ".", "-o", "asm.o"}
cmd = append(cmd, asms...)
_, err = runcmd(cmd...)
if err != nil {
@@ -1248,10 +1097,6 @@
}
case "buildrun":
- if !validForGLevel(Build) {
- return
- }
-
// Build an executable from Go file, then run it, verify its output.
// Useful for timeout tests where failure mode is infinite loop.
// TODO: not supported on NaCl
@@ -1277,10 +1122,6 @@
t.checkExpectedOutput(out)
case "run":
- if !validForGLevel(Run) {
- return
- }
-
// Run Go file if no special go command flags are provided;
// otherwise build an executable and run it.
// Verify the output.
@@ -1296,7 +1137,7 @@
// Because we run lots of trivial test programs,
// the time adds up.
pkg := filepath.Join(t.tempDir, "pkg.a")
- if _, err := runcmd(goTool(), "tool", "compile", "-o", pkg, t.goFileName()); err != nil {
+ if _, err := runcmd(goTool(), "tool", "compile", "-p=main", "-o", pkg, t.goFileName()); err != nil {
t.err = err
return
}
@@ -1324,10 +1165,6 @@
t.checkExpectedOutput(out)
case "runoutput":
- if !validForGLevel(Run) {
- return
- }
-
// Run Go file and write its output into temporary Go file.
// Run generated Go file and verify its output.
rungatec <- true
@@ -1363,10 +1200,6 @@
t.checkExpectedOutput(out)
case "errorcheckoutput":
- if !validForGLevel(Compile) {
- return
- }
-
// Run Go file and write its output into temporary Go file.
// Compile and errorCheck generated Go file.
runInDir = ""
@@ -1386,7 +1219,7 @@
t.err = fmt.Errorf("write tempfile:%s", err)
return
}
- cmdline := []string{goTool(), "tool", "compile", "-d=panic", "-e", "-o", "a.o"}
+ cmdline := []string{goTool(), "tool", "compile", "-p=p", "-d=panic", "-e", "-o", "a.o"}
cmdline = append(cmdline, flags...)
cmdline = append(cmdline, tfile)
out, err = runcmd(cmdline...)
@@ -1436,6 +1269,10 @@
if *keep {
log.Printf("Temporary directory is %s", t.tempDir)
}
+ err = os.Mkdir(filepath.Join(t.tempDir, "test"), 0o755)
+ if err != nil {
+ log.Fatal(err)
+ }
}
// checkExpectedOutput compares the output from compiling and/or running with the contents
@@ -1764,6 +1601,7 @@
"amd64": {"GOAMD64", "v1", "v2", "v3", "v4"},
"arm": {"GOARM", "5", "6", "7"},
"arm64": {},
+ "loong64": {},
"mips": {"GOMIPS", "hardfloat", "softfloat"},
"mips64": {"GOMIPS64", "hardfloat", "softfloat"},
"ppc64": {"GOPPC64", "power8", "power9"},
@@ -2118,25 +1956,20 @@
})
}
-// The following is temporary scaffolding to get types2 typechecker
-// up and running against the existing test cases. The explicitly
-// listed files don't pass yet, usually because the error messages
-// are slightly different (this list is not complete). Any errorcheck
-// tests that require output from analysis phases past initial type-
-// checking are also excluded since these phases are not running yet.
-// We can get rid of this code once types2 is fully plugged in.
+// The following sets of files are excluded from testing depending on configuration.
+// The types2Failures(32Bit) files pass with the 1.17 compiler but don't pass with
+// the 1.18 compiler using the new types2 type checker, or pass with sub-optimal
+// error(s).
-// List of files that the compiler cannot errorcheck with the new typechecker (compiler -G option).
-// Temporary scaffolding until we pass all the tests at which point this map can be removed.
+// List of files that the compiler cannot errorcheck with the new typechecker (types2).
var types2Failures = setOf(
"notinheap.go", // types2 doesn't report errors about conversions that are invalid due to //go:notinheap
"shift1.go", // types2 reports two new errors which are probably not right
"fixedbugs/issue10700.go", // types2 should give hint about ptr to interface
"fixedbugs/issue18331.go", // missing error about misuse of //go:noescape (irgen needs code from noder)
"fixedbugs/issue18419.go", // types2 reports no field or method member, but should say unexported
- "fixedbugs/issue20233.go", // types2 reports two instead of one error (pref: -G=0)
- "fixedbugs/issue20245.go", // types2 reports two instead of one error (pref: -G=0)
- "fixedbugs/issue28268.go", // types2 reports follow-on errors (pref: -G=0)
+ "fixedbugs/issue20233.go", // types2 reports two instead of one error (preference: 1.17 compiler)
+ "fixedbugs/issue20245.go", // types2 reports two instead of one error (preference: 1.17 compiler)
"fixedbugs/issue31053.go", // types2 reports "unknown field" instead of "cannot refer to unexported field"
)
@@ -2146,14 +1979,16 @@
"fixedbugs/issue23305.go", // large untyped int passed to println (32-bit)
)
-var g3Failures = setOf(
- "typeparam/nested.go", // -G=3 doesn't support function-local types with generics
+var go118Failures = setOf(
+ "typeparam/nested.go", // 1.18 compiler doesn't support function-local types with generics
+ "typeparam/issue51521.go", // 1.18 compiler produces bad panic message and link error
)
-// In all of these cases, -G=0 reports reasonable errors, but either -G=0 or types2
-// report extra errors, so we can't match correctly on both. We now set the patterns
-// to match correctly on all the types2 errors.
-var g0Failures = setOf(
+// In all of these cases, the 1.17 compiler reports reasonable errors, but either the
+// 1.17 or 1.18 compiler report extra errors, so we can't match correctly on both. We
+// now set the patterns to match correctly on all the 1.18 errors.
+// This list remains here just as a reference and for comparison - these files all pass.
+var _ = setOf(
"import1.go", // types2 reports extra errors
"initializerr.go", // types2 reports extra error
"typecheck.go", // types2 reports extra error at function call
@@ -2186,12 +2021,6 @@
"fixedbugs/issue42058b.go", // unified IR doesn't report channel element too large
"fixedbugs/issue49767.go", // unified IR doesn't report channel element too large
"fixedbugs/issue49814.go", // unified IR doesn't report array type too large
- "typeparam/issue50002.go", // pure stenciling leads to a static type assertion error
- "typeparam/typeswitch1.go", // duplicate case failure due to stenciling
- "typeparam/typeswitch2.go", // duplicate case failure due to stenciling
- "typeparam/typeswitch3.go", // duplicate case failure due to stenciling
- "typeparam/typeswitch4.go", // duplicate case failure due to stenciling
- "typeparam/issue50552.go", // gives missing method for instantiated type
)
func setOf(keys ...string) map[string]bool {
@@ -2212,11 +2041,11 @@
//
// For example, the following string:
//
-// a b:"c d" 'e''f' "g\""
+// a b:"c d" 'e''f' "g\""
//
// Would be parsed as:
//
-// []string{"a", "b:c d", "ef", `g"`}
+// []string{"a", "b:c d", "ef", `g"`}
//
// [copied from src/go/build/build.go]
func splitQuoted(s string) (r []string, err error) {