/
TestPlatformClient.py
35 lines (28 loc) · 1.28 KB
/
TestPlatformClient.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import lldb
import binascii
import os
from lldbsuite.test.lldbtest import *
from lldbsuite.test.decorators import *
from gdbclientutils import *
class TestPlatformClient(GDBRemoteTestBase):
def test_process_list_with_all_users(self):
"""Test connecting to a remote linux platform"""
class MyResponder(MockGDBServerResponder):
def qfProcessInfo(self, packet):
if "all_users:1" in packet:
return "pid:10;ppid:1;uid:1;gid:1;euid:1;egid:1;name:" + binascii.hexlify("/a/test_process") + ";"
else:
return "E04"
self.server.responder = MyResponder()
self.runCmd("platform select remote-linux")
try:
self.runCmd("platform connect connect://localhost:%d" %
self.server.port)
self.assertTrue(self.dbg.GetSelectedPlatform().IsConnected())
self.expect("platform process list -x",
substrs=["1 matching process was found", "test_process"])
self.expect("platform process list",
error=True,
substrs=["error: no processes were found on the \"remote-linux\" platform"])
finally:
self.dbg.GetSelectedPlatform().DisconnectRemote()