Skip to content

Commit

Permalink
test/test_histogram.py: fix test failed on kernel-5.10
Browse files Browse the repository at this point in the history
kernel commit(cf25e24db61cc) rename tsk->real_start_time to
start_boottime, so test_hostogram will get failed on kernel>=5.5

Signed-off-by: Chunmei Xu <[email protected]>
  • Loading branch information
xuchunmei000 authored and yonghong-song committed Jan 15, 2021
1 parent 2b97264 commit 97cded0
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions tests/python/test_histogram.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,15 @@ def test_chars(self):
b = BPF(text="""
#include <uapi/linux/ptrace.h>
#include <linux/sched.h>
#include <linux/version.h>
typedef struct { char name[TASK_COMM_LEN]; u64 slot; } Key;
BPF_HISTOGRAM(hist1, Key, 1024);
int kprobe__finish_task_switch(struct pt_regs *ctx, struct task_struct *prev) {
#if LINUX_VERSION_CODE < KERNEL_VERSION(5,5,0)
Key k = {.slot = bpf_log2l(prev->real_start_time)};
#else
Key k = {.slot = bpf_log2l(prev->start_boottime)};
#endif
if (!bpf_get_current_comm(&k.name, sizeof(k.name)))
hist1.increment(k);
return 0;
Expand Down

0 comments on commit 97cded0

Please sign in to comment.