diff --git a/base/cpuid.cpp b/base/cpuid.cpp index 1621b1c4a0..d42f3bb25d 100644 --- a/base/cpuid.cpp +++ b/base/cpuid.cpp @@ -74,7 +74,7 @@ std::string CPUVendorIdentificationString() { std::string ProcessorBrandString() { std::string result(48, '\0'); - for (int n = 0; n < 4; ++n) { + for (int n = 0; n < 3; ++n) { auto const piece = CPUID(0x80000002 + n, 0); std::memcpy(&result[n * 16], &piece.eax, 4); std::memcpy(&result[n * 16 + 4], &piece.ebx, 4); diff --git a/base/cpuid_test.cpp b/base/cpuid_test.cpp index 557d417448..4dd3a546dc 100644 --- a/base/cpuid_test.cpp +++ b/base/cpuid_test.cpp @@ -1,5 +1,6 @@ #include "base/cpuid.hpp" +#include "glog/logging.h" #include "gmock/gmock.h" #include "gtest/gtest.h" @@ -12,7 +13,12 @@ using ::testing::Not; using ::testing::Test; using namespace principia::base::_cpuid; -class CPUIDTest : public Test {}; +class CPUIDTest : public Test { + protected: + CPUIDTest() { + google::LogToStderr(); + } +}; TEST_F(CPUIDTest, Vendor) { // This mostly checks that we are getting something from CPUID, since it is @@ -20,6 +26,7 @@ TEST_F(CPUIDTest, Vendor) { // AnyOf as needed if the tests are run on non-Intel processors. EXPECT_THAT(CPUVendorIdentificationString(), AnyOf("AuthenticAMD", "GenuineIntel")); + LOG(INFO) << CPUVendorIdentificationString(); } TEST_F(CPUIDTest, Brand) { @@ -27,6 +34,7 @@ TEST_F(CPUIDTest, Brand) { AnyOf(HasSubstr("Intel(R) Xeon(R)"), HasSubstr("AMD Ryzen"), HasSubstr("VirtualApple"))); + LOG(INFO) << ProcessorBrandString(); } TEST_F(CPUIDTest, CPUFeatureFlags) { @@ -42,6 +50,7 @@ TEST_F(CPUIDTest, CPUFeatureFlags) { EXPECT_THAT( CPUFeatures(), AllOf(HasSubstr("FPU"), HasSubstr("SSE2"), Not(HasSubstr("PSN")))); + LOG(INFO) << CPUFeatures(); } } // namespace base