[PATCH] tests: Fix parse process memory
Chen Rong
chenr.fnst at cn.fujitsu.com
Mon Jul 17 23:44:35 PDT 2017
Ingore processes with name that contains 'sudo',
Don't throw the exception when read memory failed.
Signed-off-by: Chen Rong <chenr.fnst at cn.fujitsu.com>
---
tests/hwsim/test_ap_psk.py | 15 ++++++++++-----
1 file changed, 10 insertions(+), 5 deletions(-)
diff --git a/tests/hwsim/test_ap_psk.py b/tests/hwsim/test_ap_psk.py
index 21523e0..4e6bdd3 100644
--- a/tests/hwsim/test_ap_psk.py
+++ b/tests/hwsim/test_ap_psk.py
@@ -1701,6 +1701,8 @@ def find_wpas_process(dev):
ifname = dev.ifname
err, data = dev.cmd_execute(['ps', 'ax'])
for l in data.splitlines():
+ if "sudo" in l:
+ continue
if "wpa_supplicant" not in l:
continue
if "-i" + ifname not in l:
@@ -1729,11 +1731,14 @@ def read_process_memory(pid, key=None):
for name in [ "[heap]", "[stack]" ]:
if name in l:
logger.info("%s 0x%x-0x%x is at %d-%d" % (name, start, end, len(buf), len(buf) + (end - start)))
- mem.seek(start)
- data = mem.read(end - start)
- buf += data
- if key and key in data:
- logger.info("Key found in " + l)
+ try:
+ mem.seek(start)
+ data = mem.read(end - start)
+ buf += data
+ if key and key in data:
+ logger.info("Key found in " + l)
+ except Exception as e:
+ continue
logger.info("Total process memory read: %d bytes" % len(buf))
return buf
--
2.9.4
More information about the Hostap
mailing list