@@ -36,7 +36,7 @@ func bytesAllocated() uint64 {
36
36
37
37
func TestStdlib (t * testing.T ) {
38
38
if testing .Short () {
39
- t .Skip ("skipping in short mode; too slow (https://golang.org/issue/14113)" )
39
+ t .Skip ("skipping in short mode; too slow (https://golang.org/issue/14113)" ) // ~5s
40
40
}
41
41
testenv .NeedsTool (t , "go" )
42
42
@@ -81,20 +81,33 @@ func TestStdlib(t *testing.T) {
81
81
82
82
allFuncs := ssautil .AllFunctions (prog )
83
83
84
- // Check that all non-synthetic functions have distinct names.
85
- // Synthetic wrappers for exported methods should be distinct too,
86
- // except for unexported ones (explained at (*Function).RelString).
87
- byName := make (map [string ]* ssa.Function )
88
- for fn := range allFuncs {
89
- if fn .Synthetic == "" || ast .IsExported (fn .Name ()) {
90
- str := fn .String ()
91
- prev := byName [str ]
92
- byName [str ] = fn
93
- if prev != nil {
94
- t .Errorf ("%s: duplicate function named %s" ,
95
- prog .Fset .Position (fn .Pos ()), str )
96
- t .Errorf ("%s: (previously defined here)" ,
97
- prog .Fset .Position (prev .Pos ()))
84
+ // The assertion below is not valid if the program contains
85
+ // variants of the same package, such as the test variants
86
+ // (e.g. package p as compiled for test executable x) obtained
87
+ // when cfg.Tests=true. Profile-guided optimization may
88
+ // lead to similar variation for non-test executables.
89
+ //
90
+ // Ideally, the test would assert that all functions within
91
+ // each executable (more generally: within any singly rooted
92
+ // transitively closed subgraph of the import graph) have
93
+ // distinct names, but that isn't so easy to compute efficiently.
94
+ // Disabling for now.
95
+ if false {
96
+ // Check that all non-synthetic functions have distinct names.
97
+ // Synthetic wrappers for exported methods should be distinct too,
98
+ // except for unexported ones (explained at (*Function).RelString).
99
+ byName := make (map [string ]* ssa.Function )
100
+ for fn := range allFuncs {
101
+ if fn .Synthetic == "" || ast .IsExported (fn .Name ()) {
102
+ str := fn .String ()
103
+ prev := byName [str ]
104
+ byName [str ] = fn
105
+ if prev != nil {
106
+ t .Errorf ("%s: duplicate function named %s" ,
107
+ prog .Fset .Position (fn .Pos ()), str )
108
+ t .Errorf ("%s: (previously defined here)" ,
109
+ prog .Fset .Position (prev .Pos ()))
110
+ }
98
111
}
99
112
}
100
113
}
0 commit comments