THRIFT-3360 Improve cross test servers and clients further
This closes #629
diff --git a/test/cpp/src/TestClient.cpp b/test/cpp/src/TestClient.cpp
index 7c425a9..e709899 100644
--- a/test/cpp/src/TestClient.cpp
+++ b/test/cpp/src/TestClient.cpp
@@ -107,6 +107,12 @@
}
int main(int argc, char** argv) {
+ int ERR_BASETYPES = 1;
+ int ERR_STRUCTS = 2;
+ int ERR_CONTAINERS = 4;
+ int ERR_EXCEPTIONS = 8;
+ int ERR_UNKNOWN = 64;
+
string file_path = boost::filesystem::system_complete(argv[0]).string();
string dir_path = file_path.substr(0, file_path.size() - EXECUTABLE_FILE_NAME_LENGTH);
#if _WIN32
@@ -149,7 +155,7 @@
if (vm.count("help")) {
cout << desc << "\n";
- return 1;
+ return ERR_UNKNOWN;
}
try {
@@ -175,7 +181,7 @@
} catch (std::exception& e) {
cerr << e.what() << endl;
cout << desc << "\n";
- return 1;
+ return ERR_UNKNOWN;
}
if (vm.count("ssl")) {
@@ -267,10 +273,6 @@
uint64_t time_tot = 0;
int return_code = 0;
- int ERR_BASETYPES = 1;
- int ERR_STRUCTS = 2;
- int ERR_CONTAINERS = 4;
- int ERR_EXCEPTIONS = 8;
int test = 0;
for (test = 0; test < numTests; ++test) {
@@ -279,7 +281,7 @@
transport->open();
} catch (TTransportException& ttx) {
printf("Connect failed: %s\n", ttx.what());
- return 1;
+ return ERR_UNKNOWN;
}
/**
diff --git a/test/cpp/src/TestServer.cpp b/test/cpp/src/TestServer.cpp
index e5bc31e..66d3bb2 100644
--- a/test/cpp/src/TestServer.cpp
+++ b/test/cpp/src/TestServer.cpp
@@ -221,34 +221,14 @@
}
void testInsanity(map<UserId, map<Numberz::type, Insanity> >& insane, const Insanity& argument) {
- (void)argument;
printf("testInsanity()\n");
- Xtruct hello;
- hello.string_thing = "Hello2";
- hello.byte_thing = 2;
- hello.i32_thing = 2;
- hello.i64_thing = 2;
-
- Xtruct goodbye;
- goodbye.string_thing = "Goodbye4";
- goodbye.byte_thing = 4;
- goodbye.i32_thing = 4;
- goodbye.i64_thing = 4;
-
- Insanity crazy;
- crazy.userMap.insert(make_pair(Numberz::EIGHT, 8));
- crazy.xtructs.push_back(goodbye);
-
Insanity looney;
- crazy.userMap.insert(make_pair(Numberz::FIVE, 5));
- crazy.xtructs.push_back(hello);
-
map<Numberz::type, Insanity> first_map;
map<Numberz::type, Insanity> second_map;
- first_map.insert(make_pair(Numberz::TWO, crazy));
- first_map.insert(make_pair(Numberz::THREE, crazy));
+ first_map.insert(make_pair(Numberz::TWO, argument));
+ first_map.insert(make_pair(Numberz::THREE, argument));
second_map.insert(make_pair(Numberz::SIX, looney));