]> Cypherpunks repositories - gostls13.git/commitdiff
misc/cgo/fortran: fix gfortran compile test
authorMartin Möhrmann <martisch@uos.de>
Tue, 3 May 2016 09:10:26 +0000 (11:10 +0200)
committerMartin Möhrmann <martisch@uos.de>
Wed, 4 May 2016 15:08:16 +0000 (15:08 +0000)
Fixes #14544

Change-Id: I58b0b164ebbfeafe4ab32039a063df53e3018a6d
Reviewed-on: https://go-review.googlesource.com/22730
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Sean Lake <odysseus9672@gmail.com>
misc/cgo/fortran/test.bash
src/cmd/dist/test.go

index d397dcb682b1a3dfb71e703de7b79cb4ca28927f..3d1bc9de8e9fd03f243346abe3822237aca3ff9d 100755 (executable)
@@ -9,12 +9,28 @@ set -e
 
 FC=$1
 
+goos=$(go env GOOS)
+
+libext="so"
+if [ "$goos" == "darwin" ]; then
+       libext="dylib"
+fi
+
+case "$FC" in
+*gfortran*)
+  libpath=$(dirname $($FC -print-file-name=libgfortran.$libext))
+  export CGO_LDFLAGS="$CGO_LDFLAGS -Wl,-rpath,$libpath -L $libpath"
+  ;;
+esac
+
 if ! $FC helloworld/helloworld.f90 -o main.exe >& /dev/null; then
   echo "skipping Fortran test: could not build helloworld.f90 with $FC"
   exit 0
 fi
 rm -f main.exe
 
+status=0
+
 if ! go test; then
   echo "FAIL: go test"
   status=1
index 11c22f4fd39968698ae859287de65f8fa988105e..92559c9d7ec2ca4534ab07558dfaeeb602e72973 100644 (file)
@@ -445,7 +445,7 @@ func (t *tester) registerTests() {
                if fortran == "" {
                        fortran, _ = exec.LookPath("gfortran")
                }
-               if t.hasBash() && fortran != "" && t.goos != "dragonfly" { // see golang.org/issue/14544
+               if t.hasBash() && fortran != "" {
                        t.tests = append(t.tests, distTest{
                                name:    "cgo_fortran",
                                heading: "../misc/cgo/fortran",