[llvm] 02efd7d - [Threading] Ensure Tests Reflect Disabled Threads

Archibald Elliott via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 30 09:03:22 PST 2022


Author: Archibald Elliott
Date: 2022-11-30T17:02:49Z
New Revision: 02efd7d2716ae56ccf3ca0a62b84bb487e8a1221

URL: https://github.com/llvm/llvm-project/commit/02efd7d2716ae56ccf3ca0a62b84bb487e8a1221
DIFF: https://github.com/llvm/llvm-project/commit/02efd7d2716ae56ccf3ca0a62b84bb487e8a1221.diff

LOG: [Threading] Ensure Tests Reflect Disabled Threads

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

Added: 
    

Modified: 
    llvm/unittests/Support/Threading.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/unittests/Support/Threading.cpp b/llvm/unittests/Support/Threading.cpp
index daa360e90b1f..6ee1821483bc 100644
--- a/llvm/unittests/Support/Threading.cpp
+++ b/llvm/unittests/Support/Threading.cpp
@@ -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) {


        


More information about the llvm-commits mailing list