blob: 30a370934b852b41da44b33438839934bccd2e84 [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 "======================================================"
58 print_header
59 fi
60 sleep 10
61}
62
63echo "Apache Thrift - integration test suite"
64date
65echo "======================================================"
66
67rm -rf log
68mkdir -p log
69
70print_header
71
72
73protocols="binary json"
74transports="buffered framed http"
75sockets="ip domain"
76# we need a test certificate first
77#sockets="ip ip-ssl domain"
78
Roger Meiereaa61d82012-01-12 21:38:29 +000079
Roger Meier4d5157d2012-01-09 21:23:19 +000080for proto in $protocols; do
81 for trans in $transports; do
82 for sock in $sockets; do
83 case "$sock" in
84 "ip" ) extraparam="";;
85 "ip-ssl" ) extraparam="--ssl";;
86 "domain" ) extraparam="--domain-socket=/tmp/ThriftTest.thrift";;
87 esac
88 do_test "cpp-cpp" "${proto}" "${trans}-${sock}" \
89 "cpp/TestClient --protocol=${proto} --transport=${trans} ${extraparam}" \
90 "cpp/TestServer --protocol=${proto} --transport=${trans} ${extraparam}" \
91 "10"
92 done;
93 done;
94done;
95
96
97do_test "java-java" "binary" "buffered-ip" \
98 "ant -f ../lib/java/build.xml testclient" \
99 "ant -f ../lib/java/build.xml testserver" \
100 "100"
101do_test "cpp-java" "binary" "buffered-ip" \
102 "cpp/TestClient" \
103 "ant -f ../lib/java/build.xml testserver" \
104 "100"
105do_test "cpp-java" "json" "buffered-ip" \
106 "cpp/TestClient" \
107 "ant -f ../lib/java/build.xml testserver" \
108 "100"
109do_test "js-java" "json " "http-ip" \
110 "" \
111 "ant -f ../lib/js/test/build.xml unittest" \
112 "100"
113do_test "java-cpp" "binary" "buffered-ip" \
114 "ant -f ../lib/java/build.xml testclient" \
115 "cpp/TestServer" \
116 "10"
117do_test "perl-cpp" "binary" "buffered-ip" \
Roger Meier01b568c2012-01-10 21:30:02 +0000118 "perl -I perl/gen-perl/ -I../lib/perl/lib/ perl/TestClient.pl" \
Roger Meier4d5157d2012-01-09 21:23:19 +0000119 "cpp/TestServer" \
120 "10"
Roger Meierb33967b2012-01-21 09:18:05 +0000121do_test "php-cpp" "binary" "buffered-ip" \
122 "make -C php/ client" \
123 "cpp/TestServer" \
124 "10"
Roger Meiereaa61d82012-01-12 21:38:29 +0000125do_test "nodejs-nodejs" "binary" "framed-ip" \
126 "make -C nodejs/ client" \
127 "make -C nodejs/ server" \
128 "1"
129do_test "cpp-nodejs" "binary" "framed-ip" \
130 "cpp/TestClient --transport=framed" \
131 "make -C nodejs/ server" \
132 "1"