mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
This moves most misc/cgo tests to cmd/cgo/internal. This is mostly a trivial rename and updating dist/test.go for the new paths, plus excluding these packages from regular dist test registration. A few tests were sensitive to what path they ran in, so we update those. This will let these tests access facilities in internal/testenv. For #37486. Change-Id: I3ed417c7c22d9b667f2767c0cb1f59118fcd4af6 Reviewed-on: https://go-review.googlesource.com/c/go/+/492720 Run-TryBot: Austin Clements <austin@google.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org> Reviewed-by: Bryan Mills <bcmills@google.com> TryBot-Result: Gopher Robot <gobot@golang.org>
47 lines
1 KiB
Go
47 lines
1 KiB
Go
// Copyright 2017 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.
|
|
|
|
package main
|
|
|
|
import (
|
|
"log"
|
|
"plugin"
|
|
|
|
"testplugin/iface_i"
|
|
)
|
|
|
|
func main() {
|
|
a, err := plugin.Open("iface_a.so")
|
|
if err != nil {
|
|
log.Fatalf(`plugin.Open("iface_a.so"): %v`, err)
|
|
}
|
|
b, err := plugin.Open("iface_b.so")
|
|
if err != nil {
|
|
log.Fatalf(`plugin.Open("iface_b.so"): %v`, err)
|
|
}
|
|
|
|
af, err := a.Lookup("F")
|
|
if err != nil {
|
|
log.Fatalf(`a.Lookup("F") failed: %v`, err)
|
|
}
|
|
bf, err := b.Lookup("F")
|
|
if err != nil {
|
|
log.Fatalf(`b.Lookup("F") failed: %v`, err)
|
|
}
|
|
if af.(func() interface{})() != bf.(func() interface{})() {
|
|
panic("empty interfaces not equal")
|
|
}
|
|
|
|
ag, err := a.Lookup("G")
|
|
if err != nil {
|
|
log.Fatalf(`a.Lookup("G") failed: %v`, err)
|
|
}
|
|
bg, err := b.Lookup("G")
|
|
if err != nil {
|
|
log.Fatalf(`b.Lookup("G") failed: %v`, err)
|
|
}
|
|
if ag.(func() iface_i.I)() != bg.(func() iface_i.I)() {
|
|
panic("nonempty interfaces not equal")
|
|
}
|
|
}
|