blob: 36e57c30e9fe4cbcf1468f55e0918c07d238fb13 [file] [log] [blame]
Roger Meier4d5157d2012-01-09 21:23:19 +00001#!/bin/sh
2#
3# Licensed to the Apache Software Foundation (ASF) under one
4# or more contributor license agreements. See the NOTICE file
5# distributed with this work for additional information
6# regarding copyright ownership. The ASF licenses this file
7# to you under the Apache License, Version 2.0 (the
8# "License"); you may not use this file except in compliance
9# with the License. You may obtain a copy of the License at
10#
11# http://www.apache.org/licenses/LICENSE-2.0
12#
13# Unless required by applicable law or agreed to in writing,
14# software distributed under the License is distributed on an
15# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16# KIND, either express or implied. See the License for the
17# specific language governing permissions and limitations
18# under the License.
19#
20
21# Apache Thrift - integration test suite
22#
23# tests different client-server, protocol and transport combinations
24
25# related issues:
26# THRIFT-847 Test Framework harmonization across all languages
27# THRIFT-819 add Enumeration for protocol, transport and server types
28
29
30print_header() {
31 printf "%-16s %-11s %-17s %-s\n" "client-server:" "protocol:" "transport:" "result:"
32}
33
34do_test () {
35 client_server=$1
36 protocol=$2
37 transport=$3
38 client_exec=$4
39 server_exec=$5
40 server_startup_time=$6
41
42 testname=${client_server}_${protocol}_${transport}
43 server_timeout=$((${server_startup_time}+10))
44 printf "%-16s %-11s %-17s" ${client_server} ${protocol} ${transport}
45 timeout $server_timeout $server_exec > log/${testname}_server.log 2>&1 &
46 sleep $server_startup_time
47 $client_exec > log/${testname}_client.log 2>&1
48
49 if [ "$?" -eq "0" ]; then
50 echo " success"
51 else
52 echo " failure"
53 echo "=================== server message ==================="
54 tail log/${testname}_server.log
55 echo "=================== client message ==================="
56 tail log/${testname}_client.log
57 echo "======================================================"
Roger Meier85fb6de2012-11-02 00:05:42 +000058 echo ""
Roger Meier4d5157d2012-01-09 21:23:19 +000059 print_header
60 fi
61 sleep 10
62}
63
64echo "Apache Thrift - integration test suite"
65date
66echo "======================================================"
67
68rm -rf log
69mkdir -p log
70
71print_header
72
73
74protocols="binary json"
75transports="buffered framed http"
76sockets="ip domain"
77# we need a test certificate first
78#sockets="ip ip-ssl domain"
79
Roger Meiereaa61d82012-01-12 21:38:29 +000080
Roger Meier4d5157d2012-01-09 21:23:19 +000081for proto in $protocols; do
82 for trans in $transports; do
83 for sock in $sockets; do
84 case "$sock" in
85 "ip" ) extraparam="";;
86 "ip-ssl" ) extraparam="--ssl";;
87 "domain" ) extraparam="--domain-socket=/tmp/ThriftTest.thrift";;
88 esac
89 do_test "cpp-cpp" "${proto}" "${trans}-${sock}" \
90 "cpp/TestClient --protocol=${proto} --transport=${trans} ${extraparam}" \
91 "cpp/TestServer --protocol=${proto} --transport=${trans} ${extraparam}" \
92 "10"
93 done;
94 done;
95done;
96
Roger Meier85fb6de2012-11-02 00:05:42 +000097do_test "py-py" "binary" "buffered-ip" \
98 "py/TestClient.py --proto=binary --port=9090 --host=localhost --genpydir=py/gen-py" \
99 "py/TestServer.py --proto=binary --port=9090 --genpydir=py/gen-py TSimpleServer" \
100 "10"
101do_test "py-py" "json" "buffered-ip" \
102 "py/TestClient.py --proto=json --port=9090 --host=localhost --genpydir=py/gen-py" \
103 "py/TestServer.py --proto=json --port=9090 --genpydir=py/gen-py TSimpleServer" \
104 "10"
105do_test "py-cpp" "binary" "buffered-ip" \
106 "py/TestClient.py --proto=binary --port=9090 --host=localhost --genpydir=py/gen-py" \
107 "cpp/TestServer" \
108 "10"
109do_test "py-cpp" "json" "buffered-ip" \
110 "py/TestClient.py --proto=json --port=9090 --host=localhost --genpydir=py/gen-py" \
111 "cpp/TestServer --protocol=json" \
112 "10"
113do_test "cpp-py" "binary" "buffered-ip" \
114 "cpp/TestClient --protocol=binary --port=9090" \
115 "py/TestServer.py --proto=binary --port=9090 --genpydir=py/gen-py TSimpleServer" \
116 "10"
117do_test "cpp-py" "json" "buffered-ip" \
118 "cpp/TestClient --protocol=json --port=9090" \
119 "py/TestServer.py --proto=json --port=9090 --genpydir=py/gen-py TSimpleServer" \
120 "10"
121do_test "py-java" "binary" "buffered-ip" \
122 "py/TestClient.py --proto=binary --port=9090 --host=localhost --genpydir=py/gen-py" \
123 "ant -f ../lib/java/build.xml testserver" \
124 "100"
125do_test "py-java" "json" "buffered-ip" \
126 "py/TestClient.py --proto=json --port=9090 --host=localhost --genpydir=py/gen-py" \
127 "ant -f ../lib/java/build.xml testserver" \
128 "100"
129do_test "java-py" "binary" "buffered-ip" \
130 "ant -f ../lib/java/build.xml testclient" \
131 "py/TestServer.py --proto=binary --port=9090 --genpydir=py/gen-py TSimpleServer" \
132 "10"
Roger Meier4d5157d2012-01-09 21:23:19 +0000133do_test "java-java" "binary" "buffered-ip" \
134 "ant -f ../lib/java/build.xml testclient" \
135 "ant -f ../lib/java/build.xml testserver" \
136 "100"
137do_test "cpp-java" "binary" "buffered-ip" \
138 "cpp/TestClient" \
139 "ant -f ../lib/java/build.xml testserver" \
140 "100"
141do_test "cpp-java" "json" "buffered-ip" \
142 "cpp/TestClient" \
143 "ant -f ../lib/java/build.xml testserver" \
144 "100"
145do_test "js-java" "json " "http-ip" \
146 "" \
147 "ant -f ../lib/js/test/build.xml unittest" \
148 "100"
149do_test "java-cpp" "binary" "buffered-ip" \
150 "ant -f ../lib/java/build.xml testclient" \
151 "cpp/TestServer" \
152 "10"
153do_test "perl-cpp" "binary" "buffered-ip" \
Roger Meier01b568c2012-01-10 21:30:02 +0000154 "perl -I perl/gen-perl/ -I../lib/perl/lib/ perl/TestClient.pl" \
Roger Meier4d5157d2012-01-09 21:23:19 +0000155 "cpp/TestServer" \
156 "10"
Roger Meierb33967b2012-01-21 09:18:05 +0000157do_test "php-cpp" "binary" "buffered-ip" \
158 "make -C php/ client" \
159 "cpp/TestServer" \
160 "10"
Roger Meiereaa61d82012-01-12 21:38:29 +0000161do_test "nodejs-nodejs" "binary" "framed-ip" \
162 "make -C nodejs/ client" \
163 "make -C nodejs/ server" \
164 "1"
Henrique Mendoncad407b2d2012-10-22 21:06:14 +0000165do_test "nodejs-cpp" "binary" "framed-ip" \
166 "make -C nodejs/ client" \
167 "cpp/TestServer --transport=framed" \
168 "1"
Roger Meiereaa61d82012-01-12 21:38:29 +0000169do_test "cpp-nodejs" "binary" "framed-ip" \
170 "cpp/TestClient --transport=framed" \
171 "make -C nodejs/ server" \
172 "1"