-
Notifications
You must be signed in to change notification settings - Fork 26
/
Copy pathrun
executable file
·58 lines (47 loc) · 1.27 KB
/
run
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#!/bin/bash
# args
declare -i argc=0
declare -a argv=()
while (( $# > 0 ))
do
case "$1" in
-*)
if [[ "$1" =~ 'd' ]]; then
dflag='-d'
fi
shift
;;
*)
((++argc))
argv=("${argv[@]}" "$1")
shift
;;
esac
done
usage_exit() {
echo "Usage: $0 [-d] (p|c) name" 1>&2
echo " -d stands for directory and overrides default location of results \"./stats/$TEST/$NAME\", where:"
echo " - $TEST can be c (consuming simulation) or p (publishing simulation)"
echo " - $NAME is last passed parameter"
echo " p|c mandatory parameter for choosing if p (PublishingSimulation) or c (ConsumingSimulation) should be run."
exit 1
}
[ $argc = 2 ] || usage_exit
op=${argv[0]} # p or c
cmd=""
[ "$op" = "p" ] && cmd="sbt 'testOnly io.gatling.amqp.PublishingSimulation'"
[ "$op" = "c" ] && cmd="sbt 'testOnly io.gatling.amqp.ConsumingSimulation'"
[ "$cmd" = "" ] && usage_exit
name=${argv[1]}
dir="stats/$op/$name"
log="$dir/log"
[ "$dflag" == "-d" ] && ( rm -rf $dir )
if [ -d $dir ] ; then
echo "error: $dir already exists" 1>&2
usage_exit
fi
mkdir -p $dir
# copy programs
cp -p src/test/scala/io/gatling/amqp/*.scala "$dir/"
time script -c "$cmd" $log
exit 0