Commit 70e20343 authored by Michael Przybylski's avatar Michael Przybylski

Fixed failing test_simple_library() in test_uprobes.py

parent 942c9c15
...@@ -24,18 +24,18 @@ int count(struct pt_regs *ctx) { ...@@ -24,18 +24,18 @@ int count(struct pt_regs *ctx) {
incr(0); incr(0);
return 0; return 0;
}""" }"""
text = text.replace("PID", "%d" % os.getpid()) test_pid = os.getpid()
print text text = text.replace("PID", "%d" % test_pid)
b = bcc.BPF(text=text) b = bcc.BPF(text=text)
b.attach_uprobe(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") b.attach_uretprobe(name="c", sym="malloc_stats", fn_name="count", pid=test_pid)
libc = ctypes.CDLL("libc.so.6") libc = ctypes.CDLL("libc.so.6")
libc.malloc_stats.restype = None libc.malloc_stats.restype = None
libc.malloc_stats.argtypes = [] libc.malloc_stats.argtypes = []
libc.malloc_stats() libc.malloc_stats()
self.assertEqual(b["stats"][ctypes.c_int(0)].value, 2) self.assertEqual(b["stats"][ctypes.c_int(0)].value, 2)
b.detach_uretprobe(name="c", sym="malloc_stats") b.detach_uretprobe(name="c", sym="malloc_stats", pid=test_pid)
b.detach_uprobe(name="c", sym="malloc_stats") b.detach_uprobe(name="c", sym="malloc_stats", pid=test_pid)
def test_simple_binary(self): def test_simple_binary(self):
text = """ text = """
......
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