]> Cypherpunks repositories - gostls13.git/commitdiff
runtime: fix stack memory test
authorKeith Randall <khr@golang.org>
Wed, 30 Jul 2014 18:02:40 +0000 (11:02 -0700)
committerKeith Randall <khr@golang.org>
Wed, 30 Jul 2014 18:02:40 +0000 (11:02 -0700)
Stand-alone this test is fine.  Run together with
others, however, the stack used can actually go
negative because other tests are freeing stack
during its execution.

This behavior is new with the new stack allocator.
The old allocator never returned (min-sized) stacks.

This test is fairly poor - it needs to run in
isolation to be accurate.  Maybe we should delete it.

LGTM=r
R=r
CC=golang-codereviews
https://golang.org/cl/119330044

src/pkg/runtime/stack_test.go

index 424a15b3e562b210ae8d5cdba28ecafe4cbd9afe..08282afd42a8114a42fd2b8e9377d3d7d6e35c44 100644 (file)
@@ -106,9 +106,9 @@ func TestStackMem(t *testing.T) {
        }
        s1 := new(MemStats)
        ReadMemStats(s1)
-       consumed := s1.StackSys - s0.StackSys
+       consumed := int64(s1.StackSys - s0.StackSys)
        t.Logf("Consumed %vMB for stack mem", consumed>>20)
-       estimate := uint64(8 * BatchSize * ArraySize * RecursionDepth) // 8 is to reduce flakiness.
+       estimate := int64(8 * BatchSize * ArraySize * RecursionDepth) // 8 is to reduce flakiness.
        if consumed > estimate {
                t.Fatalf("Stack mem: want %v, got %v", estimate, consumed)
        }