Skip to content

Commit 99d6300

Browse files
committed
test: fix issue20014 for noopt builder
This test is currently overly sensitive to compiler optimizations, because inlining can affect the order in which cmd/link emits field references. The order doesn't actually matter though, so this CL just tweaks the test to sort the tracked fields before printing them. Updates #51734. Change-Id: I3b65ca265856b2e1102f40406d5ce34610c70d40 Reviewed-on: https://go-review.googlesource.com/c/go/+/406674 Run-TryBot: Matthew Dempsky <[email protected]> Reviewed-by: David Chase <[email protected]> TryBot-Result: Gopher Robot <[email protected]>
1 parent 6ec46f4 commit 99d6300

File tree

1 file changed

+9
-3
lines changed
  • test/fixedbugs/issue20014.dir

1 file changed

+9
-3
lines changed

test/fixedbugs/issue20014.dir/main.go

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
package main
66

77
import (
8+
"sort"
89
"strings"
910

1011
"issue20014.dir/a"
@@ -13,12 +14,17 @@ import (
1314
func main() {
1415
samePackage()
1516
crossPackage()
17+
1618
// Print fields registered with field tracking.
19+
var fields []string
1720
for _, line := range strings.Split(fieldTrackInfo, "\n") {
18-
if line == "" {
19-
continue
21+
if line != "" {
22+
fields = append(fields, strings.Split(line, "\t")[0])
2023
}
21-
println(strings.Split(line, "\t")[0])
24+
}
25+
sort.Strings(fields) // for stable output, regardless of optimizations
26+
for _, field := range fields {
27+
println(field)
2228
}
2329
}
2430

0 commit comments

Comments
 (0)