зеркало из https://github.com/mozilla/pjs.git
Bug 722403 - DeviceManager: killProcess(): Add forceKill parameter and kill all matching processes, r=gbrown Earlier patch by Christian Holler.
--HG-- extra : rebase_source : 295a10d592827f4633951eda196505529560f8f0
This commit is contained in:
Родитель
c035407085
Коммит
c40c38d353
|
@ -235,12 +235,12 @@ class DeviceManager:
|
|||
|
||||
|
||||
@abstractmethod
|
||||
def killProcess(self, appname):
|
||||
def killProcess(self, appname, forceKill=False):
|
||||
"""
|
||||
external function
|
||||
returns:
|
||||
success: output from testagent
|
||||
failure: None
|
||||
success: True
|
||||
failure: False
|
||||
"""
|
||||
|
||||
@abstractmethod
|
||||
|
|
|
@ -376,16 +376,21 @@ class DeviceManagerADB(DeviceManager):
|
|||
|
||||
# external function
|
||||
# returns:
|
||||
# success: output from testagent
|
||||
# failure: None
|
||||
def killProcess(self, appname):
|
||||
# success: True
|
||||
# failure: False
|
||||
def killProcess(self, appname, forceKill=False):
|
||||
procs = self.getProcessList()
|
||||
didKillProcess = False
|
||||
for (pid, name, user) in procs:
|
||||
if name == appname:
|
||||
p = self.runCmdAs(["shell", "kill", pid])
|
||||
return p.stdout.read()
|
||||
args = ["shell", "kill"]
|
||||
if forceKill:
|
||||
args.append("-9")
|
||||
args.append(pid)
|
||||
p = self.runCmdAs(args)
|
||||
didKillProcess = True
|
||||
|
||||
return None
|
||||
return didKillProcess
|
||||
|
||||
# external function
|
||||
# returns:
|
||||
|
|
|
@ -582,15 +582,17 @@ class DeviceManagerSUT(DeviceManager):
|
|||
|
||||
# external function
|
||||
# returns:
|
||||
# success: output from testagent
|
||||
# failure: None
|
||||
def killProcess(self, appname):
|
||||
# success: True
|
||||
# failure: False
|
||||
def killProcess(self, appname, forceKill=False):
|
||||
if forceKill:
|
||||
print "WARNING: killProcess(): forceKill parameter unsupported on SUT"
|
||||
try:
|
||||
data = self.runCmds(['kill ' + appname])
|
||||
except AgentError:
|
||||
return None
|
||||
return False
|
||||
|
||||
return data
|
||||
return True
|
||||
|
||||
# external function
|
||||
# returns:
|
||||
|
|
Загрузка…
Ссылка в новой задаче