From d17f1c98e64e6392a981308516eca5f489c27c57 Mon Sep 17 00:00:00 2001 From: henrique Date: Wed, 30 Apr 2014 16:21:25 +0200 Subject: [PATCH] THRIFT-847 Test Framework harmonization across all languages cross test speed up from 30min to 6 --- .travis.yml | 9 ++--- lib/java/build.xml | 15 +++++---- test/test.sh | 83 +++++++++++++++++++++++++--------------------- 3 files changed, 60 insertions(+), 47 deletions(-) diff --git a/.travis.yml b/.travis.yml index c494d797..b8b80ad4 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 diff --git a/lib/java/build.xml b/lib/java/build.xml index 66ffb1d2..bfc619ab 100755 --- a/lib/java/build.xml +++ b/lib/java/build.xml @@ -232,8 +232,9 @@ resolution:=optional,org.slf4j;resolution:=optional;version="[1.4,2)"" - - + + + @@ -241,8 +242,9 @@ resolution:=optional,org.slf4j;resolution:=optional;version="[1.4,2)"" - - + + + @@ -250,8 +252,9 @@ resolution:=optional,org.slf4j;resolution:=optional;version="[1.4,2)"" - - + + + diff --git a/test/test.sh b/test/test.sh index 91ac175c..0247e31e 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 - -- 2.17.1