Commit 6f3f2d0a authored by Shenghou Ma's avatar Shenghou Ma

run.bash: skip -static cgo test if -static linking isn't possible.

Some system doesn't have libc.a available.

While we're at here, also export GOROOT in run.bash, so that
one doesn't need to set GOROOT to run run.bash.

LGTM=iant
R=iant
CC=golang-codereviews
https://golang.org/cl/99870043
parent f999e14f
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
set -e set -e
eval $(go env) eval $(go env)
export GOROOT # the api test requires GOROOT to be set.
unset CDPATH # in case user has it set unset CDPATH # in case user has it set
unset GOPATH # we disallow local import for non-local packages, if $GOROOT happens unset GOPATH # we disallow local import for non-local packages, if $GOROOT happens
...@@ -140,7 +141,11 @@ dragonfly-386 | dragonfly-amd64 | freebsd-386 | freebsd-amd64 | freebsd-arm | li ...@@ -140,7 +141,11 @@ dragonfly-386 | dragonfly-amd64 | freebsd-386 | freebsd-amd64 | freebsd-arm | li
# static linking on FreeBSD/ARM with clang. (cgo depends on # static linking on FreeBSD/ARM with clang. (cgo depends on
# -fPIC fundamentally.) # -fPIC fundamentally.)
*) *)
go test -ldflags '-linkmode=external -extldflags "-static -pthread"' ../testtls || exit 1 if ! $CC -xc -o /dev/null -static - 2>/dev/null <<<'int main() {}' ; then
echo "No support for static linking found (lacks libc.a?), skip cgo static linking test."
else
go test -ldflags '-linkmode=external -extldflags "-static -pthread"' ../testtls || exit 1
fi
;; ;;
esac esac
;; ;;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment