#include <folly/futures/Future.h>
#include <folly/futures/Promise.h>
#include <folly/init/Init.h>
+#include <folly/lang/SafeAssert.h>
#include <folly/portability/GFlags.h>
#include <folly/portability/GMock.h>
#include <folly/portability/GTest.h>
std::string&& msg) {
internalWarnings->emplace_back(std::move(msg));
}
-}
+} // namespace
TEST(AsyncFileWriter, ioError) {
// Set the LoggerDB internal warning handler so we can record the messages
return totalBytes;
}
-}
+} // namespace
TEST(AsyncFileWriter, flush) {
// Set up a pipe(), then write data to the write endpoint until it fills up
}
void writerFinished(size_t threadID, size_t messagesWritten, uint32_t flags) {
auto map = perThreadWriteData_.wlock();
- assert(map->find(threadID) == map->end());
+ FOLLY_SAFE_CHECK(
+ map->find(threadID) == map->end(),
+ "multiple writer threads with same ID");
auto& data = (*map)[threadID];
data.numMessagesWritten = messagesWritten;
data.flags = flags;
int main(int argc, char* argv[]) {
testing::InitGoogleTest(&argc, argv);
folly::init(&argc, &argv);
- // Don't use async logging in the async logging tests :-)
- folly::initLoggingGlogStyle(FLAGS_logging, LogLevel::INFO, /* async */ false);
+ folly::initLogging(FLAGS_logging);
return RUN_ALL_TESTS();
}