aboutsummaryrefslogtreecommitdiff
path: root/misc/cgo/testplugin/plugin_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'misc/cgo/testplugin/plugin_test.go')
-rw-r--r--misc/cgo/testplugin/plugin_test.go16
1 files changed, 14 insertions, 2 deletions
diff --git a/misc/cgo/testplugin/plugin_test.go b/misc/cgo/testplugin/plugin_test.go
index 285681018a..8960694351 100644
--- a/misc/cgo/testplugin/plugin_test.go
+++ b/misc/cgo/testplugin/plugin_test.go
@@ -116,11 +116,15 @@ func testMain(m *testing.M) int {
return m.Run()
}
-func goCmd(t *testing.T, op string, args ...string) {
+func goCmd(t *testing.T, op string, args ...string) string {
if t != nil {
t.Helper()
}
- run(t, filepath.Join(goroot, "bin", "go"), append([]string{op, "-gcflags", gcflags}, args...)...)
+ var flags []string
+ if op != "tool" {
+ flags = []string{"-gcflags", gcflags}
+ }
+ return run(t, filepath.Join(goroot, "bin", "go"), append(append([]string{op}, flags...), args...)...)
}
// escape converts a string to something suitable for a shell command line.
@@ -190,6 +194,14 @@ func TestDWARFSections(t *testing.T) {
goCmd(t, "run", "./checkdwarf/main.go", "./host.exe", "main.main")
}
+func TestBuildID(t *testing.T) {
+ // check that plugin has build ID.
+ b := goCmd(t, "tool", "buildid", "plugin1.so")
+ if len(b) == 0 {
+ t.Errorf("build id not found")
+ }
+}
+
func TestRunHost(t *testing.T) {
run(t, "./host.exe")
}