summaryrefslogtreecommitdiff
path: root/tests/test-performance/test-resourceqt-performance-runner.sh
blob: b255a9c141a63c22a202517201dd24ff1fc66262 (plain)
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
#!/bin/sh

# Source and export D-Bus session info 
. /tmp/session_bus_address.user 

# D-Bus spamming is default option
nospam="0"
spamparam="-t10 -s50"

if [ $# -eq 0 ]
then
	echo "Usage: test-resourceqt-performance-runner.sh test_case_nr"
	exit 2
fi

case "$1" in
	0)
	export TEST_DESC="Testcase without dbus spamming"
	export TEST_NAME="no dbus load"
	nospam="1"
	collectparam="--create"
	;;
	1)
	export TEST_DESC="Testcase with 5 dbus spamming threads, message size 50 bytes"
	export TEST_NAME="small dbus load"
	spamparam="-t5 -s50"
	;;
	2)
	export TEST_DESC="Testcase with 10 dbus spamming threads, message size 50 bytes"
	export TEST_NAME="medium dbus load"
	spamparam="-t10 -s50"
	;;
	3)
	export TEST_DESC="Testcase with 20 dbus spamming threads, message size 50 bytes"
	export TEST_NAME="heavy dbus load"
	spamparam="-t20 -s50"
	;;
	4)
	export TEST_DESC="Testcase with 20 dbus spamming threads, message size 150 bytes"
	export TEST_NAME="very heavy dbus load"
	spamparam="-t20 -s150"
	collectparam="--finalize"
	;;
	*)
	echo "Usage: test-resourceqt-performance-runner.sh test_case_nr"
	exit 2
	;;
esac

# Run spam server
if [ "$nospam" != "1" ]
then
  /usr/lib/libresourceqt-performance-tests/dbus-spammer $spamparam &
  if [ $? -ne 0 ]
  then
    exit 3;
  fi
  sleep 5
fi

# Check the speed!
/usr/lib/libresourceqt-performance-tests/test-resourceqt-performance
status=$?

# Kill spammer
if [ "$nospam" != "1" ]
then
  killall dbus-spammer
fi

# Collect the results
/usr/lib/libresourceqt-performance-tests/test-resourceqt-performance-collector $collectparam

if [ "$status" -ne 0 ]
then
  echo "Test failed with value $status"
fi

# Return number of failed acquire/release cycles, nothing should be failing... 
exit $status