summaryrefslogtreecommitdiff
path: root/unittests/Support/Threading.cpp
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2017-01-02 19:17:04 +0000
committerDimitry Andric <dim@FreeBSD.org>2017-01-02 19:17:04 +0000
commitb915e9e0fc85ba6f398b3fab0db6a81a8913af94 (patch)
tree98b8f811c7aff2547cab8642daf372d6c59502fb /unittests/Support/Threading.cpp
parent6421cca32f69ac849537a3cff78c352195e99f1b (diff)
Notes
Diffstat (limited to 'unittests/Support/Threading.cpp')
-rw-r--r--unittests/Support/Threading.cpp25
1 files changed, 25 insertions, 0 deletions
diff --git a/unittests/Support/Threading.cpp b/unittests/Support/Threading.cpp
new file mode 100644
index 000000000000..be53026415d7
--- /dev/null
+++ b/unittests/Support/Threading.cpp
@@ -0,0 +1,25 @@
+//===- unittests/Threading.cpp - Thread tests -----------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#include "llvm/Support/Threading.h"
+#include "llvm/Support/thread.h"
+#include "gtest/gtest.h"
+
+using namespace llvm;
+
+namespace {
+
+TEST(Threading, PhysicalConcurrency) {
+ auto Num = heavyweight_hardware_concurrency();
+ // Since Num is unsigned this will also catch us trying to
+ // return -1.
+ ASSERT_LE(Num, thread::hardware_concurrency());
+}
+
+} // end anon namespace