Source file src/internal/cpu/datacache_x86_test.go

     1  // Copyright 2025 The Go Authors. All rights reserved.
     2  // Use of this source code is governed by a BSD-style
     3  // license that can be found in the LICENSE file.
     4  
     5  //go:build 386 || amd64
     6  
     7  package cpu_test
     8  
     9  import (
    10  	"internal/cpu"
    11  	"testing"
    12  )
    13  
    14  // Tests fetching data cache sizes. This test only checks that DataCacheSizes
    15  // won't explode. Otherwise it's just informational, and dumps the current
    16  // data cache sizes.
    17  func TestDataCacheSizes(t *testing.T) {
    18  	// N.B. Don't try to check these values because we don't know what
    19  	// kind of environment we're running in. We don't want this test to
    20  	// fail on some random x86 chip that happens to not support the right
    21  	// CPUID bits for some reason.
    22  	caches := cpu.DataCacheSizes()
    23  	for i, size := range caches {
    24  		t.Logf("L%d: %d", i+1, size)
    25  	}
    26  }
    27  

View as plain text