]> Cypherpunks repositories - gostls13.git/commitdiff
misc/cgo: disable TestAllocateFromC in wbshadow mode
authorRuss Cox <rsc@golang.org>
Tue, 6 Jan 2015 18:46:13 +0000 (13:46 -0500)
committerRuss Cox <rsc@golang.org>
Tue, 6 Jan 2015 22:22:59 +0000 (22:22 +0000)
This test is doing pointer graph manipulation from C, and we
cannot support that with concurrent GC. The wbshadow mode
correctly diagnoses missing write barriers.

Disable the test in that mode for now. There is a bigger issue
behind it, namely SWIG, but for now we are focused on making
all.bash pass with wbshadow enabled.

Change-Id: I55891596d4c763e39b74082191d4a5fac7161642
Reviewed-on: https://go-review.googlesource.com/2346
Reviewed-by: Minux Ma <minux@golang.org>
Reviewed-by: Rick Hudson <rlh@golang.org>
misc/cgo/test/callback.go

index 64fd4707d2d63a9683d4ba8d0684190c2bbeadee..8c8ccbe34a1e01812128f9f519e2fff9f8eb264f 100644 (file)
@@ -17,6 +17,7 @@ int returnAfterGrowFromGo(void);
 import "C"
 
 import (
+       "os"
        "path"
        "runtime"
        "strings"
@@ -211,6 +212,19 @@ func testPanicFromC(t *testing.T) {
 }
 
 func testAllocateFromC(t *testing.T) {
+       if strings.Contains(os.Getenv("GODEBUG"), "wbshadow=") {
+               // This test is writing pointers to Go heap objects from C.
+               // As such, those writes have no write barriers, and
+               // wbshadow=2 mode correctly discovers that and crashes.
+               // Disable test if any wbshadow mode is enabled.
+               // TODO(rsc): I am not sure whether the test is fundamentally
+               // incompatible with concurrent collection and should be
+               // turned off or rewritten entirely. The test is attempting to
+               // mimic some SWIG behavior, so it is important to work
+               // through what we expect before trying SWIG and C++
+               // with the concurrent collector.
+               t.Skip("test is incompatible with wbshadow=")
+       }
        C.callCgoAllocate() // crashes or exits on failure
 }