| 65 | |
| 66 | |
| 67 | int main(int argc, char** argv) |
| 68 | { |
| 69 | #ifdef __WINDOWS__ |
| 70 | if (!net::wsa_initialize()) { |
| 71 | cerr << "WSA failed to initialize" << endl; |
| 72 | return EXIT_FAILURE; |
| 73 | } |
| 74 | |
| 75 | // When we're running a debug build, the Windows implementation of the C |
| 76 | // runtime will validate parameters passed to C-standard functions like |
| 77 | // `::close`. When we are in debug mode, if a parameter is invalid, the |
| 78 | // handler will usually call `abort`, rather than populating `errno` and |
| 79 | // returning an error value. Since we expect some tests to pass invalid |
| 80 | // paramaters to these functions, we disable this for testing. |
| 81 | _set_invalid_parameter_handler(noop_invalid_parameter_handler); |
| 82 | #endif // __WINDOWS__ |
| 83 | |
| 84 | GOOGLE_PROTOBUF_VERIFY_VERSION; |
| 85 | |
| 86 | using mesos::internal::tests::flags; // Needed to disambiguate. |
| 87 | |
| 88 | // Load flags from environment and command line but allow unknown |
| 89 | // flags (since we might have gtest/gmock flags as well). |
| 90 | Try<flags::Warnings> load = flags.load("MESOS_", argc, argv, true); |
| 91 | |
| 92 | if (flags.help) { |
| 93 | cout << flags.usage() << endl; |
| 94 | testing::InitGoogleMock(&argc, argv); // Get usage from gtest too. |
| 95 | return EXIT_SUCCESS; |
| 96 | } |
| 97 | |
| 98 | if (load.isError()) { |
| 99 | cerr << flags.usage(load.error()) << endl; |
| 100 | return EXIT_FAILURE; |
| 101 | } |
| 102 | |
| 103 | // Be quiet by default! |
| 104 | if (!flags.verbose) { |
| 105 | flags.quiet = true; |
| 106 | } |
| 107 | |
| 108 | process::TEST_AWAIT_TIMEOUT = flags.test_await_timeout; |
| 109 | |
| 110 | // Initialize logging. |
| 111 | logging::initialize(argv[0], true, flags); |
| 112 | |
| 113 | // Log any flag warnings (after logging is initialized). |
| 114 | foreach (const flags::Warning& warning, load->warnings) { |
| 115 | LOG(WARNING) << warning.message; |
| 116 | } |
| 117 | |
| 118 | // TODO(josephw): Modules are not supported on Windows (MESOS-5994). |
| 119 | #ifndef __WINDOWS__ |
| 120 | // Initialize Modules. |
| 121 | if (flags.modules.isSome() && flags.modulesDir.isSome()) { |
| 122 | EXIT(EXIT_FAILURE) << |
| 123 | flags.usage("Only one of --modules or --modules_dir should be specified"); |
| 124 | } |
nothing calls this directly
no test coverage detected