butil_unittest_main.cpp 753 Bytes
Newer Older
gejun's avatar
gejun committed
1
// Copyright (c) 2014 Baidu, Inc.
gejun's avatar
gejun committed
2 3 4 5

#include <sys/resource.h>
#include <gtest/gtest.h>
#include <gflags/gflags.h>
6
#include "butil/at_exit.h"
7
#include "butil/logging.h"
8
#include "multiprocess_func_list.h"
gejun's avatar
gejun committed
9

10
DEFINE_bool(disable_coredump, false, "Never core dump");
gejun's avatar
gejun committed
11 12

int main(int argc, char** argv) {
13
    butil::AtExitManager at_exit;
gejun's avatar
gejun committed
14 15
    testing::InitGoogleTest(&argc, argv);
    
16
    GFLAGS_NS::ParseCommandLineFlags(&argc, &argv, true);
gejun's avatar
gejun committed
17 18 19 20 21 22
    if (FLAGS_disable_coredump) {
        rlimit core_limit;
        core_limit.rlim_cur = 0;
        core_limit.rlim_max = 0;
        setrlimit(RLIMIT_CORE, &core_limit);
    }
23
#if !BRPC_WITH_GLOG
24
    CHECK(!GFLAGS_NS::SetCommandLineOption("crash_on_fatal_log", "true").empty());
25
#endif
gejun's avatar
gejun committed
26 27
    return RUN_ALL_TESTS();
}