mctest_run.sh revision 179528
1#!/bin/sh
2# 
3# A program to act as a test harness for the mctest program
4#
5# $FreeBSD: head/tools/tools/mctest/mctest_run.sh 179528 2008-06-03 20:54:46Z gnn $
6#
7# Defaults
8size=1024
9number=100
10base=""
11group=""
12interface="cxgb0"
13remote="ssh"
14command="/sources/FreeBSD.CURRENT/src/tools/tools/mctest/mctest"
15gap=1000
16
17# Arguments are s (size), g (group), n (number), and c (command) followed
18# by a set of hostnames.
19args=`getopt s:g:n:c:i:b: $*`
20if [ $? != 0 ]
21then
22    echo 'Usage: mctest_run -s size -g group -n number -c remote command host1 host2 hostN'
23    exit 2
24fi
25set == $args
26count=0
27for i
28do
29  case "$i"
30      in
31      -s) 
32	  size=$3; 
33	  shift 2;;
34      -n)
35	  number=$3;
36	  shift 2;;
37      -g)
38	  group=$3;
39	  shift 2;;
40      -c)
41	  command=$3;
42	  shift 2;;
43      -i)
44	  interface=$3;
45	  shift 2;;
46      -b) 
47	  base=$3;
48	  shift 2;;
49      --)
50	  shift; break;;
51      esac
52done
53
54#
55# Start our remote sink/reflectors
56#
57shift;
58current=0
59now=`date "+%Y%m%d%H%M"`
60for host in $*
61do
62  output=$host\_$interface\_$size\_$number\.$now
63  $remote $host $command -r -M $# -b $base -g $group -m $current -n $number -s $size -i $interface > $output &
64  sleep 1
65  current=`expr $current + 1 `;
66done
67
68#
69# Start the source/collector on this machine
70#
71$command -M $# -b $base -g $group -n $number -s $size -i $interface -t $gap > `uname -n`\_$size\_$number\.$now
72