summaryrefslogtreecommitdiff
path: root/src/mongo/util/processinfo_test.cpp
diff options
context:
space:
mode:
authorRobert Guo <robert.guo@10gen.com>2018-03-13 14:58:04 -0400
committerRobert Guo <robert.guo@10gen.com>2018-03-15 10:14:34 -0400
commitebcfc62197744ffe0bb77a404a8e210c2100de31 (patch)
tree0f9ce5d4a564abb207045d0765a7b77281de0cad /src/mongo/util/processinfo_test.cpp
parent137bae8a3739545564cef631e33680108e767330 (diff)
downloadmongo-ebcfc62197744ffe0bb77a404a8e210c2100de31.tar.gz
SERVER-33643 refactor processInfo to no longer depend on global
initialization.
Diffstat (limited to 'src/mongo/util/processinfo_test.cpp')
-rw-r--r--src/mongo/util/processinfo_test.cpp13
1 files changed, 4 insertions, 9 deletions
diff --git a/src/mongo/util/processinfo_test.cpp b/src/mongo/util/processinfo_test.cpp
index 76f7e7ee551..53bf5305b51 100644
--- a/src/mongo/util/processinfo_test.cpp
+++ b/src/mongo/util/processinfo_test.cpp
@@ -55,18 +55,13 @@ TEST(ProcessInfo, NonZeroPageSize) {
TEST(ProcessInfo, GetNumAvailableCores) {
#if defined(__APPLE__) || defined(__linux__) || (defined(__sun) && defined(__SVR4)) || \
defined(_WIN32)
- ProcessInfo processInfo;
- ProcessInfo::initializeSystemInfo();
- optional<unsigned long> numAvailCores = processInfo.getNumAvailableCores();
- ASSERT_TRUE(numAvailCores.is_initialized());
- ASSERT_GREATER_THAN(*numAvailCores, 0u);
- ASSERT_LESS_THAN_OR_EQUALS(*numAvailCores, processInfo.getNumCores());
+ unsigned long numAvailCores = ProcessInfo::getNumAvailableCores();
+ ASSERT_GREATER_THAN(numAvailCores, 0u);
+ ASSERT_LESS_THAN_OR_EQUALS(numAvailCores, ProcessInfo::getNumCores());
#endif
}
TEST(ProcessInfo, GetNumCoresReturnsNonZeroNumberOfProcessors) {
- ProcessInfo processInfo;
- ProcessInfo::initializeSystemInfo();
- ASSERT_GREATER_THAN(processInfo.getNumCores(), 0u);
+ ASSERT_GREATER_THAN(ProcessInfo::getNumCores(), 0u);
}
}