File size: 795 Bytes
13c2bf6
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
// Copyright 2025 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

//go:build 386 || amd64

package cpu_test

import (
	"internal/cpu"
	"testing"
)

// Tests fetching data cache sizes. This test only checks that DataCacheSizes
// won't explode. Otherwise it's just informational, and dumps the current
// data cache sizes.
func TestDataCacheSizes(t *testing.T) {
	// N.B. Don't try to check these values because we don't know what
	// kind of environment we're running in. We don't want this test to
	// fail on some random x86 chip that happens to not support the right
	// CPUID bits for some reason.
	caches := cpu.DataCacheSizes()
	for i, size := range caches {
		t.Logf("L%d: %d", i+1, size)
	}
}