#!/usr/bin/env ksh
-# :vi ts=4 sw=4 noet :
+# vim: ts=4 sw=4 noet :
#==================================================================================
-# Copyright (c) 2019 Nokia
-# Copyright (c) 2018-2019 AT&T Intellectual Property.
+# Copyright (c) 2019-2020 Nokia
+# Copyright (c) 2018-2020 AT&T Intellectual Property.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# ---------------------------------------------------------------------------------
# Mnemonic: run_multi_test.ksh
# Abstract: This is a simple script to set up and run the basic send/receive
-# processes for some library validation on top of nano/nng. This
+# processes for some library validation on top of nng. This
# particular tests starts several receivers and creates a route table
# which causes messages to be sent to all receivers in parallel
# (forcing message cloning internally in RMr).
#
# Example command line:
# ksh ./run_multi_test.ksh # default 10 messages at 1 msg/sec
-# ksh ./run_multi_test.ksh -N # default but with nanomsg lib
# ksh ./run_multi_test.ksh -d 100 -n 10000 # send 10k messages with 100ms delay between
#
# Date: 24 April 2019
# The sender and receivers are run asynch. Their exit statuses are captured in a
-# file in order for the 'main' to pick them up easily.
+# file in order for the 'main' to pick them up easily. For the multi test the
+# async connect must be DISABLED because in some environments (um, jenkins) the
+# session connect time lags enough that the first message can be dropped silently.
+# It doesn't happen all of the time, but frequently enough to be annoying.
#
function run_sender {
- if (( $nano_sender ))
- then
- ./sender_nano $nmsg $delay
- else
- ./sender $nmsg $delay
- fi
+ RMR_ASYNC_CONN=0 ./sender${si} $nmsg $delay
echo $? >/tmp/PID$$.src # must communicate state back via file b/c asynch
}
port=$(( 4460 + ${1:-0} ))
export RMR_RTG_SVC=$(( 9990 + $1 ))
- if (( $nano_receiver ))
- then
- ./receiver_nano $nmsg $port
- else
- ./receiver $nmsg $port
- fi
+ ./receiver${si} $nmsg $port
echo $? >/tmp/PID$$.$1.rrc
}
nmsg=10 # total number of messages to be exchanged (-n value changes)
delay=1000000 # microsec sleep between msg 1,000,000 == 1s
-nano_sender=0 # start nano version if set (-N)
-nano_receiver=0
wait=1
rebuild=0
nopull=""
verbose=0
nrcvrs=3 # this is sane, but -r allows it to be set up
+force_make=0
+si=""
while [[ $1 == -* ]]
do
-B) rebuild=1;;
-b) rebuild=1; nopull="nopull";; # enable build but without pull
-d) delay=$2; shift;;
- -N) nano_sender=1
- nano_receiver=1
- ;;
-n) nmsg=$2; shift;;
+ -N) si="";; # buld/run NNG binaries (turn off si)
+ -M) force_make=1;;
-r) nrcvrs=$2; shift;;
+ -S) si="_si";; # buld/run SI95 binaries
-v) verbose=1;;
*) echo "unrecognised option: $1"
- echo "usage: $0 [-B] [-d micor-sec-delay] [-N] [-n num-msgs]"
- echo " -B forces a rebuild which will use .build"
+ echo "usage: $0 [-B] [-d micor-sec-delay] [-M] [-n num-msgs] [-S]"
+ echo " -B forces an RMR rebuild which will use .build"
+ echo " -m force test applications to be remade"
+ echo " -S build/test SI95 based binaries"
exit 1
;;
esac
set_rt $nrcvrs # set up the rt for n receivers
-if [[ ! -f ./sender ]]
+if (( rebuild || force_make )) || [[ ! -f ./sender${si} || ! -f ./receiver${si} ]]
then
if ! make >/dev/null 2>&1
then
- echo "[FAIL] cannot find sender binary, and cannot make it.... humm?"
+ echo "[FAIL] cannot find sender${si} and/or receiver${si} binary, and cannot make them.... humm?"
exit 1
fi
fi