You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@thrift.apache.org by he...@apache.org on 2014/04/30 16:36:58 UTC

git commit: THRIFT-847 Test Framework harmonization across all languages

Repository: thrift
Updated Branches:
  refs/heads/master 2bc4b130d -> d17f1c98e


THRIFT-847 Test Framework harmonization across all languages

cross test speed up from 30min to 6


Project: http://git-wip-us.apache.org/repos/asf/thrift/repo
Commit: http://git-wip-us.apache.org/repos/asf/thrift/commit/d17f1c98
Tree: http://git-wip-us.apache.org/repos/asf/thrift/tree/d17f1c98
Diff: http://git-wip-us.apache.org/repos/asf/thrift/diff/d17f1c98

Branch: refs/heads/master
Commit: d17f1c98e64e6392a981308516eca5f489c27c57
Parents: 2bc4b13
Author: henrique <he...@apache.org>
Authored: Wed Apr 30 16:21:25 2014 +0200
Committer: henrique <he...@apache.org>
Committed: Wed Apr 30 16:36:31 2014 +0200

----------------------------------------------------------------------
 .travis.yml        |  9 +++---
 lib/java/build.xml | 15 +++++----
 test/test.sh       | 83 +++++++++++++++++++++++++++----------------------
 3 files changed, 60 insertions(+), 47 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/thrift/blob/d17f1c98/.travis.yml
----------------------------------------------------------------------
diff --git a/.travis.yml b/.travis.yml
index c494d79..b8b80ad 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -19,11 +19,12 @@
 
 # build Apache Thrift on Travis CI - https://travis-ci.org/
 
-language: php
+language: cpp
 
 cache:
  - apt
  - npm
+ - maven
 
 # see what we need: http://thrift.apache.org/docs/install/ubuntu
 before_install:
@@ -34,8 +35,8 @@ before_install:
 # Java
  - sudo apt-get install -qq ant
 # Ruby
- - gem uninstall bundler -I -x
- - gem install bundler -v 1.3.5
+# - gem uninstall bundler -I -x
+ - gem install bundler -v 1.3.5 || true
 # Python
 # - sudo apt-get install -qq python-all python-all-dev python-all-dbg
 # Perl
@@ -71,7 +72,7 @@ script:
 # TODO: fix these languages
   - sh configure --without-erlang --without-haskell --without-python
   - make -j$NUM_CPU && make dist
-  - make check -j$NUM_CPU && sh test/test.sh
+  - make cross -j$NUM_CPU
   - sh bootstrap.sh ; sh contrib/mingw-cross-compile.sh
 # TODO: add these steps
 #  - sh bootstrap.sh ; dpkg-buildpackage -tc

http://git-wip-us.apache.org/repos/asf/thrift/blob/d17f1c98/lib/java/build.xml
----------------------------------------------------------------------
diff --git a/lib/java/build.xml b/lib/java/build.xml
index 66ffb1d..bfc619a 100755
--- a/lib/java/build.xml
+++ b/lib/java/build.xml
@@ -232,8 +232,9 @@ resolution:=optional,org.slf4j;resolution:=optional;version=&quot;[1.4,2)&quot;"
   </target>
 
   <target name="test" description="Run the full test suite" depends="junit-test,deprecated-test"/>
-
-  <target name="testclient" description="Run a test client" depends="compile-test">
+  
+  <target name="testclient" description="Run a test client" depends="compile-test, run-testclient"/>
+  <target name="run-testclient" description="Run a test client">
     <java classname="org.apache.thrift.test.TestClient"
       classpathref="test.classpath" failonerror="true" fork="true">
       <sysproperty key="javax.net.ssl.trustStore" value="${src.test}/.truststore"/>
@@ -241,8 +242,9 @@ resolution:=optional,org.slf4j;resolution:=optional;version=&quot;[1.4,2)&quot;"
       <arg line="${testargs}"/>
     </java>
   </target>
-
-  <target name="testserver" description="Run a test server" depends="compile-test">
+  
+  <target name="testserver" description="Run a test server" depends="compile-test, run-testserver"/>
+  <target name="run-testserver" description="Run a test server">
     <java classname="org.apache.thrift.test.TestServer"
       classpathref="test.classpath" failonerror="true" fork="true"> 
       <sysproperty key="javax.net.ssl.keyStore" value="${src.test}/.keystore"/>
@@ -250,8 +252,9 @@ resolution:=optional,org.slf4j;resolution:=optional;version=&quot;[1.4,2)&quot;"
       <arg line="${testargs}"/> 
     </java>
   </target>
-
-  <target name="testnonblockingserver" description="Run a test nonblocking server" depends="compile-test">
+  
+  <target name="testnonblockingserver" description="Run a test nonblocking server" depends="compile-test, run-testnonblockingserver"/>
+  <target name="run-testnonblockingserver" description="Run a test nonblocking server">
     <java classname="org.apache.thrift.test.TestNonblockingServer"
       classpathref="test.classpath" failonerror="true">
       <arg line="${testargs}"/>

http://git-wip-us.apache.org/repos/asf/thrift/blob/d17f1c98/test/test.sh
----------------------------------------------------------------------
diff --git a/test/test.sh b/test/test.sh
index 91ac175..0247e31 100755
--- a/test/test.sh
+++ b/test/test.sh
@@ -26,8 +26,9 @@
 # THRIFT-847 Test Framework harmonization across all languages
 # THRIFT-819 add Enumeration for protocol, transport and server types
 
-BASEDIR=$(dirname $0)
-cd $BASEDIR
+cd "$( dirname "$0" )"
+BASEDIR=$(pwd)
+
 
 print_header() {
   printf "%-16s %-11s %-17s %-s\n" "client-server:" "protocol:" "transport:" "result:"
@@ -51,15 +52,18 @@ do_test () {
     transport=$3
     client_exec=$4
     server_exec=$5
-    server_startup_time=$6
-    client_delay=$7
+    client_timeout=$6
+    server_startup_time=$7
     
     testname=${client_server}_${protocol}_${transport}
-    server_timeout=$((${server_startup_time}+${client_delay}))
+    server_timeout=$((${server_startup_time}+${client_timeout}))
     printf "%-16s %-11s %-17s" ${client_server} ${protocol} ${transport} 
+    
     timeout $server_timeout $server_exec > log/${testname}_server.log 2>&1 &
+    server_pid=$!
+    
     sleep $server_startup_time
-    $client_exec > log/${testname}_client.log 2>&1
+    timeout $client_timeout $client_exec > log/${testname}_client.log 2>&1
 
     if [ "$?" -eq "0" ]; then
       echo " success"
@@ -73,11 +77,16 @@ do_test () {
       echo ""
       print_header
     fi
-    sleep ${client_delay}
+
+    # silently kill server
+    kill ${server_pid} 2>/dev/null && wait ${server_pid} 2>/dev/null
 }
 
 echo "Apache Thrift - integration test suite"
 date
+
+ant -f ../lib/java/build.xml compile-test 1>/dev/null
+
 echo "======================================================"
 
 rm -rf log
@@ -106,7 +115,6 @@ csharp_protocols="binary compact json"
 csharp_transports="buffered framed"
 csharp_sockets="ip ip-ssl"
 
-ant -f ../lib/java/build.xml compile-test 1>/dev/null
 
 ######### java client - java server #############
 for proto in $java_protocols; do
@@ -119,7 +127,7 @@ for proto in $java_protocols; do
       do_test "java-java" "${proto}" "${trans}-${sock}" \
               "ant -f  ../lib/java/build.xml -Dno-gen-thrift=\"\" -Dtestargs \"--protocol=${proto} --transport=${trans} ${extraparam}\" testclient" \
               "ant -f  ../lib/java/build.xml -Dno-gen-thrift=\"\" -Dtestargs \"--protocol=${proto} --transport=${trans} ${extraparam}\" testserver" \
-            "15" "15"
+            "10" "2"
     done
   done
 done
@@ -136,11 +144,12 @@ for proto in $cpp_protocols; do
       do_test "cpp-cpp"   "${proto}" "${trans}-${sock}" \
               "cpp/TestClient --protocol=${proto} --transport=${trans} ${extraparam}" \
               "cpp/TestServer --protocol=${proto} --transport=${trans} ${extraparam}" \
-              "10" "10"
+              "2" "1"
     done
   done
 done
 
+
 ######### java client - cpp server ##############
 # warning: ssl over http is not supported in java client!
 for proto in $(intersection "${java_protocols}" "${cpp_protocols}"); do
@@ -153,7 +162,7 @@ for proto in $(intersection "${java_protocols}" "${cpp_protocols}"); do
       do_test "java-cpp" "${proto}" "${trans}-${sock}" \
               "ant -f  ../lib/java/build.xml -Dno-gen-thrift=\"\" -Dtestargs \"--protocol=${proto} --transport=${trans} ${extraparam}\" testclient" \
               "cpp/TestServer --protocol=${proto} --transport=${trans} ${extraparam}"\
-              "10" "15"
+              "10" "1"
     done
   done
 done
@@ -169,13 +178,13 @@ for proto in $(intersection "${cpp_protocols}" "${java_protocols}"); do
       do_test "cpp-java" "${proto}" "${trans}-${sock}" \
               "cpp/TestClient --protocol=${proto} --transport=${trans} ${extraparam}" \
               "ant -f  ../lib/java/build.xml -Dno-gen-thrift=\"\" -Dtestargs \"--protocol=${proto} --transport=${trans}  ${extraparam}\" testserver" \
-              "15" "10"
+              "1" "2"
     done
   done
 done
 
 
-NODE_TEST_DIR=${BASEDIR}/../../lib/nodejs/test
+NODE_TEST_DIR=${BASEDIR}/../lib/nodejs/test
 export NODE_PATH=${NODE_TEST_DIR}:${NODE_TEST_DIR}/../lib:${NODE_PATH}
 ######### nodejs client - cpp server ##############
 ##
@@ -186,10 +195,10 @@ for proto in $(intersection "${nodejs_protocols}" "${cpp_protocols}"); do
         "ip" ) extraparam="";;
         "ip-ssl" ) extraparam="--ssl";;
       esac
-      do_test "nodejs-cpp" "${proto}" "${trans}-ip" \
-              "nodejs ${NODE_TEST_DIR}/client.js -p ${proto} -t ${trans} ${extraparam}" \
+      do_test "nodejs-cpp" "${proto}" "${trans}-${sock}" \
+              "node ${NODE_TEST_DIR}/client.js -p ${proto} -t ${trans} ${extraparam}" \
               "cpp/TestServer --protocol=${proto} --transport=${trans} ${extraparam}" \
-              "10" "10"
+              "2" "1"
     done
   done
 done
@@ -202,10 +211,10 @@ for proto in $(intersection "${nodejs_protocols}" "${cpp_protocols}"); do
         "ip" ) extraparam="";;
         "ip-ssl" ) extraparam="--ssl";;
       esac
-      do_test "cpp-nodejs" "${proto}" "${trans}-ip" \
+      do_test "cpp-nodejs" "${proto}" "${trans}-${sock}" \
               "cpp/TestClient --protocol=${proto} --transport=${trans} ${extraparam}" \
-              "nodejs ${NODE_TEST_DIR}/server.js -p ${proto} -t ${trans} ${extraparam}" \
-              "10" "10"
+              "node ${NODE_TEST_DIR}/server.js -p ${proto} -t ${trans} ${extraparam}" \
+              "2" "1"
     done
   done
 done
@@ -225,7 +234,7 @@ for proto in $csharp_protocols; do
       do_test "csharp-csharp"   "${proto}" "${trans}-${sock}" \
               "../lib/csharp/test/ThriftTest/TestClientServer.exe client --protocol=${proto} --transport=${trans} ${extraparam}" \
               "../lib/csharp/test/ThriftTest/TestClientServer.exe server --protocol=${proto} --transport=${trans} ${extraparam}" \
-              "10" "10"
+              "5" "5"
     done
   done
 done
@@ -234,57 +243,57 @@ done
 do_test "py-py" "binary" "buffered-ip" \
         "py/TestClient.py --proto=binary --port=9090 --host=localhost --genpydir=py/gen-py" \
         "py/TestServer.py --proto=binary --port=9090 --genpydir=py/gen-py TSimpleServer" \
-        "10" "10"
+        "2" "2"
 do_test "py-py" "json" "buffered-ip" \
         "py/TestClient.py --proto=json --port=9090 --host=localhost --genpydir=py/gen-py" \
         "py/TestServer.py --proto=json --port=9090 --genpydir=py/gen-py TSimpleServer" \
-        "10" "10"
+        "2" "2"
 do_test "py-cpp" "binary" "buffered-ip" \
         "py/TestClient.py --proto=binary --port=9090 --host=localhost --genpydir=py/gen-py" \
         "cpp/TestServer" \
-        "10" "10"
+        "2" "2"
 do_test "py-cpp" "json" "buffered-ip" \
         "py/TestClient.py --proto=json --port=9090 --host=localhost --genpydir=py/gen-py" \
         "cpp/TestServer --protocol=json" \
-        "10" "10"
+        "2" "2"
 do_test "cpp-py" "binary" "buffered-ip" \
         "cpp/TestClient --protocol=binary --port=9090" \
         "py/TestServer.py --proto=binary --port=9090 --genpydir=py/gen-py TSimpleServer" \
-        "10" "10"
+        "2" "2"
 do_test "cpp-py" "json" "buffered-ip" \
         "cpp/TestClient --protocol=json --port=9090" \
         "py/TestServer.py --proto=json --port=9090 --genpydir=py/gen-py TSimpleServer" \
-        "10" "10"
+        "2" "2"
 do_test "py-java"  "binary" "buffered-ip" \
         "py/TestClient.py --proto=binary --port=9090 --host=localhost --genpydir=py/gen-py" \
-        "ant -f  ../lib/java/build.xml -Dno-gen-thrift=\"\" testserver" \
-        "15" "15"
+        "ant -f  ../lib/java/build.xml -Dno-gen-thrift=\"\" run-testserver" \
+        "2" "2"
 do_test "py-java"  "json"   "buffered-ip" \
         "py/TestClient.py --proto=json --port=9090 --host=localhost --genpydir=py/gen-py" \
-        "ant -f  ../lib/java/build.xml -Dno-gen-thrift=\"\" -Dtestargs \"--protocol=json\" testserver" \
-        "15" "10"
+        "ant -f  ../lib/java/build.xml -Dno-gen-thrift=\"\" -Dtestargs \"--protocol=json\" run-testserver" \
+        "2" "2"
 do_test "java-py"  "binary" "buffered-ip" \
-        "ant -f  ../lib/java/build.xml -Dno-gen-thrift=\"\" testclient" \
+        "ant -f  ../lib/java/build.xml -Dno-gen-thrift=\"\" run-testclient" \
         "py/TestServer.py --proto=binary --port=9090 --genpydir=py/gen-py TSimpleServer" \
-        "10" "15"
+        "10" "5"
 do_test "js-java"   "json "  "http-ip" \
         "" \
         "ant -f  ../lib/js/test/build.xml unittest" \
-        "10" "15"
+        "2" "2"
 do_test "perl-cpp"  "binary" "buffered-ip" \
         "perl -I perl/gen-perl/ -I../lib/perl/lib/ perl/TestClient.pl" \
         "cpp/TestServer" \
-        "10" "10"
+        "10" "5"
 do_test "php-cpp"  "binary" "buffered-ip" \
         "make -C php/ client" \
         "cpp/TestServer" \
-        "10" "10"
+        "10" "5"
 do_test "rb-rb" "binary" "buffered-ip" \
         "ruby rb/integration/simple_client.rb" \
         "ruby rb/integration/simple_server.rb" \
-        "1" "5"
+        "5" "5"
 do_test "rb-rb" "binary-accl" "buffered-ip" \
         "ruby rb/integration/accelerated_buffered_client.rb" \
         "ruby rb/integration/accelerated_buffered_server.rb" \
-        "1" "5"
+        "5" "5"
 cd -