The following issues were found
src/mongo/util/periodic_runner_impl_test.cpp
1 issues
Line: 87
}
};
TEST_F(PeriodicRunnerImplTest, OneJobTest) {
int count = 0;
Milliseconds interval{5};
auto mutex = MONGO_MAKE_LATCH();
stdx::condition_variable cv;
Reported by Cppcheck.
src/mongo/util/platform_init.cpp
1 issues
Line: 94
// hook the C runtime's error display
_CrtSetReportHook(&crtDebugCallback);
if (_setmaxstdio(2048) == -1) {
LOGV2_WARNING(23326, "Failed to increase max open files limit from default of 512 to 2048");
}
// Let's try to set minimum Windows Kernel quantum length to smallest viable timer resolution in
// order to allow sleepmillis() to support waiting periods below Windows default quantum length
Reported by Cppcheck.
src/mongo/util/processinfo_test.cpp
1 issues
Line: 50
}
}
TEST(ProcessInfo, GetNumAvailableCores) {
#if defined(__APPLE__) || defined(__linux__) || (defined(__sun) && defined(__SVR4)) || \
defined(_WIN32)
unsigned long numAvailCores = ProcessInfo::getNumAvailableCores();
ASSERT_GREATER_THAN(numAvailCores, 0u);
ASSERT_LESS_THAN_OR_EQUALS(numAvailCores, ProcessInfo::getNumCores());
Reported by Cppcheck.
src/mongo/util/procparser_test.cpp
1 issues
Line: 105
auto obj = builder.obj(); \
auto stringMap = toStringMap(obj);
TEST(FTDCProcStat, TestStat) {
std::vector<StringData> keys{"cpu", "ctxt", "processes"};
// Normal case
{
Reported by Cppcheck.
src/mongo/util/producer_consumer_queue_test.cpp
1 issues
Line: 227
template <typename Helper> \
void name##CB::operator()(Helper&& helper)
PRODUCER_CONSUMER_QUEUE_TEST(basicPushPop, runPermutations<false, false>) {
typename Helper::template ProducerConsumerQueue<MoveOnly> pcq{};
helper.runThread("Producer", [&](OperationContext* opCtx) { pcq.push(MoveOnly(1), opCtx); })
.join();
Reported by Cppcheck.
src/mongo/util/progress_meter_test.cpp
1 issues
Line: 40
using namespace mongo;
// Trivial unit test to validate build dependencies.
TEST(ProgressMeterTest, ToString) {
ASSERT_FALSE(ProgressMeter(1).toString().empty());
}
} // namespace
Reported by Cppcheck.
src/mongo/util/read_through_cache_test.cpp
1 issues
Line: 131
OperationContext* const _opCtx{_opCtxHolder.get()};
};
TEST(ReadThroughCacheTest, StandaloneValueHandle) {
Cache::ValueHandle standaloneHandle(CachedValue(100));
ASSERT(standaloneHandle.isValid());
ASSERT_EQ(100, standaloneHandle->counter);
}
Reported by Cppcheck.
src/mongo/util/registry_list_test.cpp
1 issues
Line: 92
}
}
TEST(RegistryList, ConcurrentAdd) {
/**
* Show that multiple concurrent add() and iter() calls function to expectation
*/
RegistryList<boost::optional<size_t>> list;
Reported by Cppcheck.
src/mongo/util/represent_as_test.cpp
1 issues
Line: 134
#pragma warning(disable : 4756) // warning C4756: overflow in constant arithmetic
#endif
TEST(RepresentAs, Int32ToDouble) {
ASSERT(*(representAs<double>(kInt32Zero)) == 0);
ASSERT(*(representAs<double>(5)) == 5);
}
TEST(RepresentAs, Int64ToDouble) {
Reported by Cppcheck.
src/mongo/util/safe_num_test.cpp
1 issues
Line: 45
using mongo::Decimal128;
using mongo::SafeNum;
TEST(Basics, Initialization) {
const SafeNum numInt(0);
ASSERT_EQUALS(numInt.type(), mongo::NumberInt);
const SafeNum numLong(static_cast<int64_t>(0));
ASSERT_EQUALS(numLong.type(), mongo::NumberLong);
Reported by Cppcheck.