libgo: update to go1.9
[official-gcc.git] / libgo / misc / cgo / testplugin / test.bash
blob69df5bd2bfaca9fd350720b219eb84e08b8440f5
1 #!/usr/bin/env bash
2 # Copyright 2016 The Go Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style
4 # license that can be found in the LICENSE file.
6 set -e
8 if [ ! -f src/host/host.go ]; then
9 cwd=$(pwd)
10 echo "misc/cgo/testplugin/test.bash is running in $cwd" 1>&2
11 exit 1
14 goos=$(go env GOOS)
15 goarch=$(go env GOARCH)
17 function cleanup() {
18 rm -f plugin*.so unnamed*.so iface*.so
19 rm -rf host pkg sub iface issue18676 issue19534
21 trap cleanup EXIT
23 rm -rf pkg sub
24 mkdir sub
26 GOPATH=$(pwd) go build -buildmode=plugin plugin1
27 GOPATH=$(pwd) go build -buildmode=plugin plugin2
28 GOPATH=$(pwd)/altpath go build -buildmode=plugin plugin-mismatch
29 GOPATH=$(pwd) go build -buildmode=plugin -o=sub/plugin1.so sub/plugin1
30 GOPATH=$(pwd) go build -buildmode=plugin unnamed1.go
31 GOPATH=$(pwd) go build -buildmode=plugin unnamed2.go
32 GOPATH=$(pwd) go build host
34 LD_LIBRARY_PATH=$(pwd) ./host
36 # Test that types and itabs get properly uniqified.
37 GOPATH=$(pwd) go build -buildmode=plugin iface_a
38 GOPATH=$(pwd) go build -buildmode=plugin iface_b
39 GOPATH=$(pwd) go build iface
40 LD_LIBRARY_PATH=$(pwd) ./iface
42 # Test for issue 18676 - make sure we don't add the same itab twice.
43 # The buggy code hangs forever, so use a timeout to check for that.
44 GOPATH=$(pwd) go build -buildmode=plugin -o plugin.so src/issue18676/plugin.go
45 GOPATH=$(pwd) go build -o issue18676 src/issue18676/main.go
46 timeout 10s ./issue18676
48 # Test for issue 19534 - that we can load a plugin built in a path with non-alpha
49 # characters
50 GOPATH=$(pwd) go build -buildmode=plugin -ldflags='-pluginpath=issue.19534' -o plugin.so src/issue19534/plugin.go
51 GOPATH=$(pwd) go build -o issue19534 src/issue19534/main.go
52 ./issue19534