Roger Meier | 4d5157d | 2012-01-09 21:23:19 +0000 | [diff] [blame] | 1 | #!/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 | |
| 30 | print_header() { |
| 31 | printf "%-16s %-11s %-17s %-s\n" "client-server:" "protocol:" "transport:" "result:" |
| 32 | } |
| 33 | |
| 34 | do_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 | |
| 63 | echo "Apache Thrift - integration test suite" |
| 64 | date |
| 65 | echo "======================================================" |
| 66 | |
| 67 | rm -rf log |
| 68 | mkdir -p log |
| 69 | |
| 70 | print_header |
| 71 | |
| 72 | |
| 73 | protocols="binary json" |
| 74 | transports="buffered framed http" |
| 75 | sockets="ip domain" |
| 76 | # we need a test certificate first |
| 77 | #sockets="ip ip-ssl domain" |
| 78 | |
| 79 | for 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; |
| 93 | done; |
| 94 | |
| 95 | |
| 96 | do_test "java-java" "binary" "buffered-ip" \ |
| 97 | "ant -f ../lib/java/build.xml testclient" \ |
| 98 | "ant -f ../lib/java/build.xml testserver" \ |
| 99 | "100" |
| 100 | do_test "cpp-java" "binary" "buffered-ip" \ |
| 101 | "cpp/TestClient" \ |
| 102 | "ant -f ../lib/java/build.xml testserver" \ |
| 103 | "100" |
| 104 | do_test "cpp-java" "json" "buffered-ip" \ |
| 105 | "cpp/TestClient" \ |
| 106 | "ant -f ../lib/java/build.xml testserver" \ |
| 107 | "100" |
| 108 | do_test "js-java" "json " "http-ip" \ |
| 109 | "" \ |
| 110 | "ant -f ../lib/js/test/build.xml unittest" \ |
| 111 | "100" |
| 112 | do_test "java-cpp" "binary" "buffered-ip" \ |
| 113 | "ant -f ../lib/java/build.xml testclient" \ |
| 114 | "cpp/TestServer" \ |
| 115 | "10" |
| 116 | do_test "perl-cpp" "binary" "buffered-ip" \ |
Roger Meier | 01b568c | 2012-01-10 21:30:02 +0000 | [diff] [blame] | 117 | "perl -I perl/gen-perl/ -I../lib/perl/lib/ perl/TestClient.pl" \ |
Roger Meier | 4d5157d | 2012-01-09 21:23:19 +0000 | [diff] [blame] | 118 | "cpp/TestServer" \ |
| 119 | "10" |