def __init__(self): locals = { # @ReservedAssignment "connect": tcf.connect, "peers": print_peers() } protocol.startEventQueue() protocol.startDiscovery() protocol.invokeAndWait(protocol.addChannelOpenListener, self) code.InteractiveConsole.__init__(self, locals)
def test(): global _services protocol.startEventQueue() atexit.register(protocol.getEventQueue().shutdown) # testTimer() try: c = tcf.connect("TCP:127.0.0.1:1534") except Exception as e: protocol.log(e) sys.exit() assert c.state == channel.STATE_OPEN if __TRACE: protocol.invokeAndWait(c.addTraceListener, TraceListener()) _services = protocol.invokeAndWait(c.getRemoteServices) print "services=", _services if "RunControl" in _services: # RunControl must be first _services.remove("RunControl") _services.insert(0, "RunControl") for service in _services: testFct = globals().get("test" + service) if testFct: print "Testing service '%s'..." % service try: testFct(c) print "Completed test of service '%s'." % service except Exception as e: protocol.log("Exception testing %s" % service, e) else: print "No test for service '%s' found." % service try: testSyncCommands(c) testTasks(c) testEvents(c) testDataCache(c) except Exception as e: protocol.log(e) if c.state == channel.STATE_OPEN: time.sleep(5) protocol.invokeLater(c.close) time.sleep(2)
def test(): global _services protocol.startEventQueue() atexit.register(protocol.getEventQueue().shutdown) # testTimer() try: c = tcf.connect("TCP:127.0.0.1:1534") except Exception as e: protocol.log(e) sys.exit() assert c.state == channel.STATE_OPEN if __TRACE: protocol.invokeAndWait(c.addTraceListener, TraceListener()) _services = sorted(protocol.invokeAndWait(c.getRemoteServices)) print("services=" + str(_services)) if "RunControl" in _services: # RunControl must be first _services.remove("RunControl") _services.insert(0, "RunControl") for service in _services: testFct = globals().get("test" + service) if testFct: print("Testing service '%s'..." % service) try: testFct(c) print("Completed test of service '%s'." % service) except Exception as e: protocol.log("Exception testing %s" % service, e) else: print("No test for service '%s' found." % service) try: testSyncCommands(c) testTasks(c) testEvents(c) testDataCache(c) except Exception as e: protocol.log(e) if c.state == channel.STATE_OPEN: time.sleep(5) protocol.invokeLater(c.close) time.sleep(2)
def test(): protocol.startEventQueue() atexit.register(protocol.getEventQueue().shutdown) #testTimer() try: c = tcf.connect("TCP:127.0.0.1:1534") except Exception as e: protocol.log(e) sys.exit() assert c.state == channel.STATE_OPEN if __TRACE: protocol.invokeLater(c.addTraceListener, TraceListener()) def printServices(): print "services=", c.getRemoteServices() protocol.invokeLater(printServices) try: testRunControl(c) testStackTrace(c) testDisassembly(c) testBreakpoints(c) testSymbols(c) testRegisters(c) testExpressions(c) testLineNumbers(c) testSyncCommands(c) testTasks(c) testEvents(c) testDataCache(c) testProcesses(c) testFileSystem(c) testMemory(c) testMemoryMap(c) testPathMap(c) testSysMonitor(c) except Exception as e: protocol.log(e) if c.state == channel.STATE_OPEN: time.sleep(5) protocol.invokeLater(c.close) time.sleep(2)
# create a condition to wait on lock = threading.Condition() with lock: # TCF requests must be called by the dispatche thread, wait for a # maximum of 10 seconds protocol.invokeLater(callSubscribe, service=svc, streamType=streamType, listener=listener, condition=lock) lock.wait(10) # --------------------------------------------------------------------------- # # TCF initialisation protocol.startEventQueue() protocol.setLogger(TcfProtocolLogger()) atexit.register(protocol.getEventQueue().shutdown) try: c = tcf.connect("TCP:127.0.0.1:1534") except Exception as e: protocol.log(e) sys.exit() # If there is a streams service, listen to it streamsSvc = getService(c, streams.NAME) if streamsSvc: subscribe(streamsSvc, 'ProcessesV1', StreamsListener(streamsSvc))
with lock: # TCF requests must be called by the dispatche thread, wait for a # maximum of 10 seconds protocol.invokeLater(callSubscribe, service=svc, streamType=streamType, listener=listener, condition=lock) lock.wait(10) # --------------------------------------------------------------------------- # # TCF initialisation protocol.startEventQueue() protocol.setLogger(TcfProtocolLogger()) atexit.register(protocol.getEventQueue().shutdown) try: c = tcf.connect("TCP:127.0.0.1:1534") except Exception as e: protocol.log(e) sys.exit() # If there is a streams service, listen to it streamsSvc = getService(c, streams.NAME) if streamsSvc: subscribe(streamsSvc, 'ProcessesV1', StreamsListener(streamsSvc))