blob: ee74e7543cede2fccc8ec5e2562c79c86572414f [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
79for proto in $protocols; do
80 for trans in $transports; do
81 for sock in $sockets; do
82 case "$sock" in
83 "ip" ) extraparam="";;
84 "ip-ssl" ) extraparam="--ssl";;
85 "domain" ) extraparam="--domain-socket=/tmp/ThriftTest.thrift";;
86 esac
87 do_test "cpp-cpp" "${proto}" "${trans}-${sock}" \
88 "cpp/TestClient --protocol=${proto} --transport=${trans} ${extraparam}" \
89 "cpp/TestServer --protocol=${proto} --transport=${trans} ${extraparam}" \
90 "10"
91 done;
92 done;
93done;
94
95
96do_test "java-java" "binary" "buffered-ip" \
97 "ant -f ../lib/java/build.xml testclient" \
98 "ant -f ../lib/java/build.xml testserver" \
99 "100"
100do_test "cpp-java" "binary" "buffered-ip" \
101 "cpp/TestClient" \
102 "ant -f ../lib/java/build.xml testserver" \
103 "100"
104do_test "cpp-java" "json" "buffered-ip" \
105 "cpp/TestClient" \
106 "ant -f ../lib/java/build.xml testserver" \
107 "100"
108do_test "js-java" "json " "http-ip" \
109 "" \
110 "ant -f ../lib/js/test/build.xml unittest" \
111 "100"
112do_test "java-cpp" "binary" "buffered-ip" \
113 "ant -f ../lib/java/build.xml testclient" \
114 "cpp/TestServer" \
115 "10"
116do_test "perl-cpp" "binary" "buffered-ip" \
Roger Meier01b568c2012-01-10 21:30:02 +0000117 "perl -I perl/gen-perl/ -I../lib/perl/lib/ perl/TestClient.pl" \
Roger Meier4d5157d2012-01-09 21:23:19 +0000118 "cpp/TestServer" \
119 "10"