Skip to content

Commit

Permalink
python3 compat: tracepoint fixes
Browse files Browse the repository at this point in the history
Signed-off-by: Brenden Blanco <[email protected]>
  • Loading branch information
drzaeus77 committed Feb 9, 2017
1 parent 341ec67 commit dacb8ad
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
3 changes: 2 additions & 1 deletion src/python/bcc/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -1046,7 +1046,8 @@ def cleanup(self):
for k, v in self.open_tracepoints.items():
lib.perf_reader_free(v)
(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()
for (ev_type, ev_config) in list(self.open_perf_events.keys()):
self.detach_perf_event(ev_type, ev_config)
Expand Down
6 changes: 2 additions & 4 deletions tests/python/test_tracepoint.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,8 @@ def test_tracepoint_data_loc(self):
b = bcc.BPF(text=text)
subprocess.check_output(["/bin/ls"])
sleep(1)
found = False
for k, v in b["execs"].items():
found = "ls" in v.filename
self.assertTrue(found, "'ls' was not found in map")
self.assertTrue("/bin/ls" in [v.filename.decode()
for v in b["execs"].values()])

if __name__ == "__main__":
unittest.main()

0 comments on commit dacb8ad

Please sign in to comment.