llvm/lldb/unittests/Utility/LogTest.cpp

//===-- LogTest.cpp -------------------------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//

#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>() {}
} // namespace lldb_private

// Wrap enable, disable and list functions to make them easier to test.
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 {
// A test fixture which provides tests with a pre-registered channel.
struct LogChannelTest : public ::testing::Test {};

class TestLogHandler : public LogHandler {};

// A test fixture which provides tests with a pre-registered and pre-enabled
// channel. Additionally, the messages written to that channel are captured and
// made available via getMessage().
class LogChannelEnabledTest : public LogChannelTest {};

static std::string GetDumpAsString(const RotatingLogHandler &handler) {}
} // end anonymous namespace

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) {}
} // namespace

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) {}