Commit dacb8ad1 authored by Brenden Blanco's avatar Brenden Blanco

python3 compat: tracepoint fixes

Signed-off-by: default avatarBrenden Blanco <bblanco@gmail.com>
parent 341ec67a
...@@ -1046,7 +1046,8 @@ class BPF(object): ...@@ -1046,7 +1046,8 @@ class BPF(object):
for k, v in self.open_tracepoints.items(): for k, v in self.open_tracepoints.items():
lib.perf_reader_free(v) lib.perf_reader_free(v)
(tp_category, tp_name) = k.split(':') (tp_category, tp_name) = k.split(':')
lib.bpf_detach_tracepoint(tp_category, tp_name) lib.bpf_detach_tracepoint(tp_category.encode("ascii"),
tp_name.encode("ascii"))
self.open_tracepoints.clear() self.open_tracepoints.clear()
for (ev_type, ev_config) in list(self.open_perf_events.keys()): for (ev_type, ev_config) in list(self.open_perf_events.keys()):
self.detach_perf_event(ev_type, ev_config) self.detach_perf_event(ev_type, ev_config)
......
...@@ -61,10 +61,8 @@ class TestTracepointDataLoc(unittest.TestCase): ...@@ -61,10 +61,8 @@ class TestTracepointDataLoc(unittest.TestCase):
b = bcc.BPF(text=text) b = bcc.BPF(text=text)
subprocess.check_output(["/bin/ls"]) subprocess.check_output(["/bin/ls"])
sleep(1) sleep(1)
found = False self.assertTrue("/bin/ls" in [v.filename.decode()
for k, v in b["execs"].items(): for v in b["execs"].values()])
found = "ls" in v.filename
self.assertTrue(found, "'ls' was not found in map")
if __name__ == "__main__": if __name__ == "__main__":
unittest.main() unittest.main()
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment