summaryrefslogtreecommitdiff
path: root/qpid/cpp/bindings/qmf/tests/run_interop_tests
blob: e6fc872dbb5a739ed04225d7f0f69895b677314d (plain)
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
#!/bin/sh

#
# 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.
#

# Run the qmf interoperability tests.
MY_DIR=`dirname \`which $0\``
QPID_DIR=${MY_DIR}/../../../..
BUILD_DIR=../../..
PYTHON_DIR=${QPID_DIR}/python
BROKER_DIR=${BUILD_DIR}/src
API_DIR=${BUILD_DIR}/bindings/qmf
SPEC_DIR=${QPID_DIR}/specs

trap stop_broker INT TERM QUIT

start_broker() {
    ${BROKER_DIR}/qpidd --daemon --port 0 --no-data-dir --no-module-dir --auth no > _qpidd.port
    BROKER_PORT=`cat _qpidd.port`
}

stop_broker() {
    ${BROKER_DIR}/qpidd -q --port $BROKER_PORT
    echo "Broker stopped"
}

start_ruby_agent() {
    ruby -I${MY_DIR}/../ruby -I${API_DIR}/ruby/.libs ${MY_DIR}/agent_ruby.rb localhost $BROKER_PORT &
    AGENT_PID=$!
}

stop_ruby_agent() {
    kill $AGENT_PID
}

if test -d ${PYTHON_DIR} ;  then
    start_broker
    echo "Running qmf interop tests using broker on port $BROKER_PORT"
    PYTHONPATH=${PYTHON_DIR}:${MY_DIR}
    export PYTHONPATH
    echo "    Ruby Agent vs. Pure-Python Console"
    start_ruby_agent
    echo "    Ruby agent started at pid $AGENT_PID"
    ${PYTHON_DIR}/qpid-python-test -m python_console -b localhost:$BROKER_PORT $@
    RETCODE=$?
    stop_ruby_agent
    stop_broker
    if test x$RETCODE != x0; then 
        echo "FAIL qmf interop tests"; exit 1;
    fi
fi