2012-01-09 21:23:19 +00:00
|
|
|
#!/bin/sh
|
|
|
|
#
|
|
|
|
# Licensed to the Apache Software Foundation (ASF) under one
|
|
|
|
# or more contributor license agreements. See the NOTICE file
|
|
|
|
# distributed with this work for additional information
|
|
|
|
# regarding copyright ownership. The ASF licenses this file
|
|
|
|
# to you under the Apache License, Version 2.0 (the
|
|
|
|
# "License"); you may not use this file except in compliance
|
|
|
|
# with the License. You may obtain a copy of the License at
|
|
|
|
#
|
|
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
#
|
|
|
|
# Unless required by applicable law or agreed to in writing,
|
|
|
|
# software distributed under the License is distributed on an
|
|
|
|
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
|
|
# KIND, either express or implied. See the License for the
|
|
|
|
# specific language governing permissions and limitations
|
|
|
|
# under the License.
|
|
|
|
#
|
|
|
|
|
|
|
|
# Apache Thrift - integration test suite
|
|
|
|
#
|
|
|
|
# tests different client-server, protocol and transport combinations
|
|
|
|
|
|
|
|
# related issues:
|
|
|
|
# THRIFT-847 Test Framework harmonization across all languages
|
|
|
|
# THRIFT-819 add Enumeration for protocol, transport and server types
|
|
|
|
|
2014-04-30 14:21:25 +00:00
|
|
|
cd "$( dirname "$0" )"
|
|
|
|
BASEDIR=$(pwd)
|
|
|
|
|
2012-01-09 21:23:19 +00:00
|
|
|
|
|
|
|
print_header() {
|
|
|
|
printf "%-16s %-11s %-17s %-s\n" "client-server:" "protocol:" "transport:" "result:"
|
|
|
|
}
|
|
|
|
|
2013-01-16 21:12:14 +00:00
|
|
|
intersection() {
|
|
|
|
return_value=""
|
|
|
|
for one in $1; do
|
|
|
|
for two in $2; do
|
|
|
|
if [ ${one} = ${two} ]; then
|
|
|
|
return_value=${return_value}" "${one}
|
|
|
|
fi
|
|
|
|
done;
|
|
|
|
done;
|
|
|
|
echo ${return_value};
|
|
|
|
}
|
|
|
|
|
2012-01-09 21:23:19 +00:00
|
|
|
do_test () {
|
|
|
|
client_server=$1
|
|
|
|
protocol=$2
|
|
|
|
transport=$3
|
|
|
|
client_exec=$4
|
|
|
|
server_exec=$5
|
2014-04-30 14:21:25 +00:00
|
|
|
client_timeout=$6
|
|
|
|
server_startup_time=$7
|
2012-01-09 21:23:19 +00:00
|
|
|
|
|
|
|
testname=${client_server}_${protocol}_${transport}
|
2014-04-30 14:21:25 +00:00
|
|
|
server_timeout=$((${server_startup_time}+${client_timeout}))
|
2012-01-09 21:23:19 +00:00
|
|
|
printf "%-16s %-11s %-17s" ${client_server} ${protocol} ${transport}
|
2014-04-30 14:21:25 +00:00
|
|
|
|
2014-03-11 20:20:35 +00:00
|
|
|
timeout $server_timeout $server_exec > log/${testname}_server.log 2>&1 &
|
2014-04-30 14:21:25 +00:00
|
|
|
server_pid=$!
|
|
|
|
|
2012-01-09 21:23:19 +00:00
|
|
|
sleep $server_startup_time
|
2014-04-30 14:21:25 +00:00
|
|
|
timeout $client_timeout $client_exec > log/${testname}_client.log 2>&1
|
2014-01-08 21:15:48 +00:00
|
|
|
|
2012-01-09 21:23:19 +00:00
|
|
|
if [ "$?" -eq "0" ]; then
|
|
|
|
echo " success"
|
|
|
|
else
|
|
|
|
echo " failure"
|
|
|
|
echo "=================== server message ==================="
|
|
|
|
tail log/${testname}_server.log
|
|
|
|
echo "=================== client message ==================="
|
|
|
|
tail log/${testname}_client.log
|
|
|
|
echo "======================================================"
|
2012-11-02 00:05:42 +00:00
|
|
|
echo ""
|
2012-01-09 21:23:19 +00:00
|
|
|
print_header
|
|
|
|
fi
|
2014-04-30 14:21:25 +00:00
|
|
|
|
|
|
|
# silently kill server
|
|
|
|
kill ${server_pid} 2>/dev/null && wait ${server_pid} 2>/dev/null
|
2012-01-09 21:23:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
echo "Apache Thrift - integration test suite"
|
|
|
|
date
|
2014-04-30 14:21:25 +00:00
|
|
|
|
|
|
|
ant -f ../lib/java/build.xml compile-test 1>/dev/null
|
|
|
|
|
2012-01-09 21:23:19 +00:00
|
|
|
echo "======================================================"
|
|
|
|
|
|
|
|
rm -rf log
|
|
|
|
mkdir -p log
|
|
|
|
|
|
|
|
print_header
|
|
|
|
|
2012-11-16 00:38:27 +00:00
|
|
|
#TODO add enum for parameters
|
|
|
|
#TODO align program arguments across languages
|
2012-01-09 21:23:19 +00:00
|
|
|
|
2014-02-12 08:35:12 +00:00
|
|
|
cpp_protocols="binary compact json"
|
|
|
|
java_protocols="binary compact json"
|
2013-01-16 21:12:14 +00:00
|
|
|
cpp_transports="buffered framed http"
|
|
|
|
java_server_transports="buffered framed fastframed"
|
|
|
|
java_client_transports=${java_server_transports}" http"
|
2012-01-09 21:23:19 +00:00
|
|
|
# we need a test certificate first
|
2014-04-07 22:28:17 +00:00
|
|
|
cpp_sockets="ip domain ip-ssl"
|
2013-01-16 21:12:14 +00:00
|
|
|
java_sockets="ip ip-ssl"
|
|
|
|
# TODO fastframed java transport is another implementation of framed transport
|
|
|
|
|
2014-01-26 10:44:27 +00:00
|
|
|
nodejs_protocols="binary json"
|
|
|
|
nodejs_transports="buffered framed"
|
2014-02-22 00:01:58 +00:00
|
|
|
nodejs_sockets="ip ip-ssl"
|
2012-01-09 21:23:19 +00:00
|
|
|
|
2014-04-22 20:52:43 +00:00
|
|
|
csharp_protocols="binary compact json"
|
|
|
|
csharp_transports="buffered framed"
|
|
|
|
csharp_sockets="ip ip-ssl"
|
|
|
|
|
2012-01-12 21:38:29 +00:00
|
|
|
|
2013-01-16 21:12:14 +00:00
|
|
|
######### java client - java server #############
|
|
|
|
for proto in $java_protocols; do
|
|
|
|
for trans in $java_server_transports; do
|
|
|
|
for sock in $java_sockets; do
|
|
|
|
case "$sock" in
|
|
|
|
"ip" ) extraparam="";;
|
|
|
|
"ip-ssl" ) extraparam="--ssl";;
|
|
|
|
esac
|
|
|
|
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" \
|
2014-04-30 14:21:25 +00:00
|
|
|
"10" "2"
|
2013-01-16 21:12:14 +00:00
|
|
|
done
|
|
|
|
done
|
|
|
|
done
|
|
|
|
|
|
|
|
######### cpp client - cpp server ###############
|
|
|
|
for proto in $cpp_protocols; do
|
|
|
|
for trans in $cpp_transports; do
|
|
|
|
for sock in $cpp_sockets; do
|
2012-01-09 21:23:19 +00:00
|
|
|
case "$sock" in
|
|
|
|
"ip" ) extraparam="";;
|
|
|
|
"ip-ssl" ) extraparam="--ssl";;
|
|
|
|
"domain" ) extraparam="--domain-socket=/tmp/ThriftTest.thrift";;
|
|
|
|
esac
|
|
|
|
do_test "cpp-cpp" "${proto}" "${trans}-${sock}" \
|
|
|
|
"cpp/TestClient --protocol=${proto} --transport=${trans} ${extraparam}" \
|
|
|
|
"cpp/TestServer --protocol=${proto} --transport=${trans} ${extraparam}" \
|
2014-04-30 14:21:25 +00:00
|
|
|
"2" "1"
|
2013-01-16 21:12:14 +00:00
|
|
|
done
|
|
|
|
done
|
|
|
|
done
|
|
|
|
|
2014-04-30 14:21:25 +00:00
|
|
|
|
2013-01-16 21:12:14 +00:00
|
|
|
######### java client - cpp server ##############
|
|
|
|
# warning: ssl over http is not supported in java client!
|
|
|
|
for proto in $(intersection "${java_protocols}" "${cpp_protocols}"); do
|
|
|
|
for trans in $(intersection "${java_client_transports}" "${cpp_transports}"); do
|
|
|
|
for sock in $(intersection "${java_sockets}" "${cpp_sockets}"); do
|
|
|
|
case "$sock" in
|
|
|
|
"ip" ) extraparam="";;
|
|
|
|
"ip-ssl" ) extraparam="--ssl";;
|
|
|
|
esac
|
2014-04-17 19:53:45 +00:00
|
|
|
do_test "java-cpp" "${proto}" "${trans}-${sock}" \
|
2013-01-16 21:12:14 +00:00
|
|
|
"ant -f ../lib/java/build.xml -Dno-gen-thrift=\"\" -Dtestargs \"--protocol=${proto} --transport=${trans} ${extraparam}\" testclient" \
|
|
|
|
"cpp/TestServer --protocol=${proto} --transport=${trans} ${extraparam}"\
|
2014-04-30 14:21:25 +00:00
|
|
|
"10" "1"
|
2013-01-16 21:12:14 +00:00
|
|
|
done
|
|
|
|
done
|
|
|
|
done
|
|
|
|
|
|
|
|
######### cpp client - java server ##############
|
|
|
|
for proto in $(intersection "${cpp_protocols}" "${java_protocols}"); do
|
|
|
|
for trans in $(intersection "${cpp_transports}" "${java_server_transports}"); do
|
|
|
|
for sock in $(intersection "${java_sockets}" "${cpp_sockets}"); do
|
|
|
|
case "$sock" in
|
|
|
|
"ip" ) extraparam="";;
|
|
|
|
"ip-ssl" ) extraparam="--ssl";;
|
|
|
|
esac
|
2014-04-17 19:53:45 +00:00
|
|
|
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" \
|
2014-04-30 14:21:25 +00:00
|
|
|
"1" "2"
|
2013-01-16 21:12:14 +00:00
|
|
|
done
|
|
|
|
done
|
|
|
|
done
|
2012-01-09 21:23:19 +00:00
|
|
|
|
2014-01-26 10:44:27 +00:00
|
|
|
|
2014-04-30 14:21:25 +00:00
|
|
|
NODE_TEST_DIR=${BASEDIR}/../lib/nodejs/test
|
2014-01-26 10:44:27 +00:00
|
|
|
export NODE_PATH=${NODE_TEST_DIR}:${NODE_TEST_DIR}/../lib:${NODE_PATH}
|
|
|
|
######### nodejs client - cpp server ##############
|
|
|
|
##
|
|
|
|
for proto in $(intersection "${nodejs_protocols}" "${cpp_protocols}"); do
|
|
|
|
for trans in $(intersection "${nodejs_transports}" "${cpp_transports}"); do
|
|
|
|
for sock in $(intersection "${nodejs_sockets}" "${cpp_sockets}"); do
|
2014-02-22 00:01:58 +00:00
|
|
|
case "$sock" in
|
|
|
|
"ip" ) extraparam="";;
|
|
|
|
"ip-ssl" ) extraparam="--ssl";;
|
|
|
|
esac
|
2014-04-30 14:21:25 +00:00
|
|
|
do_test "nodejs-cpp" "${proto}" "${trans}-${sock}" \
|
|
|
|
"node ${NODE_TEST_DIR}/client.js -p ${proto} -t ${trans} ${extraparam}" \
|
2014-01-26 10:44:27 +00:00
|
|
|
"cpp/TestServer --protocol=${proto} --transport=${trans} ${extraparam}" \
|
2014-04-30 14:21:25 +00:00
|
|
|
"2" "1"
|
2014-01-26 10:44:27 +00:00
|
|
|
done
|
|
|
|
done
|
|
|
|
done
|
|
|
|
|
|
|
|
######### cpp client - nodejs server ##############
|
|
|
|
for proto in $(intersection "${nodejs_protocols}" "${cpp_protocols}"); do
|
|
|
|
for trans in $(intersection "${nodejs_transports}" "${cpp_transports}"); do
|
|
|
|
for sock in $(intersection "${nodejs_sockets}" "${cpp_sockets}"); do
|
2014-02-22 00:01:58 +00:00
|
|
|
case "$sock" in
|
|
|
|
"ip" ) extraparam="";;
|
|
|
|
"ip-ssl" ) extraparam="--ssl";;
|
|
|
|
esac
|
2014-04-30 14:21:25 +00:00
|
|
|
do_test "cpp-nodejs" "${proto}" "${trans}-${sock}" \
|
2014-02-22 00:01:58 +00:00
|
|
|
"cpp/TestClient --protocol=${proto} --transport=${trans} ${extraparam}" \
|
2014-04-30 14:21:25 +00:00
|
|
|
"node ${NODE_TEST_DIR}/server.js -p ${proto} -t ${trans} ${extraparam}" \
|
|
|
|
"2" "1"
|
2014-01-26 10:44:27 +00:00
|
|
|
done
|
|
|
|
done
|
|
|
|
done
|
|
|
|
|
2012-11-02 07:50:24 +00:00
|
|
|
# delete Unix Domain Socket used by cpp tests
|
|
|
|
rm -f /tmp/ThriftTest.thrift
|
|
|
|
|
2014-04-22 20:52:43 +00:00
|
|
|
######### csharp client - csharp server #############
|
|
|
|
export MONO_PATH=../lib/csharp
|
|
|
|
for proto in $csharp_protocols; do
|
|
|
|
for trans in $csharp_transports; do
|
|
|
|
for sock in $csharp_sockets; do
|
|
|
|
case "$sock" in
|
|
|
|
"ip" ) extraparam="";;
|
|
|
|
"ip-ssl" ) extraparam="--ssl";;
|
|
|
|
esac
|
|
|
|
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}" \
|
2014-04-30 14:21:25 +00:00
|
|
|
"5" "5"
|
2014-04-22 20:52:43 +00:00
|
|
|
done
|
|
|
|
done
|
|
|
|
done
|
|
|
|
|
|
|
|
|
2012-11-02 00:05:42 +00:00
|
|
|
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" \
|
2014-04-30 14:21:25 +00:00
|
|
|
"2" "2"
|
2012-11-02 00:05:42 +00:00
|
|
|
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" \
|
2014-04-30 14:21:25 +00:00
|
|
|
"2" "2"
|
2012-11-02 00:05:42 +00:00
|
|
|
do_test "py-cpp" "binary" "buffered-ip" \
|
|
|
|
"py/TestClient.py --proto=binary --port=9090 --host=localhost --genpydir=py/gen-py" \
|
|
|
|
"cpp/TestServer" \
|
2014-04-30 14:21:25 +00:00
|
|
|
"2" "2"
|
2012-11-02 00:05:42 +00:00
|
|
|
do_test "py-cpp" "json" "buffered-ip" \
|
|
|
|
"py/TestClient.py --proto=json --port=9090 --host=localhost --genpydir=py/gen-py" \
|
|
|
|
"cpp/TestServer --protocol=json" \
|
2014-04-30 14:21:25 +00:00
|
|
|
"2" "2"
|
2012-11-02 00:05:42 +00:00
|
|
|
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" \
|
2014-04-30 14:21:25 +00:00
|
|
|
"2" "2"
|
2012-11-02 00:05:42 +00:00
|
|
|
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" \
|
2014-04-30 14:21:25 +00:00
|
|
|
"2" "2"
|
2012-11-02 00:05:42 +00:00
|
|
|
do_test "py-java" "binary" "buffered-ip" \
|
|
|
|
"py/TestClient.py --proto=binary --port=9090 --host=localhost --genpydir=py/gen-py" \
|
2014-04-30 14:21:25 +00:00
|
|
|
"ant -f ../lib/java/build.xml -Dno-gen-thrift=\"\" run-testserver" \
|
|
|
|
"2" "2"
|
2014-03-10 11:35:41 +00:00
|
|
|
do_test "py-java" "json" "buffered-ip" \
|
2012-11-02 00:05:42 +00:00
|
|
|
"py/TestClient.py --proto=json --port=9090 --host=localhost --genpydir=py/gen-py" \
|
2014-04-30 14:21:25 +00:00
|
|
|
"ant -f ../lib/java/build.xml -Dno-gen-thrift=\"\" -Dtestargs \"--protocol=json\" run-testserver" \
|
|
|
|
"2" "2"
|
2012-11-02 00:05:42 +00:00
|
|
|
do_test "java-py" "binary" "buffered-ip" \
|
2014-04-30 14:21:25 +00:00
|
|
|
"ant -f ../lib/java/build.xml -Dno-gen-thrift=\"\" run-testclient" \
|
2012-11-02 00:05:42 +00:00
|
|
|
"py/TestServer.py --proto=binary --port=9090 --genpydir=py/gen-py TSimpleServer" \
|
2014-04-30 14:21:25 +00:00
|
|
|
"10" "5"
|
2012-01-09 21:23:19 +00:00
|
|
|
do_test "js-java" "json " "http-ip" \
|
|
|
|
"" \
|
|
|
|
"ant -f ../lib/js/test/build.xml unittest" \
|
2014-04-30 14:21:25 +00:00
|
|
|
"2" "2"
|
2012-01-09 21:23:19 +00:00
|
|
|
do_test "perl-cpp" "binary" "buffered-ip" \
|
2012-01-10 21:30:02 +00:00
|
|
|
"perl -I perl/gen-perl/ -I../lib/perl/lib/ perl/TestClient.pl" \
|
2012-01-09 21:23:19 +00:00
|
|
|
"cpp/TestServer" \
|
2014-04-30 14:21:25 +00:00
|
|
|
"10" "5"
|
2012-01-21 09:18:05 +00:00
|
|
|
do_test "php-cpp" "binary" "buffered-ip" \
|
|
|
|
"make -C php/ client" \
|
|
|
|
"cpp/TestServer" \
|
2014-04-30 14:21:25 +00:00
|
|
|
"10" "5"
|
2014-01-19 20:53:02 +00:00
|
|
|
do_test "rb-rb" "binary" "buffered-ip" \
|
|
|
|
"ruby rb/integration/simple_client.rb" \
|
|
|
|
"ruby rb/integration/simple_server.rb" \
|
2014-04-30 14:21:25 +00:00
|
|
|
"5" "5"
|
2014-01-20 17:41:48 +00:00
|
|
|
do_test "rb-rb" "binary-accl" "buffered-ip" \
|
2014-01-19 20:53:02 +00:00
|
|
|
"ruby rb/integration/accelerated_buffered_client.rb" \
|
|
|
|
"ruby rb/integration/accelerated_buffered_server.rb" \
|
2014-04-30 14:21:25 +00:00
|
|
|
"5" "5"
|
2012-11-16 00:38:27 +00:00
|
|
|
cd -
|