-
Notifications
You must be signed in to change notification settings - Fork 3
/
suite_example.sh
60 lines (51 loc) · 1.32 KB
/
suite_example.sh
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
59
60
#!/bin/bash
#
# Example benchmark suite script. This shows how to use the functions in bench to define
# and execute a simple test suite.
#
# Location of this script
dir=$($(cd `dirname $0`) && pwd)
. $dir/bench/lib/bench.sh
# Define functions required to execute benchmarks
# (see: bench/lib/bench.sh)
function setParams {
local TESTNAME="$1"
case "$TESTNAME" in
MyTest1)
IMPLEMENTATION="MyTest"
URL="http://localhost:8080/plaintext"
DURATION=10
ITERATIONS=2
;;
MyTest2)
IMPLEMENTATION="YourTest"
URL="http://localhost:8080/json"
DURATION=30
ITERATIONS=2
;;
*)
echo "Unknown test $TESTNAME"
;;
esac
}
function runBenchmark {
local TESTNAME="$1"
case "$TESTNAME" in
MyTest1|MyTest2)
# Execute a 2-way compare of our benchmark from two builds
results=`$dir/bench/compare.sh $dir/baselineBuild/release/${IMPLEMENTATION},label=Baseline,pwd=$dir $dir/newBuild/release/${IMPLEMENTATION},label=New,pwd=$dir`
;;
*)
echo "Unknown test $TESTNAME"
;;
esac
# Update global return code with the result of this run
rc=$(($rc+$?))
}
# Keep track of return code from successive benchmark runs
rc=0
# Execute benchmarks
executeTest "MyTest1"
executeTest "MyTest2"
# Exit with resulting return code
exit $rc