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 | |
Roger Meier | 8252577 | 2012-11-16 00:38:27 +0000 | [diff] [blame] | 29 | BASEDIR=$(dirname $0) |
| 30 | echo $BASEDIR |
| 31 | cd $BASEDIR |
Roger Meier | 4d5157d | 2012-01-09 21:23:19 +0000 | [diff] [blame] | 32 | |
| 33 | print_header() { |
| 34 | printf "%-16s %-11s %-17s %-s\n" "client-server:" "protocol:" "transport:" "result:" |
| 35 | } |
| 36 | |
| 37 | do_test () { |
| 38 | client_server=$1 |
| 39 | protocol=$2 |
| 40 | transport=$3 |
| 41 | client_exec=$4 |
| 42 | server_exec=$5 |
| 43 | server_startup_time=$6 |
| 44 | |
| 45 | testname=${client_server}_${protocol}_${transport} |
| 46 | server_timeout=$((${server_startup_time}+10)) |
| 47 | printf "%-16s %-11s %-17s" ${client_server} ${protocol} ${transport} |
| 48 | timeout $server_timeout $server_exec > log/${testname}_server.log 2>&1 & |
| 49 | sleep $server_startup_time |
| 50 | $client_exec > log/${testname}_client.log 2>&1 |
| 51 | |
| 52 | if [ "$?" -eq "0" ]; then |
| 53 | echo " success" |
| 54 | else |
| 55 | echo " failure" |
| 56 | echo "=================== server message ===================" |
| 57 | tail log/${testname}_server.log |
| 58 | echo "=================== client message ===================" |
| 59 | tail log/${testname}_client.log |
| 60 | echo "======================================================" |
Roger Meier | 85fb6de | 2012-11-02 00:05:42 +0000 | [diff] [blame] | 61 | echo "" |
Roger Meier | 4d5157d | 2012-01-09 21:23:19 +0000 | [diff] [blame] | 62 | print_header |
| 63 | fi |
| 64 | sleep 10 |
| 65 | } |
| 66 | |
| 67 | echo "Apache Thrift - integration test suite" |
| 68 | date |
| 69 | echo "======================================================" |
| 70 | |
| 71 | rm -rf log |
| 72 | mkdir -p log |
| 73 | |
| 74 | print_header |
| 75 | |
Roger Meier | 8252577 | 2012-11-16 00:38:27 +0000 | [diff] [blame] | 76 | #TODO add enum for parameters |
| 77 | #TODO align program arguments across languages |
Roger Meier | 4d5157d | 2012-01-09 21:23:19 +0000 | [diff] [blame] | 78 | |
| 79 | protocols="binary json" |
| 80 | transports="buffered framed http" |
| 81 | sockets="ip domain" |
| 82 | # we need a test certificate first |
| 83 | #sockets="ip ip-ssl domain" |
| 84 | |
Roger Meier | eaa61d8 | 2012-01-12 21:38:29 +0000 | [diff] [blame] | 85 | |
Roger Meier | 4d5157d | 2012-01-09 21:23:19 +0000 | [diff] [blame] | 86 | for proto in $protocols; do |
| 87 | for trans in $transports; do |
| 88 | for sock in $sockets; do |
| 89 | case "$sock" in |
| 90 | "ip" ) extraparam="";; |
| 91 | "ip-ssl" ) extraparam="--ssl";; |
| 92 | "domain" ) extraparam="--domain-socket=/tmp/ThriftTest.thrift";; |
| 93 | esac |
| 94 | do_test "cpp-cpp" "${proto}" "${trans}-${sock}" \ |
| 95 | "cpp/TestClient --protocol=${proto} --transport=${trans} ${extraparam}" \ |
| 96 | "cpp/TestServer --protocol=${proto} --transport=${trans} ${extraparam}" \ |
| 97 | "10" |
| 98 | done; |
| 99 | done; |
| 100 | done; |
| 101 | |
Roger Meier | 691ec00 | 2012-11-02 07:50:24 +0000 | [diff] [blame] | 102 | # delete Unix Domain Socket used by cpp tests |
| 103 | rm -f /tmp/ThriftTest.thrift |
| 104 | |
Roger Meier | 85fb6de | 2012-11-02 00:05:42 +0000 | [diff] [blame] | 105 | do_test "py-py" "binary" "buffered-ip" \ |
| 106 | "py/TestClient.py --proto=binary --port=9090 --host=localhost --genpydir=py/gen-py" \ |
| 107 | "py/TestServer.py --proto=binary --port=9090 --genpydir=py/gen-py TSimpleServer" \ |
| 108 | "10" |
| 109 | do_test "py-py" "json" "buffered-ip" \ |
| 110 | "py/TestClient.py --proto=json --port=9090 --host=localhost --genpydir=py/gen-py" \ |
| 111 | "py/TestServer.py --proto=json --port=9090 --genpydir=py/gen-py TSimpleServer" \ |
| 112 | "10" |
| 113 | do_test "py-cpp" "binary" "buffered-ip" \ |
| 114 | "py/TestClient.py --proto=binary --port=9090 --host=localhost --genpydir=py/gen-py" \ |
| 115 | "cpp/TestServer" \ |
| 116 | "10" |
| 117 | do_test "py-cpp" "json" "buffered-ip" \ |
| 118 | "py/TestClient.py --proto=json --port=9090 --host=localhost --genpydir=py/gen-py" \ |
| 119 | "cpp/TestServer --protocol=json" \ |
| 120 | "10" |
| 121 | do_test "cpp-py" "binary" "buffered-ip" \ |
| 122 | "cpp/TestClient --protocol=binary --port=9090" \ |
| 123 | "py/TestServer.py --proto=binary --port=9090 --genpydir=py/gen-py TSimpleServer" \ |
| 124 | "10" |
| 125 | do_test "cpp-py" "json" "buffered-ip" \ |
| 126 | "cpp/TestClient --protocol=json --port=9090" \ |
| 127 | "py/TestServer.py --proto=json --port=9090 --genpydir=py/gen-py TSimpleServer" \ |
| 128 | "10" |
| 129 | do_test "py-java" "binary" "buffered-ip" \ |
| 130 | "py/TestClient.py --proto=binary --port=9090 --host=localhost --genpydir=py/gen-py" \ |
| 131 | "ant -f ../lib/java/build.xml testserver" \ |
Roger Meier | 8252577 | 2012-11-16 00:38:27 +0000 | [diff] [blame] | 132 | "120" |
Roger Meier | 85fb6de | 2012-11-02 00:05:42 +0000 | [diff] [blame] | 133 | do_test "py-java" "json" "buffered-ip" \ |
| 134 | "py/TestClient.py --proto=json --port=9090 --host=localhost --genpydir=py/gen-py" \ |
| 135 | "ant -f ../lib/java/build.xml testserver" \ |
Roger Meier | 8252577 | 2012-11-16 00:38:27 +0000 | [diff] [blame] | 136 | "120" |
Roger Meier | 85fb6de | 2012-11-02 00:05:42 +0000 | [diff] [blame] | 137 | do_test "java-py" "binary" "buffered-ip" \ |
| 138 | "ant -f ../lib/java/build.xml testclient" \ |
| 139 | "py/TestServer.py --proto=binary --port=9090 --genpydir=py/gen-py TSimpleServer" \ |
| 140 | "10" |
Roger Meier | 4d5157d | 2012-01-09 21:23:19 +0000 | [diff] [blame] | 141 | do_test "java-java" "binary" "buffered-ip" \ |
| 142 | "ant -f ../lib/java/build.xml testclient" \ |
| 143 | "ant -f ../lib/java/build.xml testserver" \ |
Roger Meier | 8252577 | 2012-11-16 00:38:27 +0000 | [diff] [blame] | 144 | "120" |
Roger Meier | 4d5157d | 2012-01-09 21:23:19 +0000 | [diff] [blame] | 145 | do_test "cpp-java" "binary" "buffered-ip" \ |
| 146 | "cpp/TestClient" \ |
| 147 | "ant -f ../lib/java/build.xml testserver" \ |
| 148 | "100" |
| 149 | do_test "cpp-java" "json" "buffered-ip" \ |
| 150 | "cpp/TestClient" \ |
| 151 | "ant -f ../lib/java/build.xml testserver" \ |
| 152 | "100" |
| 153 | do_test "js-java" "json " "http-ip" \ |
| 154 | "" \ |
| 155 | "ant -f ../lib/js/test/build.xml unittest" \ |
Roger Meier | 8252577 | 2012-11-16 00:38:27 +0000 | [diff] [blame] | 156 | "120" |
Roger Meier | 4d5157d | 2012-01-09 21:23:19 +0000 | [diff] [blame] | 157 | do_test "java-cpp" "binary" "buffered-ip" \ |
| 158 | "ant -f ../lib/java/build.xml testclient" \ |
| 159 | "cpp/TestServer" \ |
| 160 | "10" |
| 161 | do_test "perl-cpp" "binary" "buffered-ip" \ |
Roger Meier | 01b568c | 2012-01-10 21:30:02 +0000 | [diff] [blame] | 162 | "perl -I perl/gen-perl/ -I../lib/perl/lib/ perl/TestClient.pl" \ |
Roger Meier | 4d5157d | 2012-01-09 21:23:19 +0000 | [diff] [blame] | 163 | "cpp/TestServer" \ |
| 164 | "10" |
Roger Meier | b33967b | 2012-01-21 09:18:05 +0000 | [diff] [blame] | 165 | do_test "php-cpp" "binary" "buffered-ip" \ |
| 166 | "make -C php/ client" \ |
| 167 | "cpp/TestServer" \ |
| 168 | "10" |
Roger Meier | eaa61d8 | 2012-01-12 21:38:29 +0000 | [diff] [blame] | 169 | do_test "nodejs-nodejs" "binary" "framed-ip" \ |
| 170 | "make -C nodejs/ client" \ |
| 171 | "make -C nodejs/ server" \ |
| 172 | "1" |
Henrique Mendonca | d407b2d | 2012-10-22 21:06:14 +0000 | [diff] [blame] | 173 | do_test "nodejs-cpp" "binary" "framed-ip" \ |
| 174 | "make -C nodejs/ client" \ |
| 175 | "cpp/TestServer --transport=framed" \ |
| 176 | "1" |
Roger Meier | eaa61d8 | 2012-01-12 21:38:29 +0000 | [diff] [blame] | 177 | do_test "cpp-nodejs" "binary" "framed-ip" \ |
| 178 | "cpp/TestClient --transport=framed" \ |
| 179 | "make -C nodejs/ server" \ |
| 180 | "1" |
Roger Meier | 8252577 | 2012-11-16 00:38:27 +0000 | [diff] [blame] | 181 | |
| 182 | cd - |