]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/go: test: do not put object files where later steps will find them
authorMichael Hudson-Doyle <michael.hudson@linaro.org>
Wed, 8 Jan 2014 04:53:16 +0000 (23:53 -0500)
committerRuss Cox <rsc@golang.org>
Wed, 8 Jan 2014 04:53:16 +0000 (23:53 -0500)
When recompiling a package whose basename is the name of a standard
package for testing with gccgo, a .o file with the basename of the
package being tested was being placed in the _test/ directory where the
compilation of the test binary then found it when looking for the
standard library package.

This change puts the object files in a separate directory.

Fixes #6793

R=golang-codereviews, dave, gobot, rsc, iant
CC=golang-codereviews
https://golang.org/cl/27650045

src/cmd/go/test.go

index 06ac9d206299dbae590c9e70144280d44cbc2a54..dfd24d836cdc84524d4f4d20675194ef6d35cdbe 100644 (file)
@@ -711,7 +711,7 @@ func (b *builder) test(p *Package) (buildAction, runAction, printAction *action,
 
        if ptest != p {
                a := b.action(modeBuild, modeBuild, ptest)
-               a.objdir = testDir + string(filepath.Separator)
+               a.objdir = testDir + string(filepath.Separator) + "_obj_test" + string(filepath.Separator)
                a.objpkg = ptestObj
                a.target = ptestObj
                a.link = false
@@ -719,7 +719,7 @@ func (b *builder) test(p *Package) (buildAction, runAction, printAction *action,
 
        if pxtest != nil {
                a := b.action(modeBuild, modeBuild, pxtest)
-               a.objdir = testDir + string(filepath.Separator)
+               a.objdir = testDir + string(filepath.Separator) + "_obj_xtest" + string(filepath.Separator)
                a.objpkg = buildToolchain.pkgpath(testDir, pxtest)
                a.target = a.objpkg
        }