mctest_run.sh revision 178456
1178456Sgnn#!/bin/sh
2178456Sgnn# 
3178456Sgnn# A program to act as a test harness for the mctest program
4178456Sgnn#
5178456Sgnn# $FreeBSD: head/tools/tools/mctest/mctest_run.sh 178456 2008-04-24 06:56:45Z gnn $
6178456Sgnn#
7178456Sgnn# Defaults
8178456Sgnnsize=1024
9178456Sgnnnumber=100
10178456Sgnngroup=""
11178456Sgnninterface="cxgb0"
12178456Sgnnremote="ssh"
13178456Sgnncommand="/sources/FreeBSD.CURRENT/src/tools/tools/mctest/mctest"
14178456Sgnngap=1000
15178456Sgnn
16178456Sgnn# Arguments are s (size), g (group), n (number), and c (command) followed
17178456Sgnn# by a set of hostnames.
18178456Sgnnargs=`getopt s:g:n:c:i: $*`
19178456Sgnnif [ $? != 0 ]
20178456Sgnnthen
21178456Sgnn    echo 'Usage: mctest_run -s size -g group -n number -c remote command host1 host2 hostN'
22178456Sgnn    exit 2
23178456Sgnnfi
24178456Sgnnset == $args
25178456Sgnncount=0
26178456Sgnnfor i
27178456Sgnndo
28178456Sgnn  case "$i"
29178456Sgnn      in
30178456Sgnn      -s) 
31178456Sgnn	  size=$3; 
32178456Sgnn	  shift 2;;
33178456Sgnn      -n)
34178456Sgnn	  number=$3;
35178456Sgnn	  shift 2;;
36178456Sgnn      -g)
37178456Sgnn	  group=$3;
38178456Sgnn	  shift 2;;
39178456Sgnn      -c)
40178456Sgnn	  command=$3;
41178456Sgnn	  shift 2;;
42178456Sgnn      -i)
43178456Sgnn	  interface=$3;
44178456Sgnn	  shift 2;;
45178456Sgnn      --)
46178456Sgnn	  shift; break;;
47178456Sgnn      esac
48178456Sgnndone
49178456Sgnn
50178456Sgnn#
51178456Sgnn# Start our remote sink/reflectors
52178456Sgnn#
53178456Sgnnshift;
54178456Sgnncurrent=0
55178456Sgnnnow=`date "+%Y%m%d%H%M"`
56178456Sgnnfor host in $*
57178456Sgnndo
58178456Sgnn  output=$host\_$interface\_$size\_$number\.$now
59178456Sgnn  $remote $host $command -r -M $# -m $current -n $number -s $size -i $interface > $output &
60178456Sgnn  sleep 1
61178456Sgnn  current=`expr $current + 1 `;
62178456Sgnndone
63178456Sgnn
64178456Sgnn#
65178456Sgnn# Start the source/collector on this machine
66178456Sgnn#
67178456Sgnn$command -M $# -n $number -s $size -i le1 -t $gap > `uname -n`\_$size\_$number\.$now
68