mirror of
https://github.com/golang/go
synced 2024-11-20 02:54:39 -07:00
1134411a83
1. remove broken verification The runtime check assumes that no-pcln symbol entry have zero value, but the linker emit no entries if the symbol is no-pcln. As a result, if there are no-pcln symbols at the very end of pcln table, it will panic. 2. correct condition of export Handle special chracters in pluginpath correcty. Export "go.itab.*", so different plugins can share the same itab. Fixes #18190 Change-Id: Ia4f9c51d83ce8488a9470520f1ee9432802cfc1d Reviewed-on: https://go-review.googlesource.com/61091 Reviewed-by: David Crawshaw <crawshaw@golang.org> Run-TryBot: David Crawshaw <crawshaw@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
64 lines
1.9 KiB
Bash
Executable File
64 lines
1.9 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# Copyright 2016 The Go Authors. All rights reserved.
|
|
# Use of this source code is governed by a BSD-style
|
|
# license that can be found in the LICENSE file.
|
|
|
|
set -e
|
|
|
|
if [ ! -f src/host/host.go ]; then
|
|
cwd=$(pwd)
|
|
echo "misc/cgo/testplugin/test.bash is running in $cwd" 1>&2
|
|
exit 1
|
|
fi
|
|
|
|
goos=$(go env GOOS)
|
|
goarch=$(go env GOARCH)
|
|
|
|
function cleanup() {
|
|
rm -f plugin*.so unnamed*.so iface*.so
|
|
rm -rf host pkg sub iface issue18676 issue19534
|
|
}
|
|
trap cleanup EXIT
|
|
|
|
rm -rf pkg sub
|
|
mkdir sub
|
|
|
|
GOPATH=$(pwd) go build -buildmode=plugin plugin1
|
|
GOPATH=$(pwd) go build -buildmode=plugin plugin2
|
|
cp plugin2.so plugin2-dup.so
|
|
GOPATH=$(pwd)/altpath go build -buildmode=plugin plugin-mismatch
|
|
GOPATH=$(pwd) go build -buildmode=plugin -o=sub/plugin1.so sub/plugin1
|
|
GOPATH=$(pwd) go build -buildmode=plugin -o=unnamed1.so unnamed1/main.go
|
|
GOPATH=$(pwd) go build -buildmode=plugin -o=unnamed2.so unnamed2/main.go
|
|
GOPATH=$(pwd) go build host
|
|
|
|
LD_LIBRARY_PATH=$(pwd) ./host
|
|
|
|
# Test that types and itabs get properly uniqified.
|
|
GOPATH=$(pwd) go build -buildmode=plugin iface_a
|
|
GOPATH=$(pwd) go build -buildmode=plugin iface_b
|
|
GOPATH=$(pwd) go build iface
|
|
LD_LIBRARY_PATH=$(pwd) ./iface
|
|
|
|
function _timeout() (
|
|
set -e
|
|
$2 &
|
|
p=$!
|
|
(sleep $1; kill $p 2>/dev/null) &
|
|
p2=$!
|
|
wait $p 2>/dev/null
|
|
kill -0 $p2 2>/dev/null
|
|
)
|
|
|
|
# Test for issue 18676 - make sure we don't add the same itab twice.
|
|
# The buggy code hangs forever, so use a timeout to check for that.
|
|
GOPATH=$(pwd) go build -buildmode=plugin -o plugin.so src/issue18676/plugin.go
|
|
GOPATH=$(pwd) go build -o issue18676 src/issue18676/main.go
|
|
_timeout 10 ./issue18676
|
|
|
|
# Test for issue 19534 - that we can load a plugin built in a path with non-alpha
|
|
# characters
|
|
GOPATH=$(pwd) go build -buildmode=plugin -ldflags='-pluginpath=issue.19534' -o plugin.so src/issue19534/plugin.go
|
|
GOPATH=$(pwd) go build -o issue19534 src/issue19534/main.go
|
|
./issue19534
|