Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoraleherbau2011-05-24 14:10:19 +0000
committeraleherbau2011-05-24 14:10:19 +0000
commit3d66a56851515eb95b5d8c50459880b6993de56e (patch)
tree40f50a6da6001451e5522fbd1136d079dee3a7d2 /python/src/tcf/tests/BasicTests.py
parentf9297e5ea735fd0721a815ffa95fd7f5f4cc18b7 (diff)
downloadorg.eclipse.tcf-3d66a56851515eb95b5d8c50459880b6993de56e.tar.gz
org.eclipse.tcf-3d66a56851515eb95b5d8c50459880b6993de56e.tar.xz
org.eclipse.tcf-3d66a56851515eb95b5d8c50459880b6993de56e.zip
TCF Python: Implemented SysMonitor service proxy
Diffstat (limited to 'python/src/tcf/tests/BasicTests.py')
-rw-r--r--python/src/tcf/tests/BasicTests.py47
1 files changed, 47 insertions, 0 deletions
diff --git a/python/src/tcf/tests/BasicTests.py b/python/src/tcf/tests/BasicTests.py
index 044f94452..fd151f2f2 100644
--- a/python/src/tcf/tests/BasicTests.py
+++ b/python/src/tcf/tests/BasicTests.py
@@ -55,6 +55,7 @@ def test():
testMemory(c)
testMemoryMap(c)
testPathMap(c)
+ testSysMonitor(c)
except Exception as e:
protocol.log(e)
@@ -547,5 +548,51 @@ def testPathMap(c):
map = pm.get().get()
print "Path map:", map
+def testSysMonitor(c):
+ cmd = sync.CommandControl(c)
+ try:
+ sm = cmd.SysMonitor
+ except AttributeError:
+ # no SysMonotor service
+ return
+ lock = threading.Condition()
+ from tcf.services import sysmonitor
+ processes = []
+ def getProcesses():
+ sm = c.getRemoteService(sysmonitor.NAME)
+ pending = []
+ class DoneGetChildren(sysmonitor.DoneGetChildren):
+ def doneGetChildren(self, token, error, context_ids):
+ pending.remove(token)
+ if error:
+ protocol.log("Error from SysMonitor.getChildren", error)
+ else:
+ class DoneGetContext(sysmonitor.DoneGetContext):
+ def doneGetContext(self, token, error, context):
+ pending.remove(token)
+ if error:
+ protocol.log("Error from SysMonitor.getContext", error)
+ else:
+ processes.append(context)
+ if not pending:
+ with lock:
+ lock.notify()
+ for id in context_ids:
+ pending.append(sm.getContext(id, DoneGetContext()))
+ if not pending:
+ with lock:
+ lock.notify()
+ pending.append(sm.getChildren(None, DoneGetChildren()))
+ with lock:
+ protocol.invokeLater(getProcesses)
+ lock.wait(5000)
+ print "%d processes found:" % len(processes)
+ for p in processes:
+ print p
+ cmdl = sm.getCommandLine(p.getID()).get()
+ if cmdl: print "Command line: ", cmdl
+ envp = sm.getEnvironment(p.getID()).get()
+ print "Environment: ", envp
+
if __name__ == '__main__':
test()

Back to the top