[Threading] Ensure Tests Reflect Disabled Threads
authorArchibald Elliott <archibald.elliott@arm.com>
Wed, 30 Nov 2022 15:18:14 +0000 (15:18 +0000)
committerArchibald Elliott <archibald.elliott@arm.com>
Wed, 30 Nov 2022 17:02:49 +0000 (17:02 +0000)
D137836 changed what llvm::get_physical_cores returns when threads are
disabled, to bring it inline with the other parts of Threading. It now
returns the value for "unknown" when threading is disabled.

This commit updates the tests (which are failing on some platforms), to
also reflect this change.

Differential Revision: https://reviews.llvm.org/D139015

llvm/unittests/Support/Threading.cpp

index daa360e..6ee1821 100644 (file)
@@ -20,6 +20,7 @@ using namespace llvm;
 namespace {
 
 static bool isThreadingSupportedArchAndOS() {
+#if LLVM_ENABLE_THREADS
   Triple Host(Triple::normalize(sys::getProcessTriple()));
 
   // Initially this is only testing detection of the number of
@@ -29,6 +30,9 @@ static bool isThreadingSupportedArchAndOS() {
          (Host.isX86() && Host.isOSLinux()) ||
          (Host.isOSLinux() && !Host.isAndroid()) ||
          (Host.isSystemZ() && Host.isOSzOS());
+#else
+  return false;
+#endif
 }
 
 TEST(Threading, PhysicalConcurrency) {