AssertIsLinkedTo(t, "./bin/global", soname)
AssertHasRPath(t, "./bin/global", gorootInstallDir)
}
+
+// Run a test using -linkshared of an installed shared package.
+// Issue 26400.
+func TestTestInstalledShared(t *testing.T) {
+ goCmd(nil, "test", "-linkshared", "-test.short", "sync/atomic")
+}
stk.Pop()
aFmt := b.CompileAction(ModeBuild, depMode, p1)
- deps := []*Action{a1, aFmt}
+ var deps []*Action
+ if a1.buggyInstall {
+ // (*Builder).vet expects deps[0] to be the package
+ // and deps[1] to be "fmt". If we see buggyInstall
+ // here then a1 is an install of a shared library,
+ // and the real package is a1.Deps[0].
+ deps = []*Action{a1.Deps[0], aFmt, a1}
+ } else {
+ deps = []*Action{a1, aFmt}
+ }
for _, p1 := range load.PackageList(p.Internal.Imports) {
deps = append(deps, b.vetAction(mode, depMode, p1))
}
// Built-in packages like unsafe.
return a
}
- a1.needVet = true
+ deps[0].needVet = true
a.Func = (*Builder).vet
return a
})
// so the built target is not in the a1.Objdir tree that b.cleanup(a1) removes.
if a1.built == a.Target {
a.built = a.Target
- b.cleanup(a1)
+ if !a.buggyInstall {
+ b.cleanup(a1)
+ }
// Whether we're smart enough to avoid a complete rebuild
// depends on exactly what the staleness and rebuild algorithms
// are, as well as potentially the state of the Go build cache.
}
}
- defer b.cleanup(a1)
+ if !a.buggyInstall {
+ defer b.cleanup(a1)
+ }
return b.moveOrCopyFile(a.Target, a1.built, perm, false)
}