Add a more succinct logging syntax
This adds the LLDB_LOG macro, which enables one to write more succinct log
statements.
if (log)
log->Printf("log something: %d", var);
becomes
LLDB_LOG(log, "log something: {0}, var);
The macro still internally does the "if(log)" dance, so the arguments are only
evaluated if logging is enabled, meaning it has the same overhead as the
previous syntax.
Additionally, the log statements will be automatically prefixed with the file
and function generating the log (if the corresponding new argument to the "log
enable" command is enabled), so one does not need to manually specify this in
the log statement.
It also uses the new llvm formatv syntax, which means we don't have to worry
about PRIx64 macros and similar, and we can log complex object (llvm::StringRef,
lldb_private::Error, ...) more easily.
Differential Revision: https://reviews.llvm.org/D27459
llvm-svn: 292360
2017-01-18 19:00:26 +08:00
|
|
|
//===-- LogTest.cpp ---------------------------------------------*- C++ -*-===//
|
|
|
|
//
|
2019-01-19 16:50:56 +08:00
|
|
|
// 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
|
Add a more succinct logging syntax
This adds the LLDB_LOG macro, which enables one to write more succinct log
statements.
if (log)
log->Printf("log something: %d", var);
becomes
LLDB_LOG(log, "log something: {0}, var);
The macro still internally does the "if(log)" dance, so the arguments are only
evaluated if logging is enabled, meaning it has the same overhead as the
previous syntax.
Additionally, the log statements will be automatically prefixed with the file
and function generating the log (if the corresponding new argument to the "log
enable" command is enabled), so one does not need to manually specify this in
the log statement.
It also uses the new llvm formatv syntax, which means we don't have to worry
about PRIx64 macros and similar, and we can log complex object (llvm::StringRef,
lldb_private::Error, ...) more easily.
Differential Revision: https://reviews.llvm.org/D27459
llvm-svn: 292360
2017-01-18 19:00:26 +08:00
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
2018-01-17 21:46:06 +08:00
|
|
|
#include "gmock/gmock.h"
|
2017-01-18 20:29:51 +08:00
|
|
|
#include "gtest/gtest.h"
|
|
|
|
|
2017-03-04 04:56:28 +08:00
|
|
|
#include "lldb/Utility/Log.h"
|
2017-02-03 05:39:50 +08:00
|
|
|
#include "lldb/Utility/StreamString.h"
|
2017-02-17 21:27:42 +08:00
|
|
|
#include "llvm/Support/ManagedStatic.h"
|
2017-03-04 04:56:28 +08:00
|
|
|
#include "llvm/Support/Threading.h"
|
2017-02-21 17:58:23 +08:00
|
|
|
#include <thread>
|
Add a more succinct logging syntax
This adds the LLDB_LOG macro, which enables one to write more succinct log
statements.
if (log)
log->Printf("log something: %d", var);
becomes
LLDB_LOG(log, "log something: {0}, var);
The macro still internally does the "if(log)" dance, so the arguments are only
evaluated if logging is enabled, meaning it has the same overhead as the
previous syntax.
Additionally, the log statements will be automatically prefixed with the file
and function generating the log (if the corresponding new argument to the "log
enable" command is enabled), so one does not need to manually specify this in
the log statement.
It also uses the new llvm formatv syntax, which means we don't have to worry
about PRIx64 macros and similar, and we can log complex object (llvm::StringRef,
lldb_private::Error, ...) more easily.
Differential Revision: https://reviews.llvm.org/D27459
llvm-svn: 292360
2017-01-18 19:00:26 +08:00
|
|
|
|
|
|
|
using namespace lldb;
|
|
|
|
using namespace lldb_private;
|
|
|
|
|
2017-02-17 21:27:42 +08:00
|
|
|
enum { FOO = 1, BAR = 2 };
|
|
|
|
static constexpr Log::Category test_categories[] = {
|
2017-03-01 18:08:51 +08:00
|
|
|
{{"foo"}, {"log foo"}, FOO}, {{"bar"}, {"log bar"}, BAR},
|
2017-02-17 21:27:42 +08:00
|
|
|
};
|
|
|
|
static constexpr uint32_t default_flags = FOO;
|
|
|
|
|
|
|
|
static Log::Channel test_channel(test_categories, default_flags);
|
|
|
|
|
2017-03-15 17:06:58 +08:00
|
|
|
// Wrap enable, disable and list functions to make them easier to test.
|
|
|
|
static bool EnableChannel(std::shared_ptr<llvm::raw_ostream> stream_sp,
|
|
|
|
uint32_t log_options, llvm::StringRef channel,
|
|
|
|
llvm::ArrayRef<const char *> categories,
|
|
|
|
std::string &error) {
|
|
|
|
error.clear();
|
|
|
|
llvm::raw_string_ostream error_stream(error);
|
|
|
|
return Log::EnableLogChannel(stream_sp, log_options, channel, categories,
|
|
|
|
error_stream);
|
|
|
|
}
|
|
|
|
|
|
|
|
static bool DisableChannel(llvm::StringRef channel,
|
|
|
|
llvm::ArrayRef<const char *> categories,
|
|
|
|
std::string &error) {
|
|
|
|
error.clear();
|
|
|
|
llvm::raw_string_ostream error_stream(error);
|
|
|
|
return Log::DisableLogChannel(channel, categories, error_stream);
|
|
|
|
}
|
|
|
|
|
|
|
|
static bool ListCategories(llvm::StringRef channel, std::string &result) {
|
|
|
|
result.clear();
|
|
|
|
llvm::raw_string_ostream result_stream(result);
|
|
|
|
return Log::ListChannelCategories(channel, result_stream);
|
|
|
|
}
|
|
|
|
|
2018-01-17 21:46:06 +08:00
|
|
|
namespace {
|
|
|
|
// A test fixture which provides tests with a pre-registered channel.
|
|
|
|
struct LogChannelTest : public ::testing::Test {
|
|
|
|
void TearDown() override { Log::DisableAllLogChannels(); }
|
|
|
|
|
|
|
|
static void SetUpTestCase() {
|
|
|
|
Log::Register("chan", test_channel);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void TearDownTestCase() {
|
|
|
|
Log::Unregister("chan");
|
|
|
|
llvm::llvm_shutdown();
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
// 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 {
|
|
|
|
llvm::SmallString<0> m_messages;
|
|
|
|
std::shared_ptr<llvm::raw_svector_ostream> m_stream_sp =
|
|
|
|
std::make_shared<llvm::raw_svector_ostream>(m_messages);
|
|
|
|
Log *m_log;
|
|
|
|
size_t m_consumed_bytes = 0;
|
|
|
|
|
|
|
|
protected:
|
|
|
|
std::shared_ptr<llvm::raw_ostream> getStream() { return m_stream_sp; }
|
|
|
|
Log *getLog() { return m_log; }
|
|
|
|
llvm::StringRef takeOutput();
|
|
|
|
llvm::StringRef logAndTakeOutput(llvm::StringRef Message);
|
|
|
|
|
|
|
|
public:
|
|
|
|
void SetUp() override;
|
|
|
|
};
|
|
|
|
} // end anonymous namespace
|
|
|
|
|
|
|
|
void LogChannelEnabledTest::SetUp() {
|
|
|
|
LogChannelTest::SetUp();
|
|
|
|
|
|
|
|
std::string error;
|
|
|
|
ASSERT_TRUE(EnableChannel(m_stream_sp, 0, "chan", {}, error));
|
|
|
|
|
|
|
|
m_log = test_channel.GetLogIfAll(FOO);
|
|
|
|
ASSERT_NE(nullptr, m_log);
|
|
|
|
}
|
|
|
|
|
|
|
|
llvm::StringRef LogChannelEnabledTest::takeOutput() {
|
|
|
|
llvm::StringRef result = m_stream_sp->str().drop_front(m_consumed_bytes);
|
|
|
|
m_consumed_bytes+= result.size();
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
|
|
|
llvm::StringRef LogChannelEnabledTest::logAndTakeOutput(llvm::StringRef Message) {
|
|
|
|
LLDB_LOG(m_log, "{0}", Message);
|
|
|
|
return takeOutput();
|
|
|
|
}
|
|
|
|
|
Add a more succinct logging syntax
This adds the LLDB_LOG macro, which enables one to write more succinct log
statements.
if (log)
log->Printf("log something: %d", var);
becomes
LLDB_LOG(log, "log something: {0}, var);
The macro still internally does the "if(log)" dance, so the arguments are only
evaluated if logging is enabled, meaning it has the same overhead as the
previous syntax.
Additionally, the log statements will be automatically prefixed with the file
and function generating the log (if the corresponding new argument to the "log
enable" command is enabled), so one does not need to manually specify this in
the log statement.
It also uses the new llvm formatv syntax, which means we don't have to worry
about PRIx64 macros and similar, and we can log complex object (llvm::StringRef,
lldb_private::Error, ...) more easily.
Differential Revision: https://reviews.llvm.org/D27459
llvm-svn: 292360
2017-01-18 19:00:26 +08:00
|
|
|
TEST(LogTest, LLDB_LOG_nullptr) {
|
|
|
|
Log *log = nullptr;
|
|
|
|
LLDB_LOG(log, "{0}", 0); // Shouldn't crash
|
|
|
|
}
|
|
|
|
|
2017-02-17 21:27:42 +08:00
|
|
|
TEST(LogTest, Register) {
|
|
|
|
llvm::llvm_shutdown_obj obj;
|
|
|
|
Log::Register("chan", test_channel);
|
|
|
|
Log::Unregister("chan");
|
|
|
|
Log::Register("chan", test_channel);
|
|
|
|
Log::Unregister("chan");
|
|
|
|
}
|
|
|
|
|
|
|
|
TEST(LogTest, Unregister) {
|
|
|
|
llvm::llvm_shutdown_obj obj;
|
|
|
|
Log::Register("chan", test_channel);
|
|
|
|
EXPECT_EQ(nullptr, test_channel.GetLogIfAny(FOO));
|
|
|
|
std::string message;
|
|
|
|
std::shared_ptr<llvm::raw_string_ostream> stream_sp(
|
|
|
|
new llvm::raw_string_ostream(message));
|
2017-03-15 17:06:58 +08:00
|
|
|
EXPECT_TRUE(Log::EnableLogChannel(stream_sp, 0, "chan", {"foo"}, llvm::nulls()));
|
2017-02-17 21:27:42 +08:00
|
|
|
EXPECT_NE(nullptr, test_channel.GetLogIfAny(FOO));
|
|
|
|
Log::Unregister("chan");
|
|
|
|
EXPECT_EQ(nullptr, test_channel.GetLogIfAny(FOO));
|
|
|
|
}
|
|
|
|
|
|
|
|
TEST_F(LogChannelTest, Enable) {
|
|
|
|
EXPECT_EQ(nullptr, test_channel.GetLogIfAll(FOO));
|
|
|
|
std::string message;
|
|
|
|
std::shared_ptr<llvm::raw_string_ostream> stream_sp(
|
|
|
|
new llvm::raw_string_ostream(message));
|
2017-03-15 17:06:58 +08:00
|
|
|
std::string error;
|
|
|
|
ASSERT_FALSE(EnableChannel(stream_sp, 0, "chanchan", {}, error));
|
|
|
|
EXPECT_EQ("Invalid log channel 'chanchan'.\n", error);
|
2017-02-17 21:27:42 +08:00
|
|
|
|
2017-03-15 17:06:58 +08:00
|
|
|
EXPECT_TRUE(EnableChannel(stream_sp, 0, "chan", {}, error));
|
2017-02-17 21:27:42 +08:00
|
|
|
EXPECT_NE(nullptr, test_channel.GetLogIfAll(FOO));
|
|
|
|
EXPECT_EQ(nullptr, test_channel.GetLogIfAll(BAR));
|
|
|
|
|
2017-03-15 17:06:58 +08:00
|
|
|
EXPECT_TRUE(EnableChannel(stream_sp, 0, "chan", {"bar"}, error));
|
2017-02-17 21:27:42 +08:00
|
|
|
EXPECT_NE(nullptr, test_channel.GetLogIfAll(FOO | BAR));
|
|
|
|
|
2017-03-15 17:06:58 +08:00
|
|
|
EXPECT_TRUE(EnableChannel(stream_sp, 0, "chan", {"baz"}, error));
|
|
|
|
EXPECT_NE(std::string::npos, error.find("unrecognized log category 'baz'"))
|
|
|
|
<< "error: " << error;
|
2017-02-17 21:27:42 +08:00
|
|
|
EXPECT_NE(nullptr, test_channel.GetLogIfAll(FOO | BAR));
|
|
|
|
}
|
|
|
|
|
2017-02-27 19:05:39 +08:00
|
|
|
TEST_F(LogChannelTest, EnableOptions) {
|
|
|
|
EXPECT_EQ(nullptr, test_channel.GetLogIfAll(FOO));
|
|
|
|
std::string message;
|
|
|
|
std::shared_ptr<llvm::raw_string_ostream> stream_sp(
|
|
|
|
new llvm::raw_string_ostream(message));
|
2017-03-15 17:06:58 +08:00
|
|
|
std::string error;
|
|
|
|
EXPECT_TRUE(
|
|
|
|
EnableChannel(stream_sp, LLDB_LOG_OPTION_VERBOSE, "chan", {}, error));
|
2017-02-27 19:05:39 +08:00
|
|
|
|
|
|
|
Log *log = test_channel.GetLogIfAll(FOO);
|
|
|
|
ASSERT_NE(nullptr, log);
|
|
|
|
EXPECT_TRUE(log->GetVerbose());
|
|
|
|
}
|
|
|
|
|
2017-02-17 21:27:42 +08:00
|
|
|
TEST_F(LogChannelTest, Disable) {
|
|
|
|
EXPECT_EQ(nullptr, test_channel.GetLogIfAll(FOO));
|
|
|
|
std::string message;
|
|
|
|
std::shared_ptr<llvm::raw_string_ostream> stream_sp(
|
|
|
|
new llvm::raw_string_ostream(message));
|
2017-03-15 17:06:58 +08:00
|
|
|
std::string error;
|
|
|
|
EXPECT_TRUE(EnableChannel(stream_sp, 0, "chan", {"foo", "bar"}, error));
|
2017-02-17 21:27:42 +08:00
|
|
|
EXPECT_NE(nullptr, test_channel.GetLogIfAll(FOO | BAR));
|
|
|
|
|
2017-03-15 17:06:58 +08:00
|
|
|
EXPECT_TRUE(DisableChannel("chan", {"bar"}, error));
|
2017-02-17 21:27:42 +08:00
|
|
|
EXPECT_NE(nullptr, test_channel.GetLogIfAll(FOO));
|
|
|
|
EXPECT_EQ(nullptr, test_channel.GetLogIfAll(BAR));
|
|
|
|
|
2017-03-15 17:06:58 +08:00
|
|
|
EXPECT_TRUE(DisableChannel("chan", {"baz"}, error));
|
|
|
|
EXPECT_NE(std::string::npos, error.find("unrecognized log category 'baz'"))
|
|
|
|
<< "error: " << error;
|
2017-02-17 21:27:42 +08:00
|
|
|
EXPECT_NE(nullptr, test_channel.GetLogIfAll(FOO));
|
|
|
|
EXPECT_EQ(nullptr, test_channel.GetLogIfAll(BAR));
|
|
|
|
|
2017-03-15 17:06:58 +08:00
|
|
|
EXPECT_TRUE(DisableChannel("chan", {}, error));
|
2017-02-17 21:27:42 +08:00
|
|
|
EXPECT_EQ(nullptr, test_channel.GetLogIfAny(FOO | BAR));
|
|
|
|
}
|
|
|
|
|
|
|
|
TEST_F(LogChannelTest, List) {
|
2017-03-15 17:06:58 +08:00
|
|
|
std::string list;
|
|
|
|
EXPECT_TRUE(ListCategories("chan", list));
|
2017-02-17 21:27:42 +08:00
|
|
|
std::string expected =
|
|
|
|
R"(Logging categories for 'chan':
|
|
|
|
all - all available logging categories
|
|
|
|
default - default set of logging categories
|
|
|
|
foo - log foo
|
|
|
|
bar - log bar
|
|
|
|
)";
|
2017-03-15 17:06:58 +08:00
|
|
|
EXPECT_EQ(expected, list);
|
2017-02-17 21:27:42 +08:00
|
|
|
|
2017-03-15 17:06:58 +08:00
|
|
|
EXPECT_FALSE(ListCategories("chanchan", list));
|
|
|
|
EXPECT_EQ("Invalid log channel 'chanchan'.\n", list);
|
2017-02-17 21:27:42 +08:00
|
|
|
}
|
2017-02-21 17:58:23 +08:00
|
|
|
|
2018-01-17 21:46:06 +08:00
|
|
|
TEST_F(LogChannelEnabledTest, log_options) {
|
|
|
|
std::string Err;
|
|
|
|
EXPECT_EQ("Hello World\n", logAndTakeOutput("Hello World"));
|
|
|
|
EXPECT_TRUE(EnableChannel(getStream(), LLDB_LOG_OPTION_THREADSAFE, "chan", {},
|
|
|
|
Err));
|
|
|
|
EXPECT_EQ("Hello World\n", logAndTakeOutput("Hello World"));
|
2017-03-07 03:10:19 +08:00
|
|
|
|
|
|
|
{
|
2018-01-17 21:46:06 +08:00
|
|
|
EXPECT_TRUE(EnableChannel(getStream(), LLDB_LOG_OPTION_PREPEND_SEQUENCE,
|
|
|
|
"chan", {}, Err));
|
|
|
|
llvm::StringRef Msg = logAndTakeOutput("Hello World");
|
2017-03-07 03:10:19 +08:00
|
|
|
int seq_no;
|
2018-01-17 21:46:06 +08:00
|
|
|
EXPECT_EQ(1, sscanf(Msg.str().c_str(), "%d Hello World", &seq_no));
|
2017-03-07 03:10:19 +08:00
|
|
|
}
|
|
|
|
|
2018-05-15 05:04:24 +08:00
|
|
|
{
|
|
|
|
EXPECT_TRUE(EnableChannel(getStream(), LLDB_LOG_OPTION_PREPEND_FILE_FUNCTION,
|
|
|
|
"chan", {}, Err));
|
|
|
|
llvm::StringRef Msg = logAndTakeOutput("Hello World");
|
|
|
|
char File[12];
|
|
|
|
char Function[17];
|
|
|
|
|
|
|
|
sscanf(Msg.str().c_str(), "%[^:]:%s Hello World", File, Function);
|
|
|
|
EXPECT_STRCASEEQ("LogTest.cpp", File);
|
|
|
|
EXPECT_STREQ("logAndTakeOutput", Function);
|
|
|
|
}
|
2017-03-07 03:10:19 +08:00
|
|
|
|
2018-01-17 21:46:06 +08:00
|
|
|
EXPECT_TRUE(EnableChannel(
|
|
|
|
getStream(), LLDB_LOG_OPTION_PREPEND_PROC_AND_THREAD, "chan", {}, Err));
|
|
|
|
EXPECT_EQ(llvm::formatv("[{0,0+4}/{1,0+4}] Hello World\n", ::getpid(),
|
2017-03-07 03:10:19 +08:00
|
|
|
llvm::get_threadid())
|
|
|
|
.str(),
|
2018-01-17 21:46:06 +08:00
|
|
|
logAndTakeOutput("Hello World"));
|
2017-03-07 03:10:19 +08:00
|
|
|
}
|
|
|
|
|
2018-01-30 20:19:34 +08:00
|
|
|
TEST_F(LogChannelEnabledTest, LLDB_LOG_ERROR) {
|
|
|
|
LLDB_LOG_ERROR(getLog(), llvm::Error::success(), "Foo failed: {0}");
|
|
|
|
ASSERT_EQ("", takeOutput());
|
|
|
|
|
|
|
|
LLDB_LOG_ERROR(getLog(),
|
|
|
|
llvm::make_error<llvm::StringError>(
|
|
|
|
"My Error", llvm::inconvertibleErrorCode()),
|
|
|
|
"Foo failed: {0}");
|
|
|
|
ASSERT_EQ("Foo failed: My Error\n", takeOutput());
|
|
|
|
|
|
|
|
// Doesn't log, but doesn't assert either
|
|
|
|
LLDB_LOG_ERROR(nullptr,
|
|
|
|
llvm::make_error<llvm::StringError>(
|
|
|
|
"My Error", llvm::inconvertibleErrorCode()),
|
|
|
|
"Foo failed: {0}");
|
|
|
|
}
|
|
|
|
|
2018-01-17 21:46:06 +08:00
|
|
|
TEST_F(LogChannelEnabledTest, LogThread) {
|
2017-02-21 17:58:23 +08:00
|
|
|
// Test that we are able to concurrently write to a log channel and disable
|
|
|
|
// it.
|
2017-03-15 17:06:58 +08:00
|
|
|
std::string err;
|
2017-02-21 17:58:23 +08:00
|
|
|
|
|
|
|
// Start logging on one thread. Concurrently, try disabling the log channel.
|
2018-01-17 21:46:06 +08:00
|
|
|
std::thread log_thread([this] { LLDB_LOG(getLog(), "Hello World"); });
|
2017-03-15 17:06:58 +08:00
|
|
|
EXPECT_TRUE(DisableChannel("chan", {}, err));
|
2017-02-21 17:58:23 +08:00
|
|
|
log_thread.join();
|
|
|
|
|
|
|
|
// The log thread either managed to write to the log in time, or it didn't. In
|
|
|
|
// either case, we should not trip any undefined behavior (run the test under
|
|
|
|
// TSAN to verify this).
|
2018-01-17 21:46:06 +08:00
|
|
|
EXPECT_THAT(takeOutput(), testing::AnyOf("", "Hello World\n"));
|
2017-02-21 17:58:23 +08:00
|
|
|
}
|
2017-03-09 18:16:07 +08:00
|
|
|
|
2018-01-17 21:46:06 +08:00
|
|
|
TEST_F(LogChannelEnabledTest, LogVerboseThread) {
|
2017-03-09 18:16:07 +08:00
|
|
|
// Test that we are able to concurrently check the verbose flag of a log
|
|
|
|
// channel and enable it.
|
2017-03-15 17:06:58 +08:00
|
|
|
std::string err;
|
2017-03-09 18:16:07 +08:00
|
|
|
|
|
|
|
// Start logging on one thread. Concurrently, try enabling the log channel
|
|
|
|
// (with different log options).
|
2018-01-17 21:46:06 +08:00
|
|
|
std::thread log_thread([this] { LLDB_LOGV(getLog(), "Hello World"); });
|
|
|
|
EXPECT_TRUE(
|
|
|
|
EnableChannel(getStream(), LLDB_LOG_OPTION_VERBOSE, "chan", {}, err));
|
2017-03-09 18:16:07 +08:00
|
|
|
log_thread.join();
|
|
|
|
|
|
|
|
// The log thread either managed to write to the log, or it didn't. In either
|
|
|
|
// case, we should not trip any undefined behavior (run the test under TSAN to
|
|
|
|
// verify this).
|
2018-01-17 21:46:06 +08:00
|
|
|
EXPECT_THAT(takeOutput(), testing::AnyOf("", "Hello World\n"));
|
2017-03-09 18:16:07 +08:00
|
|
|
}
|
|
|
|
|
2018-01-17 21:46:06 +08:00
|
|
|
TEST_F(LogChannelEnabledTest, LogGetLogThread) {
|
2017-03-09 18:16:07 +08:00
|
|
|
// Test that we are able to concurrently get mask of a Log object and disable
|
|
|
|
// it.
|
2017-03-15 17:06:58 +08:00
|
|
|
std::string err;
|
2017-03-09 18:16:07 +08:00
|
|
|
|
2018-01-17 21:46:06 +08:00
|
|
|
// Try fetching the log mask on one thread. Concurrently, try disabling the
|
|
|
|
// log channel.
|
2017-03-09 18:16:07 +08:00
|
|
|
uint32_t mask;
|
2018-01-17 21:46:06 +08:00
|
|
|
std::thread log_thread([this, &mask] { mask = getLog()->GetMask().Get(); });
|
2017-03-15 17:06:58 +08:00
|
|
|
EXPECT_TRUE(DisableChannel("chan", {}, err));
|
2017-03-09 18:16:07 +08:00
|
|
|
log_thread.join();
|
|
|
|
|
|
|
|
// The mask should be either zero of "FOO". In either case, we should not trip
|
|
|
|
// any undefined behavior (run the test under TSAN to verify this).
|
2018-01-17 21:46:06 +08:00
|
|
|
EXPECT_THAT(mask, testing::AnyOf(0, FOO));
|
2017-03-09 18:16:07 +08:00
|
|
|
}
|