Browse Source

Skip tests that require GOMAXPROCS > 1.

Richard Crowley 12 năm trước cách đây
mục cha
commit
a4a3178f75
2 tập tin đã thay đổi với 8 bổ sung1 xóa
  1. 5 1
      debug_test.go
  2. 3 0
      runtime_test.go

+ 5 - 1
debug_test.go

@@ -1,7 +1,7 @@
 package metrics
 
 import (
-	// "runtime"
+	"runtime"
 	"runtime/debug"
 	"testing"
 	"time"
@@ -17,6 +17,10 @@ func BenchmarkDebugGCStats(b *testing.B) {
 }
 
 func TestDebugGCStatsBlocking(t *testing.T) {
+	if g := runtime.GOMAXPROCS(0); g < 2 {
+		t.Skipf("skipping TestDebugGCMemStatsBlocking with GOMAXPROCS=%d\n", g)
+		return
+	}
 	ch := make(chan int)
 	go testDebugGCStatsBlocking(ch)
 	var gcStats debug.GCStats

+ 3 - 0
runtime_test.go

@@ -16,6 +16,9 @@ func BenchmarkRuntimeMemStats(b *testing.B) {
 }
 
 func TestRuntimeMemStatsBlocking(t *testing.T) {
+	if g := runtime.GOMAXPROCS(0); g < 2 {
+		t.Skipf("skipping TestRuntimeMemStatsBlocking with GOMAXPROCS=%d\n", g)
+	}
 	ch := make(chan int)
 	go testRuntimeMemStatsBlocking(ch)
 	var memStats runtime.MemStats