1# -*- coding: utf-8 -*-
2
3import sys
4import os
5import time
6import string
7
8import common
9
10def launch (extraArgs = ""):
11	curDir = os.getcwd()
12
13	try:
14		os.chdir(common.ANDROID_DIR)
15
16		adbCmd = common.shellquote(common.ADB_BIN)
17		if len(extraArgs) > 0:
18			adbCmd += " %s" % extraArgs
19
20		print "Launching dEQP ExecService..."
21		common.execute("%s forward tcp:50016 tcp:50016" % adbCmd)
22		common.execute("%s shell setprop log.tag.dEQP DEBUG" % adbCmd)
23		common.execute("%s shell am start -n com.drawelements.deqp/.execserver.ServiceStarter" % adbCmd)
24		print "ExecService launched on device"
25	finally:
26		# Restore working dir
27		os.chdir(curDir)
28
29if __name__ == "__main__":
30	if len(sys.argv) > 1:
31		launch(string.join(sys.argv[1:], " "))
32	else:
33		launch()
34