Skip to content

Commit 940fd0f

Browse files
committed
[FAB-12167] build scc plugins with race as needed
Change-Id: Ifc4e66de1bf0ce3c67d84e736f5871b67a4439e9 Signed-off-by: Matthew Sykes <sykesmat@us.ibm.com>
1 parent b0dc46c commit 940fd0f

File tree

2 files changed

+23
-1
lines changed

2 files changed

+23
-1
lines changed

core/scc/loadsysccs_test.go

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,16 @@ func TestLoadSCCPluginInvalid(t *testing.T) {
5959
assert.Panics(t, func() { loadPlugin("missing.so") }, "expected panic with invalid path")
6060
}
6161

62+
// raceEnabled is set to true when the race build tag is enabled.
63+
// see race_test.go
64+
var raceEnabled bool
65+
6266
func buildExamplePlugin(t *testing.T, path, pluginPackage string) {
63-
cmd := exec.Command("go", "build", "-tags", goBuildTags, "-o", path, "-buildmode=plugin", pluginPackage)
67+
cmd := exec.Command("go", "build", "-tags", goBuildTags, "-o", path, "-buildmode=plugin")
68+
if raceEnabled {
69+
cmd.Args = append(cmd.Args, "-race")
70+
}
71+
cmd.Args = append(cmd.Args, pluginPackage)
6472
output, err := cmd.CombinedOutput()
6573
if err != nil {
6674
t.Fatalf("Error: %s, Could not build plugin: %s", err, output)

core/scc/race_test.go

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
// +build race
2+
// +build pluginsenabled,cgo
3+
// +build darwin,go1.10 linux,go1.10 linux,go1.9,!ppc64le
4+
5+
/*
6+
Copyright IBM Corp. All Rights Reserved.
7+
8+
SPDX-License-Identifier: Apache-2.0
9+
*/
10+
package scc
11+
12+
func init() {
13+
raceEnabled = true
14+
}

0 commit comments

Comments
 (0)