summaryrefslogtreecommitdiffstats
path: root/tools/testing/selftests/bpf/prog_tests/timer.c
diff options
context:
space:
mode:
authorTero Kristo <tero.kristo@linux.intel.com>2023-03-02 13:46:14 +0200
committerAlexei Starovoitov <ast@kernel.org>2023-03-02 22:41:32 -0800
commit944459e88b4f5c71683b56710f96e39756afae31 (patch)
tree97f2964ecc250c23440651af0a9c5b800f77c4bc /tools/testing/selftests/bpf/prog_tests/timer.c
parentf71f8530494bb5ab43d3369ef0ce8373eb1ee077 (diff)
downloadlinux-stable-944459e88b4f5c71683b56710f96e39756afae31.tar.gz
linux-stable-944459e88b4f5c71683b56710f96e39756afae31.tar.bz2
linux-stable-944459e88b4f5c71683b56710f96e39756afae31.zip
selftests/bpf: Add absolute timer test
Add test for the absolute BPF timer under the existing timer tests. This will run the timer two times with 1us expiration time, and then re-arm the timer at ~35s in the future. At the end, it is verified that the absolute timer expired exactly two times. Signed-off-by: Tero Kristo <tero.kristo@linux.intel.com> Link: https://lore.kernel.org/r/20230302114614.2985072-3-tero.kristo@linux.intel.com Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Diffstat (limited to 'tools/testing/selftests/bpf/prog_tests/timer.c')
-rw-r--r--tools/testing/selftests/bpf/prog_tests/timer.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/tools/testing/selftests/bpf/prog_tests/timer.c b/tools/testing/selftests/bpf/prog_tests/timer.c
index 7eb049214859..290c21dbe65a 100644
--- a/tools/testing/selftests/bpf/prog_tests/timer.c
+++ b/tools/testing/selftests/bpf/prog_tests/timer.c
@@ -29,6 +29,9 @@ static int timer(struct timer *timer_skel)
/* check that timer_cb2() was executed twice */
ASSERT_EQ(timer_skel->bss->bss_data, 10, "bss_data");
+ /* check that timer_cb3() was executed twice */
+ ASSERT_EQ(timer_skel->bss->abs_data, 12, "abs_data");
+
/* check that there were no errors in timer execution */
ASSERT_EQ(timer_skel->bss->err, 0, "err");