p.Target = ""
p.Internal.BuildInfo = nil
p.Internal.ForceLibrary = true
+ p.Internal.PGOProfile = preal.Internal.PGOProfile
}
// Update p.Internal.Imports to use test copies.
if p.Name == "main" && p != pmain && p != ptest {
split()
}
+ // Split and attach PGO information to test dependencies if preal
+ // is built with PGO.
+ if preal.Internal.PGOProfile != "" && p.Internal.PGOProfile == "" {
+ split()
+ }
}
// Do search to find cycle.
stderr 'compile.*-pgoprofile=.*b(/|\\\\)default\.pgo.*dep(/|\\\\)dep\.go'
! stderr 'compile.*-pgoprofile=.*nopgo(/|\\\\)nopgo_test\.go'
+# test-only dependencies also have profiles attached
+stderr 'compile.*-pgoprofile=.*a(/|\\\\)default\.pgo.*testdep(/|\\\\)testdep\.go'
+stderr 'compile.*-pgoprofile=.*b(/|\\\\)default\.pgo.*testdep(/|\\\\)testdep\.go'
+stderr 'compile.*-pgoprofile=.*a(/|\\\\)default\.pgo.*testdep2(/|\\\\)testdep2\.go'
+stderr 'compile.*-pgoprofile=.*b(/|\\\\)default\.pgo.*testdep2(/|\\\\)testdep2\.go'
+
# go list -deps prints packages built multiple times.
go list -pgo=auto -deps ./a ./b ./nopgo
stdout 'test/dep \[test/a\]'
-- a/a_test.go --
package main
import "testing"
+import _ "test/testdep"
func TestA(*testing.T) {}
-- a/default.pgo --
-- b/b.go --
-- b/b_test.go --
package main
import "testing"
+import _ "test/testdep"
func TestB(*testing.T) {}
-- b/default.pgo --
-- nopgo/nopgo.go --
package dep2
-- dep3/dep3.go --
package dep3
+-- testdep/testdep.go --
+package testdep
+import _ "test/testdep2"
+-- testdep2/testdep2.go --
+package testdep2