Teresa Johnson | 2bd812c | 2016-10-14 00:13:59 +0000 | [diff] [blame] | 1 | //===- unittests/Threading.cpp - Thread tests -----------------------------===// |
| 2 | // |
Chandler Carruth | 2946cd7 | 2019-01-19 08:50:56 +0000 | [diff] [blame] | 3 | // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. |
| 4 | // See https://llvm.org/LICENSE.txt for license information. |
| 5 | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
Teresa Johnson | 2bd812c | 2016-10-14 00:13:59 +0000 | [diff] [blame] | 6 | // |
| 7 | //===----------------------------------------------------------------------===// |
| 8 | |
| 9 | #include "llvm/Support/Threading.h" |
| 10 | #include "llvm/Support/thread.h" |
| 11 | #include "gtest/gtest.h" |
| 12 | |
| 13 | using namespace llvm; |
| 14 | |
| 15 | namespace { |
| 16 | |
| 17 | TEST(Threading, PhysicalConcurrency) { |
Teresa Johnson | c0ef9e4 | 2016-10-17 14:56:53 +0000 | [diff] [blame] | 18 | auto Num = heavyweight_hardware_concurrency(); |
Teresa Johnson | 2bd812c | 2016-10-14 00:13:59 +0000 | [diff] [blame] | 19 | // Since Num is unsigned this will also catch us trying to |
| 20 | // return -1. |
| 21 | ASSERT_LE(Num, thread::hardware_concurrency()); |
| 22 | } |
| 23 | |
Teresa Johnson | 2bd812c | 2016-10-14 00:13:59 +0000 | [diff] [blame] | 24 | } // end anon namespace |