From 97cded04a9d6370ac722c6ad8e73b72c4794e851 Mon Sep 17 00:00:00 2001 From: Chunmei Xu Date: Fri, 15 Jan 2021 09:51:27 +0800 Subject: [PATCH] test/test_histogram.py: fix test failed on kernel-5.10 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 --- tests/python/test_histogram.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tests/python/test_histogram.py b/tests/python/test_histogram.py index 2fb8c1685d73..ec7950c9d5a7 100755 --- a/tests/python/test_histogram.py +++ b/tests/python/test_histogram.py @@ -59,10 +59,15 @@ def test_chars(self): b = BPF(text=""" #include #include +#include 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;