Merge pull request #1414 from jeffweiss/bugfix/get_tests_working_on_s390x
get tests passing on s390x
This commit is contained in:
commit
f78f9a6bb8
1
Makefile
1
Makefile
|
@ -19,6 +19,7 @@ build_test: ## test only buildable
|
|||
GOOS=linux GOARCH=arm64 go test ./... | $(BUILD_FAIL_PATTERN)
|
||||
GOOS=linux GOARCH=loong64 go test ./... | $(BUILD_FAIL_PATTERN)
|
||||
GOOS=linux GOARCH=riscv64 go test ./... | $(BUILD_FAIL_PATTERN)
|
||||
GOOS=linux GOARCH=s390x go test ./... | $(BUILD_FAIL_PATTERN)
|
||||
GOOS=freebsd GOARCH=amd64 go test ./... | $(BUILD_FAIL_PATTERN)
|
||||
GOOS=freebsd GOARCH=386 go test ./... | $(BUILD_FAIL_PATTERN)
|
||||
GOOS=freebsd GOARCH=arm go test ./... | $(BUILD_FAIL_PATTERN)
|
||||
|
|
|
@ -190,7 +190,7 @@ func InfoWithContext(ctx context.Context) ([]InfoStat, error) {
|
|||
switch key {
|
||||
case "Processor":
|
||||
processorName = value
|
||||
case "processor":
|
||||
case "processor", "cpu number":
|
||||
if c.CPU >= 0 {
|
||||
finishCPUInfo(&c)
|
||||
ret = append(ret, c)
|
||||
|
@ -203,6 +203,9 @@ func InfoWithContext(ctx context.Context) ([]InfoStat, error) {
|
|||
c.CPU = int32(t)
|
||||
case "vendorId", "vendor_id":
|
||||
c.VendorID = value
|
||||
if strings.Contains(value, "S390") {
|
||||
processorName = "S390"
|
||||
}
|
||||
case "CPU implementer":
|
||||
if v, err := strconv.ParseUint(value, 0, 8); err == nil {
|
||||
switch v {
|
||||
|
@ -273,7 +276,7 @@ func InfoWithContext(ctx context.Context) ([]InfoStat, error) {
|
|||
return ret, err
|
||||
}
|
||||
c.Stepping = int32(t)
|
||||
case "cpu MHz", "clock":
|
||||
case "cpu MHz", "clock", "cpu MHz dynamic":
|
||||
// treat this as the fallback value, thus we ignore error
|
||||
if t, err := strconv.ParseFloat(strings.Replace(value, "MHz", "", 1), 64); err == nil {
|
||||
c.Mhz = t
|
||||
|
|
|
@ -48,7 +48,9 @@ func TestCPUCountsAgainstLscpu(t *testing.T) {
|
|||
}
|
||||
t.Errorf("error executing lscpu: %v", err)
|
||||
}
|
||||
var threadsPerCore, coresPerSocket, sockets int
|
||||
var threadsPerCore, coresPerSocket, sockets, books, drawers int
|
||||
books = 1
|
||||
drawers = 1
|
||||
lines := strings.Split(string(out), "\n")
|
||||
for _, line := range lines {
|
||||
fields := strings.Split(line, ":")
|
||||
|
@ -60,14 +62,18 @@ func TestCPUCountsAgainstLscpu(t *testing.T) {
|
|||
threadsPerCore, _ = strconv.Atoi(strings.TrimSpace(fields[1]))
|
||||
case "Core(s) per socket":
|
||||
coresPerSocket, _ = strconv.Atoi(strings.TrimSpace(fields[1]))
|
||||
case "Socket(s)":
|
||||
case "Socket(s)", "Socket(s) per book":
|
||||
sockets, _ = strconv.Atoi(strings.TrimSpace(fields[1]))
|
||||
case "Book(s) per drawer":
|
||||
books, _ = strconv.Atoi(strings.TrimSpace(fields[1]))
|
||||
case "Drawer(s)":
|
||||
drawers, _ = strconv.Atoi(strings.TrimSpace(fields[1]))
|
||||
}
|
||||
}
|
||||
if threadsPerCore == 0 || coresPerSocket == 0 || sockets == 0 {
|
||||
t.Errorf("missing info from lscpu: threadsPerCore=%d coresPerSocket=%d sockets=%d", threadsPerCore, coresPerSocket, sockets)
|
||||
}
|
||||
expectedPhysical := coresPerSocket * sockets
|
||||
expectedPhysical := coresPerSocket * sockets * books * drawers
|
||||
expectedLogical := expectedPhysical * threadsPerCore
|
||||
physical, err := Counts(false)
|
||||
skipIfNotImplementedErr(t, err)
|
||||
|
|
Loading…
Reference in New Issue