diff options
Diffstat (limited to '')
-rw-r--r-- | src/c-ares/test/ares-test-main.cc | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/src/c-ares/test/ares-test-main.cc b/src/c-ares/test/ares-test-main.cc new file mode 100644 index 000000000..f7e90cb49 --- /dev/null +++ b/src/c-ares/test/ares-test-main.cc @@ -0,0 +1,37 @@ +#include <signal.h> +#include <stdlib.h> + +#include "ares-test.h" + +int main(int argc, char* argv[]) { + std::vector<char*> gtest_argv = {argv[0]}; + for (int ii = 1; ii < argc; ii++) { + if (strcmp(argv[ii], "-v") == 0) { + ares::test::verbose = true; + } else if ((strcmp(argv[ii], "-p") == 0) && (ii + 1 < argc)) { + ii++; + ares::test::mock_port = atoi(argv[ii]); + } else { + gtest_argv.push_back(argv[ii]); + } + } + int gtest_argc = gtest_argv.size(); + gtest_argv.push_back(nullptr); + ::testing::InitGoogleTest(>est_argc, gtest_argv.data()); + +#ifdef WIN32 + WORD wVersionRequested = MAKEWORD(2, 2); + WSADATA wsaData; + WSAStartup(wVersionRequested, &wsaData); +#else + signal(SIGPIPE, SIG_IGN); +#endif + + int rc = RUN_ALL_TESTS(); + +#ifdef WIN32 + WSACleanup(); +#endif + + return rc; +} |