THRIFT-847 Test Framework harmonization across all languages
cross test speed up from 30min to 6
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 @@
# 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 @@
# 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 66ffb1d..bfc619a 100755
--- a/lib/java/build.xml
+++ b/lib/java/build.xml
@@ -232,8 +232,9 @@
</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 @@
<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 @@
<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}"/>
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 @@
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 @@
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_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 @@
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 @@
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 @@
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 @@
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 @@
"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 @@
"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 @@
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 @@
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 -