Skip to content

Commit d668f58

Browse files
findleyrgopherbot
authored andcommitted
gopls/internal/regtest/marker: require cgo for issue59944.txt
This test is failing on the nocgo builders. Change-Id: I0f3577eee84d29154c9f0fab833b10502f049861 Reviewed-on: https://go-review.googlesource.com/c/tools/+/494176 Reviewed-by: Alan Donovan <[email protected]> Run-TryBot: Robert Findley <[email protected]> Auto-Submit: Robert Findley <[email protected]> TryBot-Result: Gopher Robot <[email protected]>
1 parent 005fa64 commit d668f58

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

gopls/internal/lsp/regtest/marker.go

+8-2
Original file line numberDiff line numberDiff line change
@@ -100,8 +100,9 @@ var update = flag.Bool("update", false, "if set, update test data during marker
100100
// There are three types of file within the test archive that are given special
101101
// treatment by the test runner:
102102
// - "flags": this file is treated as a whitespace-separated list of flags
103-
// that configure the MarkerTest instance. For example, -min_go=go1.18 sets
104-
// the minimum required Go version for the test.
103+
// that configure the MarkerTest instance. Supported flags:
104+
// -min_go=go1.18 sets the minimum Go version for the test;
105+
// -cgo requires that CGO_ENABLED is set and the cgo tool is available
105106
// TODO(rfindley): support flag values containing whitespace.
106107
// - "settings.json": this file is parsed as JSON, and used as the
107108
// session configuration (see gopls/doc/settings.md)
@@ -340,6 +341,9 @@ func RunMarkerTests(t *testing.T, dir string) {
340341
}
341342
testenv.NeedsGo1Point(t, go1point)
342343
}
344+
if test.cgo {
345+
testenv.NeedsTool(t, "cgo")
346+
}
343347
config := fake.EditorConfig{
344348
Settings: test.settings,
345349
Env: test.env,
@@ -553,13 +557,15 @@ type markerTest struct {
553557
flags []string
554558
// Parsed flags values.
555559
minGoVersion string
560+
cgo bool
556561
}
557562

558563
// flagSet returns the flagset used for parsing the special "flags" file in the
559564
// test archive.
560565
func (t *markerTest) flagSet() *flag.FlagSet {
561566
flags := flag.NewFlagSet(t.name, flag.ContinueOnError)
562567
flags.StringVar(&t.minGoVersion, "min_go", "", "if set, the minimum go1.X version required for this test")
568+
flags.BoolVar(&t.cgo, "cgo", false, "if set, requires cgo (both the cgo tool and CGO_ENABLED=1)")
563569
return flags
564570
}
565571

gopls/internal/regtest/marker/testdata/fixedbugs/issue59944.txt

+3
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ the methodset of its receiver type.
44

55
Adapted from the code in question from the issue.
66

7+
-- flags --
8+
-cgo
9+
710
-- go.mod --
811
module example.com
912

0 commit comments

Comments
 (0)