File: test_rpc_interop.sh

package info (click to toggle)
avro-java 1.8.2-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, forky, sid, trixie
  • size: 12,784 kB
  • sloc: java: 58,236; ansic: 27,618; cpp: 15,332; cs: 12,876; python: 10,443; xml: 6,338; php: 3,836; ruby: 3,158; perl: 1,656; sh: 733; lex: 203; yacc: 140; makefile: 7
file content (83 lines) | stat: -rwxr-xr-x 2,526 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
#!/bin/bash

# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements.  See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License.  You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

set -e                          # exit on error

cd `dirname "$0"`/../../../..   # connect to root

VERSION=`cat share/VERSION.txt`

#set -x                          # echo commands

java_client="java -jar lang/java/tools/target/avro-tools-$VERSION.jar rpcsend"
java_server="java -jar lang/java/tools/target/avro-tools-$VERSION.jar rpcreceive"

py_client="python lang/py/build/src/avro/tool.py rpcsend"
py_server="python lang/py/build/src/avro/tool.py rpcreceive"

ruby_client="ruby -rubygems -Ilang/ruby/lib lang/ruby/test/tool.rb rpcsend"
ruby_server="ruby -rubygems -Ilang/ruby/lib lang/ruby/test/tool.rb rpcreceive"

export PYTHONPATH=lang/py/build/src      # path to avro Python module

clients=("$java_client" "$py_client" "$ruby_client")
servers=("$java_server" "$py_server" "$ruby_server")

proto=share/test/schemas/simple.avpr

portfile=/tmp/interop_$$

function cleanup() {
  rm -rf $portfile
  for job in `jobs -p` ; do kill $job; done
}

trap 'cleanup' EXIT

for server in "${servers[@]}"
do
  for msgDir in share/test/interop/rpc/*
  do
    msg=`basename "$msgDir"`
    for c in ${msgDir}/*
    do
      echo TEST: $c
      for client in "${clients[@]}"
      do
        rm -rf $portfile
        $server http://127.0.0.1:0/ $proto $msg -file $c/response.avro \
            > $portfile &
        count=0
        while [ ! -s $portfile ]
        do
          sleep 1
          if [ $count -ge 10 ]
          then
            echo $server did not start.
            exit 1
          fi
          count=`expr $count + 1`
        done
        read ignore port < $portfile
        $client http://127.0.0.1:$port $proto $msg -file $c/request.avro
        wait
        done
    done
    done
done

echo RPC INTEROP TESTS PASS