pitrou commented on code in PR #13112:
URL: https://github.com/apache/arrow/pull/13112#discussion_r873486038


##########
cpp/src/arrow/util/io_util_test.cc:
##########
@@ -731,5 +732,31 @@ TEST(Memory, GetRSS) {
 #endif
 }
 
+// Some loose tests to check if the cpuinfo makes sense
+TEST(CpuInfo, Basic) {
+  const CpuInfo* ci = CpuInfo::GetInstance();
+
+  ASSERT_TRUE(ci->num_cores() >= 1 && ci->num_cores() <= 1000);
+
+  const auto l1 = ci->CacheSize(CpuInfo::CacheLevel::L1);
+  const auto l2 = ci->CacheSize(CpuInfo::CacheLevel::L2);
+  const auto l3 = ci->CacheSize(CpuInfo::CacheLevel::L3);
+  ASSERT_TRUE(l1 <= l2 && l2 <= l3);
+  ASSERT_TRUE(l1 >= 4 * 1024 && l1 <= 512 * 1024);
+  ASSERT_TRUE(l2 >= 32 * 1024 && l2 <= 8 * 1024 * 1024);
+  ASSERT_TRUE(l3 >= 256 * 1024 && l3 <= 128 * 1024 * 1024);

Review Comment:
   Make diagnosing easier:
   ```suggestion
     ASSERT_TRUE(l1 >= 4 * 1024 && l1 <= 512 * 1024) << "unexpected L1 size: " 
<< l1;
     ASSERT_TRUE(l2 >= 32 * 1024 && l2 <= 8 * 1024 * 1024) << "unexpected L2 
size: " << l2;
     ASSERT_TRUE(l3 >= 256 * 1024 && l3 <= 128 * 1024 * 1024) << "unexpected L3 
size: " << l3;
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to