summaryrefslogtreecommitdiff
path: root/enhanced-position-service/scripts/run-test.py
blob: 9226ca00b068957ed0b2b45cc41f1feb554dcecd (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
#!/usr/bin/python
#
# call from your build directory (e.g. build, Debug, ...)
#
# vim: set noexpandtab sw=4 ts=4:
#
#-----------------------------------------------------------------------
# If you have no active dbus session you have to call with dbus-launch
#
#   $ dbus-launch --exit-with-session ../run-test.py
#
#-----------------------------------------------------------------------


import time
import sys
from StartHelperGeneric import StartHelperGeneric

#-----------------------------------------------------------------------------
# main
#-----------------------------------------------------------------------------
def main():
	duration = 3.0
	print "starting test script: test %i seconds...\n" % duration

	# starten server by helper
	server = StartHelperGeneric(["enhanced-position-service/src/position-daemon"], "server")
	server.setEnv("REPLAYER_LOG_FILE",
		      "../replayer/logs/testlog.gvsl")
	client = StartHelperGeneric(["enhanced-position-service/test/test-enhpos"], "test-client")

	server.start()

	time.sleep(2)
	client.start()

	time.sleep(duration)

	# expect them to be terminated by SIGINT --> -2
	status = 0
	rc = 0
	rc = client.stop()
	if rc != -2:
		status += 1

	rc = server.stop()
	if rc != -2:
		status += 1

	print "exit code: %d" % status
	sys.exit(status)

if __name__ == "__main__":
    main()