24 "Crash with a message to this category instead of the default");
25 DEFINE_bool(crash,
true,
"Crash with a fatal log message.");
29 "Print whether this binary was built in debug mode " 30 "and then exit successfully");
32 DEFINE_bool(fail_fatal_xlog_if,
false,
"Fail an XLOG_IF(FATAL) check.");
33 DEFINE_bool(fail_dfatal_xlog_if,
false,
"Fail an XLOG_IF(DFATAL) check.");
34 DEFINE_bool(fail_xcheck,
false,
"Fail an XCHECK() test.");
38 "Fail an XCHECK() test with no additional message.");
39 DEFINE_bool(fail_xdcheck,
false,
"Fail an XDCHECK() test.");
53 InitChecker() : value_{getenv(
"CRASH_DURING_INIT")} {
54 if (value_ && strcmp(value_,
"shutdown") != 0) {
55 XLOG(FATAL) <<
"crashing during static initialization";
60 XLOG(FATAL) <<
"crashing during static destruction";
64 const char* value_{
nullptr};
67 static InitChecker initChecker;
72 if (!FLAGS_category.empty()) {
74 FB_LOG(logger, FATAL,
"crashing to category ", FLAGS_category);
81 XLOG(FATAL) <<
"test program crashing!";
90 FB_LOG(logger, FATAL) <<
"we always crash";
101 if (FLAGS_check_debug) {
106 XLOG_IF(FATAL, FLAGS_fail_fatal_xlog_if) <<
"--fail_fatal_xlog_if specified!";
107 XLOG_IF(DFATAL, FLAGS_fail_dfatal_xlog_if)
108 <<
"--fail_dfatal_xlog_if specified!";
109 XCHECK(!FLAGS_fail_xcheck) <<
": --fail_xcheck specified!";
110 XCHECK(!FLAGS_fail_xcheck_nomsg);
111 XDCHECK(!FLAGS_fail_xdcheck) <<
": --fail_xdcheck specified!";
DEFINE_bool(crash, true,"Crash with a fatal log message.")
int main(int argc, char *argv[])
#define FB_LOG(logger, level,...)
DEFINE_string(category,"","Crash with a message to this category instead of the default")
std::string fbLogFatalCheck()
#define XLOG_IF(level, cond,...)
#define XDCHECK(cond,...)