]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/dist: fix cgoTestSO on FreeBSD amd64 with GOHOSTARCH=386
authorJoel Sing <jsing@google.com>
Fri, 8 Jan 2016 12:22:12 +0000 (23:22 +1100)
committerBrad Fitzpatrick <bradfitz@golang.org>
Fri, 8 Jan 2016 17:00:53 +0000 (17:00 +0000)
The cgoTestSO test currently fails when run on FreeBSD amd64 with
GOHOSTARCH=386. This is due to it failing to find the shared object.

On FreeBSD 64-bit architectures, the linker for 32-bit objects
looks for a separate environment variable. Export both LD_LIBRARY_PATH
and LD_32_LIBRARY_PATH on FreeBSD when GOHOSTARCH=386.

Update issue #13873.

Change-Id: I1fb20dd04eb2007061768b2e4530886521813d42
Reviewed-on: https://go-review.googlesource.com/18420
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

src/cmd/dist/test.go

index 679c23bb2296e92bbfa9d60c40b8752452e67a6e..9e0412e05bbaf5819879c7f144f6e592da001fd8 100644 (file)
@@ -913,6 +913,12 @@ func (t *tester) cgoTestSO(dt *distTest, testpath string) error {
                        s = "DYLD_LIBRARY_PATH"
                }
                cmd.Env = mergeEnvLists([]string{s + "=."}, os.Environ())
+
+               // On FreeBSD 64-bit architectures, the 32-bit linker looks for
+               // different environment variables.
+               if t.goos == "freebsd" && t.gohostarch == "386" {
+                       cmd.Env = mergeEnvLists([]string{"LD_32_LIBRARY_PATH=."}, cmd.Env)
+               }
        }
        return cmd.Run()
 }