Skip to content

Commit

Permalink
Fixed failing test_simple_library() in test_uprobes.py
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael Przybylski committed Feb 9, 2017
1 parent 942c9c1 commit 70e2034
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions tests/python/test_uprobes.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,18 +24,18 @@ def test_simple_library(self):
incr(0);
return 0;
}"""
text = text.replace("PID", "%d" % os.getpid())
print text
test_pid = os.getpid()
text = text.replace("PID", "%d" % test_pid)
b = bcc.BPF(text=text)
b.attach_uprobe(name="c", sym="malloc_stats", fn_name="count")
b.attach_uretprobe(name="c", sym="malloc_stats", fn_name="count")
b.attach_uprobe(name="c", sym="malloc_stats", fn_name="count", pid=test_pid)
b.attach_uretprobe(name="c", sym="malloc_stats", fn_name="count", pid=test_pid)
libc = ctypes.CDLL("libc.so.6")
libc.malloc_stats.restype = None
libc.malloc_stats.argtypes = []
libc.malloc_stats()
self.assertEqual(b["stats"][ctypes.c_int(0)].value, 2)
b.detach_uretprobe(name="c", sym="malloc_stats")
b.detach_uprobe(name="c", sym="malloc_stats")
b.detach_uretprobe(name="c", sym="malloc_stats", pid=test_pid)
b.detach_uprobe(name="c", sym="malloc_stats", pid=test_pid)

def test_simple_binary(self):
text = """
Expand Down

0 comments on commit 70e2034

Please sign in to comment.