Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoraleherbau2011-05-20 08:40:25 +0000
committeraleherbau2011-05-20 08:40:25 +0000
commit73735f051e804cbb706ff89be540f66a2f1fdbf8 (patch)
treed2f69bbbd9cc364733490e8a1014f79bac9d28a3 /python/src/tcf/tests/BasicTests.py
parent4b69abdaf927c94c4383e1771f3988af03d5d317 (diff)
downloadorg.eclipse.tcf-73735f051e804cbb706ff89be540f66a2f1fdbf8.tar.gz
org.eclipse.tcf-73735f051e804cbb706ff89be540f66a2f1fdbf8.tar.xz
org.eclipse.tcf-73735f051e804cbb706ff89be540f66a2f1fdbf8.zip
TCF Python: Implemented PathMap proxy service
Diffstat (limited to 'python/src/tcf/tests/BasicTests.py')
-rw-r--r--python/src/tcf/tests/BasicTests.py74
1 files changed, 68 insertions, 6 deletions
diff --git a/python/src/tcf/tests/BasicTests.py b/python/src/tcf/tests/BasicTests.py
index da8200b12..044f94452 100644
--- a/python/src/tcf/tests/BasicTests.py
+++ b/python/src/tcf/tests/BasicTests.py
@@ -54,6 +54,7 @@ def test():
testFileSystem(c)
testMemory(c)
testMemoryMap(c)
+ testPathMap(c)
except Exception as e:
protocol.log(e)
@@ -469,7 +470,6 @@ def testMemory(c):
def testMemoryMap(c):
if not _memory: return
- from tcf.services import memorymap
cmd = sync.CommandControl(c)
try:
mm = cmd.MemoryMap
@@ -477,13 +477,75 @@ def testMemoryMap(c):
# no MemoryMap service
return
id = _memory[0]
+ lock = threading.Condition()
+ from tcf.services import memorymap
+ def getMap():
+ mm = c.getRemoteService(memorymap.NAME)
+ class DoneGet(memorymap.DoneGet):
+ def doneGet(self, token, error, map):
+ if error:
+ protocol.log("Error from MemoryMap.get", error)
+ else:
+ print map
+ with lock:
+ lock.notify()
+ mm.get(id, DoneGet())
+ with lock:
+ protocol.invokeLater(getMap)
+ lock.wait(1000)
+ def setMap():
+ mm = c.getRemoteService(memorymap.NAME)
+ class DoneSet(memorymap.DoneSet):
+ def doneSet(self, token, error):
+ if error:
+ protocol.log("Error from MemoryMap.set", error)
+ with lock:
+ lock.notify()
+ mm.set(id, {memorymap.PROP_FILE_NAME : "/tmp/system.elf"}, DoneSet())
+ with lock:
+ protocol.invokeLater(setMap)
+ lock.wait(1000)
map = mm.get(id).get()
print "Memory map:", map
- region = memorymap.MemoryRegion({memorymap.PROP_FILE_NAME : "/tmp/system.elf"})
- print "Memory map: setting map", [region]
- mm.set(id, [region]).get()
- map = mm.get(id).get()
- print "Memory map:", map
+
+def testPathMap(c):
+ cmd = sync.CommandControl(c)
+ try:
+ pm = cmd.PathMap
+ except AttributeError:
+ # no PathMap service
+ return
+ lock = threading.Condition()
+ from tcf.services import pathmap
+ def getMap():
+ pm = c.getRemoteService(pathmap.NAME)
+ class DoneGet(pathmap.DoneGet):
+ def doneGet(self, token, error, map):
+ if error:
+ protocol.log("Error from PathMap.get", error)
+ else:
+ print map
+ with lock:
+ lock.notify()
+ pm.get(DoneGet())
+ with lock:
+ protocol.invokeLater(getMap)
+ lock.wait(1000)
+ def setMap():
+ pm = c.getRemoteService(pathmap.NAME)
+ class DoneSet(pathmap.DoneSet):
+ def doneSet(self, token, error):
+ if error:
+ protocol.log("Error from PathMap.set", error)
+ with lock:
+ lock.notify()
+ pm.set({pathmap.PROP_SOURCE : "/tmp",
+ pathmap.PROP_DESTINATION : "/home"}, DoneSet())
+ with lock:
+ protocol.invokeLater(setMap)
+ lock.wait(1000)
+ map = pm.get().get()
+ print "Path map:", map
if __name__ == '__main__':
test()

Back to the top