#include "gmock/gmock.h"
#include "gtest/gtest.h"
#include "lldb/Utility/Log.h"
#include "lldb/Utility/StreamString.h"
#include "llvm/ADT/BitmaskEnum.h"
#include "llvm/Support/ManagedStatic.h"
#include "llvm/Support/Threading.h"
#include <thread>
usingnamespacelldb;
usingnamespacelldb_private;
enum class TestChannel : Log::MaskType { … };
LLVM_ENABLE_BITMASK_ENUMS_IN_NAMESPACE(…);
static constexpr Log::Category test_categories[] = …;
static Log::Channel test_channel(test_categories, TestChannel::FOO);
namespace lldb_private {
template <> Log::Channel &LogChannelFor<TestChannel>() { … }
}
static bool EnableChannel(std::shared_ptr<LogHandler> log_handler_sp,
uint32_t log_options, llvm::StringRef channel,
llvm::ArrayRef<const char *> categories,
std::string &error) { … }
static bool DisableChannel(llvm::StringRef channel,
llvm::ArrayRef<const char *> categories,
std::string &error) { … }
static bool ListCategories(llvm::StringRef channel, std::string &result) { … }
namespace {
struct LogChannelTest : public ::testing::Test { … };
class TestLogHandler : public LogHandler { … };
class LogChannelEnabledTest : public LogChannelTest { … };
static std::string GetDumpAsString(const RotatingLogHandler &handler) { … }
}
void LogChannelEnabledTest::SetUp() { … }
llvm::StringRef LogChannelEnabledTest::takeOutput() { … }
llvm::StringRef
LogChannelEnabledTest::logAndTakeOutput(llvm::StringRef Message) { … }
llvm::StringRef
LogChannelEnabledTest::logAndTakeOutputf(llvm::StringRef Message) { … }
TEST(LogTest, LLDB_LOG_nullptr) { … }
TEST(LogTest, Register) { … }
TEST(LogTest, Unregister) { … }
namespace {
static char test_baton;
static size_t callback_count = …;
static void TestCallback(const char *data, void *baton) { … }
}
TEST(LogTest, CallbackLogHandler) { … }
TEST(LogHandlerTest, RotatingLogHandler) { … }
TEST(LogHandlerTest, TeeLogHandler) { … }
TEST_F(LogChannelTest, Enable) { … }
TEST_F(LogChannelTest, EnableOptions) { … }
TEST_F(LogChannelTest, Disable) { … }
TEST_F(LogChannelTest, List) { … }
TEST_F(LogChannelEnabledTest, log_options) { … }
TEST_F(LogChannelEnabledTest, LLDB_LOG_ERROR) { … }
TEST_F(LogChannelEnabledTest, LogThread) { … }
TEST_F(LogChannelEnabledTest, LogVerboseThread) { … }
TEST_F(LogChannelEnabledTest, LogGetLogThread) { … }