17 #include "my_config.h"
18 #include <gtest/gtest.h>
20 #include "thread_utils.h"
22 #include "my_global.h"
28 namespace dbug_unittest {
31 TEST(DebugTest, NoSuicide)
36 TEST(DebugDeathTest, Suicide)
38 ::testing::FLAGS_gtest_death_test_style =
"threadsafe";
39 EXPECT_DEATH_IF_SUPPORTED(DBUG_SUICIDE(),
"");
44 #if !defined(DBUG_OFF) && !defined(__WIN__)
49 : m_start_notification(start_notification)
54 m_start_notification->notify();
63 TEST(DebugFlushGcov, FlushGcovParallel)
70 start_notification.wait_for_notification();
77 #if !defined(DBUG_OFF)
78 TEST(DebugPrintTest, PrintEval)
83 DBUG_PRINT(
"never",(
"%d",1/y));
87 TEST(DebugPrintDeathTest, PrintEval)
91 ::testing::FLAGS_gtest_death_test_style =
"threadsafe";
98 EXPECT_DEATH_IF_SUPPORTED(DBUG_PRINT(
"never",(
"%d",1/y)),
"");
103 TEST(DebugSetTest, DebugKeywordsTest)
113 DBUG_SET(
"+d,keyword");
114 DBUG_EXPLAIN(buf,
sizeof(buf));
115 EXPECT_STREQ(
"d", buf);
122 DBUG_SET(
"+d,keyword");
123 DBUG_EXPLAIN(buf,
sizeof(buf));
124 EXPECT_STREQ(
"d,keyword", buf);
130 DBUG_SET(
"-d,keyword");
131 DBUG_EXPLAIN(buf,
sizeof(buf));
132 EXPECT_STREQ(
"",buf);
139 DBUG_SET(
"+d,keyword");
141 DBUG_EXPLAIN(buf,
sizeof(buf));
142 EXPECT_STREQ(
"d",buf);
146 DBUG_SET(
"+d,keyword1");
147 DBUG_SET(
"+d,keyword2");
148 DBUG_EXPLAIN(buf,
sizeof(buf));
149 EXPECT_STREQ(
"d,keyword1,keyword2",buf);
150 DBUG_SET(
"-d,keyword1");
151 DBUG_EXPLAIN(buf,
sizeof(buf));
152 EXPECT_STREQ(
"d,keyword2",buf);
153 DBUG_SET(
"-d,keyword2");
154 DBUG_EXPLAIN(buf,
sizeof(buf));
155 EXPECT_STREQ(
"",buf);