test: Only pass unused args to GoogleTest

pull/49/head
David Drysdale 9 years ago
parent a9021ed8ab
commit af5c33bbbf
  1. 6
      test/ares-test-main.cc

@ -4,15 +4,19 @@
#include "ares-test.h" #include "ares-test.h"
int main(int argc, char* argv[]) { int main(int argc, char* argv[]) {
::testing::InitGoogleTest(&argc, argv); std::vector<char*> gtest_argv = {argv[0]};
for (int ii = 1; ii < argc; ii++) { for (int ii = 1; ii < argc; ii++) {
if (strcmp(argv[ii], "-v") == 0) { if (strcmp(argv[ii], "-v") == 0) {
ares::test::verbose = true; ares::test::verbose = true;
} else if ((strcmp(argv[ii], "-p") == 0) && (ii + 1 < argc)) { } else if ((strcmp(argv[ii], "-p") == 0) && (ii + 1 < argc)) {
ii++; ii++;
ares::test::mock_port = atoi(argv[ii]); ares::test::mock_port = atoi(argv[ii]);
} else {
gtest_argv.push_back(argv[ii]);
} }
} }
int gtest_argc = gtest_argv.size();
::testing::InitGoogleTest(&gtest_argc, gtest_argv.data());
#ifdef WIN32 #ifdef WIN32
WORD wVersionRequested = MAKEWORD(2, 2); WORD wVersionRequested = MAKEWORD(2, 2);

Loading…
Cancel
Save