1178456Sgnn#!/bin/sh 2178456Sgnn# 3178456Sgnn# A program to act as a test harness for the mctest program 4178456Sgnn# 5178456Sgnn# $FreeBSD$ 6178456Sgnn# 7178456Sgnn# Defaults 8178456Sgnnsize=1024 9178456Sgnnnumber=100 10213327Sgnnbase=9999 11213327Sgnngroup="239.255.255.101" 12178456Sgnninterface="cxgb0" 13178456Sgnnremote="ssh" 14213327Sgnncommand="/zoo/tank/users/gnn/svn/Projects/head-exar/src/tools/tools/mctest/mctest" 15178456Sgnngap=1000 16178456Sgnn 17178456Sgnn# Arguments are s (size), g (group), n (number), and c (command) followed 18178456Sgnn# by a set of hostnames. 19213327Sgnnargs=`getopt s:g:n:c:l:f:b: $*` 20178456Sgnnif [ $? != 0 ] 21178456Sgnnthen 22213327Sgnn echo 'Usage: mctest_run -l local_interface -f foreign_interface -s size -g group -n number -c remote command host1 host2 hostN' 23178456Sgnn exit 2 24178456Sgnnfi 25178456Sgnnset == $args 26178456Sgnncount=0 27178456Sgnnfor i 28178456Sgnndo 29178456Sgnn case "$i" 30178456Sgnn in 31178456Sgnn -s) 32178456Sgnn size=$3; 33178456Sgnn shift 2;; 34178456Sgnn -n) 35178456Sgnn number=$3; 36178456Sgnn shift 2;; 37178456Sgnn -g) 38178456Sgnn group=$3; 39178456Sgnn shift 2;; 40178456Sgnn -c) 41178456Sgnn command=$3; 42178456Sgnn shift 2;; 43213327Sgnn -l) 44213327Sgnn local_interface=$3; 45178456Sgnn shift 2;; 46213327Sgnn -f) 47213327Sgnn foreign_interface=$3; 48213327Sgnn shift 2;; 49179528Sgnn -b) 50179528Sgnn base=$3; 51179528Sgnn shift 2;; 52178456Sgnn --) 53178456Sgnn shift; break;; 54178456Sgnn esac 55178456Sgnndone 56178456Sgnn 57178456Sgnn# 58178456Sgnn# Start our remote sink/reflectors 59178456Sgnn# 60178456Sgnnshift; 61178456Sgnncurrent=0 62178456Sgnnnow=`date "+%Y%m%d%H%M"` 63178456Sgnnfor host in $* 64178456Sgnndo 65178456Sgnn output=$host\_$interface\_$size\_$number\.$now 66213327Sgnn $remote $host $command -r -M $# -b $base -g $group -m $current -n $number -s $size -i $foreign_interface > $output & 67178456Sgnn sleep 1 68178456Sgnn current=`expr $current + 1 `; 69178456Sgnndone 70178456Sgnn 71178456Sgnn# 72178456Sgnn# Start the source/collector on this machine 73178456Sgnn# 74213327Sgnn$command -M $# -b $base -g $group -n $number -s $size -i $local_interface -t $gap > `uname -n`\_$size\_$number\.$now 75