]> Cypherpunks repositories - gostls13.git/commitdiff
runtime: add invalidptr=0 for TestGcZombieReporting
authorChaoqun Han <hanssccv@gmail.com>
Thu, 25 Nov 2021 13:16:28 +0000 (21:16 +0800)
committerEmmanuel Odeke <emmanuel@orijtech.com>
Tue, 30 Nov 2021 18:49:39 +0000 (18:49 +0000)
pointers in zombies slice may cross-span, add invalidptr=0 for avoiding the badPointer check

Fixes #49613

Change-Id: Ifb1931922170e87e799e2e6081dc85dab3890205
Reviewed-on: https://go-review.googlesource.com/c/go/+/367044
Trust: Emmanuel Odeke <emmanuel@orijtech.com>
Run-TryBot: Emmanuel Odeke <emmanuel@orijtech.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
Reviewed-by: Emmanuel Odeke <emmanuel@orijtech.com>
src/runtime/gc_test.go

index 7b979afd55490096f0ab04183691d1e210a2b73c..d81cb3a3d5db41c7099da636128199966a7d51d0 100644 (file)
@@ -196,7 +196,10 @@ func TestPeriodicGC(t *testing.T) {
 
 func TestGcZombieReporting(t *testing.T) {
        // This test is somewhat sensitive to how the allocator works.
-       got := runTestProg(t, "testprog", "GCZombie")
+       // Pointers in zombies slice may cross-span, thus we
+       // add invalidptr=0 for avoiding the badPointer check.
+       // See issue https://golang.org/issues/49613/
+       got := runTestProg(t, "testprog", "GCZombie", "GODEBUG=invalidptr=0")
        want := "found pointer to free object"
        if !strings.Contains(got, want) {
                t.Fatalf("expected %q in output, but got %q", want, got)