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