#!/bin/bash

if [ $# -ne 1 ]; then
  echo "Usage: ${0##*/} <ip>:<port>"
  echo "Note: run from an R/W directory."
  exit 1
fi

# IP:port
ip_port=$1

duration=60

small="64 512 1k 2k 3k 5k 10k 20k 32k 50k"
medium="100k 200k 500k"
large="1m 2m 5m 10m 20m 50m 100m"

# usage: run_test ip_port size args
run_test() {
  dest="$1"; shift
  size="$1"; shift
  inject29l4 -a -l -d "$duration" -t 10000 -p 2 -G $dest/$size "$@" | \
     tee inj-$size.log
}

for i in $small; do
   run_test $ip_port $i -o 10 -u 50
done

for i in $medium; do
   run_test $ip_port $i -o 8 -u 5
done

for i in $large; do
   run_test $ip_port $i -o 4 -u 3 -s 100
done

