THRIFT-2029 Port C++ tests to Windows
authorRoger Meier <roger@apache.org>
Tue, 11 Mar 2014 20:20:35 +0000 (21:20 +0100)
committerRoger Meier <roger@apache.org>
Tue, 11 Mar 2014 20:20:35 +0000 (21:20 +0100)
THRIFT-847 Test Framework harmonization across all languages

fix compact protocol test within TestServer.cpp and TestClient.cpp
remove stuff that breaks the cross language test suite
- TestServer.cpp: cin read
- test.sh: mkfifo

Reported-by: Chamila Wijayarathna
test/cpp/src/TestClient.cpp
test/cpp/src/TestServer.cpp
test/test.sh

index 591d19d..0195139 100755 (executable)
@@ -127,6 +127,7 @@ int main(int argc, char** argv) {
   try {
     if (!protocol_type.empty()) {
       if (protocol_type == "binary") {
+      } else if (protocol_type == "compact") {
       } else if (protocol_type == "json") {
       } else {
           throw invalid_argument("Unknown protocol type "+protocol_type);
index ad7df07..11ed359 100755 (executable)
@@ -545,13 +545,14 @@ int main(int argc, char **argv) {
 
     if (!protocol_type.empty()) {
       if (protocol_type == "binary") {
+      } else if (protocol_type == "compact") {
       } else if (protocol_type == "json") {
       } else {
           throw invalid_argument("Unknown protocol type "+protocol_type);
       }
     }
 
-       if (!transport_type.empty()) {
+    if (!transport_type.empty()) {
       if (transport_type == "buffered") {
       } else if (transport_type == "framed") {
       } else if (transport_type == "http") {
@@ -689,8 +690,12 @@ int main(int argc, char **argv) {
     boost::shared_ptr<apache::thrift::concurrency::Thread> thread = factory.newThread(serverThreadRunner);
     thread->start();
 
-    cout<<"Press enter to stop the server."<<endl;
-    cin.ignore(); //wait until a key is pressed
+    // HACK: cross language test suite is unable to handle cin properly
+    //       that's why we stay in a endless loop here
+    while(1){}
+    // FIXME: find another way to stop the server (e.g. a signal)
+    // cout<<"Press enter to stop the server."<<endl;
+    // cin.ignore(); //wait until a key is pressed
 
     server->stop();
     thread->join();
index 48a2804..60a3817 100755 (executable)
@@ -57,12 +57,9 @@ do_test () {
     testname=${client_server}_${protocol}_${transport}
     server_timeout=$((${server_startup_time}+${client_delay}))
     printf "%-16s %-11s %-17s" ${client_server} ${protocol} ${transport} 
-    mkfifo thrift_test_communication
-    timeout $server_timeout $server_exec < thrift_test_communication > log/${testname}_server.log 2>&1 &
+    timeout $server_timeout $server_exec > log/${testname}_server.log 2>&1 &
     sleep $server_startup_time
     $client_exec > log/${testname}_client.log 2>&1
-    echo "done" > thrift_test_communication
-    rm -f thrift_test_communication
 
     if [ "$?" -eq "0" ]; then
       echo " success"