| 70 | |
| 71 | |
| 72 | int main(int argc, char** argv) |
| 73 | { |
| 74 | Flags flags; |
| 75 | |
| 76 | // Load flags from environment and command line but allow unknown |
| 77 | // flags (since we might have gtest/gmock flags as well). |
| 78 | Try<flags::Warnings> load = flags.load("LIBPROCESS_", argc, argv, true); |
| 79 | |
| 80 | if (flags.help) { |
| 81 | cout << flags.usage() << endl; |
| 82 | testing::InitGoogleMock(&argc, argv); // Get usage from gtest too. |
| 83 | return EXIT_SUCCESS; |
| 84 | } |
| 85 | |
| 86 | if (load.isError()) { |
| 87 | cerr << flags.usage(load.error()) << endl; |
| 88 | return EXIT_FAILURE; |
| 89 | } |
| 90 | |
| 91 | process::TEST_AWAIT_TIMEOUT = flags.test_await_timeout; |
| 92 | |
| 93 | // Initialize Google Mock/Test. |
| 94 | testing::InitGoogleMock(&argc, argv); |
| 95 | |
| 96 | #if !GTEST_IS_THREADSAFE |
| 97 | EXIT(EXIT_FAILURE) << "Testing environment is not thread safe, bailing!"; |
| 98 | #endif // !GTEST_IS_THREADSAFE |
| 99 | |
| 100 | // Initialize libprocess. |
| 101 | process::initialize( |
| 102 | None(), |
| 103 | process::READWRITE_HTTP_AUTHENTICATION_REALM, |
| 104 | process::READONLY_HTTP_AUTHENTICATION_REALM); |
| 105 | |
| 106 | // NOTE: Windows does not support signal semantics required for these |
| 107 | // handlers to be useful. |
| 108 | #ifndef __WINDOWS__ |
| 109 | // Install GLOG's signal handler. |
| 110 | google::InstallFailureSignalHandler(); |
| 111 | |
| 112 | // We reset the GLOG's signal handler for SIGTERM because |
| 113 | // 'SubprocessTest.Status' sends SIGTERM to a subprocess which |
| 114 | // results in a stack trace otherwise. |
| 115 | os::signals::reset(SIGTERM); |
| 116 | #endif // __WINDOWS__ |
| 117 | |
| 118 | vector<shared_ptr<TestFilter>> filters = {}; |
| 119 | Environment* environment = new Environment(filters); |
| 120 | testing::AddGlobalTestEnvironment(environment); |
| 121 | |
| 122 | // Add the libprocess test event listeners. |
| 123 | ::testing::TestEventListeners& listeners = |
| 124 | ::testing::UnitTest::GetInstance()->listeners(); |
| 125 | |
| 126 | listeners.Append(process::ClockTestEventListener::instance()); |
| 127 | listeners.Append(process::FilterTestEventListener::instance()); |
| 128 | |
| 129 | int result = RUN_ALL_TESTS(); |
nothing calls this directly
no test coverage detected