install-eg.sh: LDAP config
[sitka/sitka-tools.git] / apachebench_eg / eg_ab.bash
CommitLineData
ee715637
JF
1#!/bin/bash
2# content-type header
3MYCONTENTTYPE="Content-type: text/plain"
4
5TESTNAMES=`ls *.txt`
6TESTFOLDER=`pwd`
7
8TIMEOUT=9999
9NUM_TRIES=20
10NUM_CONCURRENT=2
11
12usage()
13{
14cat << EOF
15usage: $0 options
16
17This script run the test1 or test2 over a machine.
18
19OPTIONS:
20 -h show this message
21 -s server hostname *REQUIRED
22 -o output folder name *REQUIRED
23 -t data containing POST data as txt files [default is pwd]
24 -n number of requests [50]
25 -c number concurrent requests [2]
26 -g include gnuplot output
27 -e include CSV output
28EOF
29}
30
31
32
33while getopts "hs:n:c:o:ge" opt; do
34 case $opt in
35 h) usage; exit 1;;
36 s) GATEWAY="http://$OPTARG/osrf-gateway-v1";;
37 t) TESTFOLDER=$OPTARG; TESTNAMES=`ls $TESTFOLDER *.txt`;;
38 s) GATEWAY="http://$OPTARG/osrf-gateway-v1";;
39 n) NUM_TRIES=$OPTARG;;
40 c) NUM_CONCURRENT=$OPTARG;;
41 o) OUTPUTFOLDER=$OPTARG;;
42 g) GNUPLOT_OUTPUT=1;;
43 e) CSV_OUTPUT=1;;
44 esac
45done
46
47if [ -z $GATEWAY ] || [ -z $OUTPUTFOLDER ]
48then
49 usage
50 exit 1
51fi
52
53
54mkdir -p $OUTPUTFOLDER
55pushd $OUTPUTFOLDER
56
57for MYTEST in $TESTNAMES
58do
59 echo "Running test $MYTEST"
60 if [ ! -z $GNUPLOT_OUTPUT ]
61 then
62 GNUPLOT="-g $MYTEST-gnuplot.tsv"
63 fi
64 if [ ! -z $CSV_OUTPUT ]
65 then
66 CSVOUT="-e $MYTEST.csv"
67 fi
68 ab -t $TIMEOUT -n $NUM_TRIES -c $NUM_CONCURRENT -p $TESTFOLDER/$MYTEST $GNUPLOT $CSVOUT -T "$MYCONTENTTYPE" "$GATEWAY" > $MYTEST-report.txt
69done
70popd