summaryrefslogtreecommitdiff
path: root/tools/testing/selftests/bpf/prog_tests/skb_ctx.c
diff options
context:
space:
mode:
authorStanislav Fomichev <sdf@google.com>2019-10-15 11:31:25 -0700
committerAlexei Starovoitov <ast@kernel.org>2019-10-15 16:24:26 -0700
commit95fbda1e37384b9c270218b52718c83ddf4bb34e (patch)
tree41e9be1d14ee013da8af794ddfa04985c38ae1c1 /tools/testing/selftests/bpf/prog_tests/skb_ctx.c
parentba94094818a811758570990648160a6ba2ca05cb (diff)
selftests: bpf: Add selftest for __sk_buff tstamp
Make sure BPF_PROG_TEST_RUN accepts tstamp and exports any modifications that BPF program does. Signed-off-by: Stanislav Fomichev <sdf@google.com> Signed-off-by: Alexei Starovoitov <ast@kernel.org> Acked-by: Martin KaFai Lau <kafai@fb.com> Link: https://lore.kernel.org/bpf/20191015183125.124413-2-sdf@google.com
Diffstat (limited to 'tools/testing/selftests/bpf/prog_tests/skb_ctx.c')
-rw-r--r--tools/testing/selftests/bpf/prog_tests/skb_ctx.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/tools/testing/selftests/bpf/prog_tests/skb_ctx.c b/tools/testing/selftests/bpf/prog_tests/skb_ctx.c
index e95baa32e277..a2eb8db8dafb 100644
--- a/tools/testing/selftests/bpf/prog_tests/skb_ctx.c
+++ b/tools/testing/selftests/bpf/prog_tests/skb_ctx.c
@@ -10,6 +10,7 @@ void test_skb_ctx(void)
.cb[3] = 4,
.cb[4] = 5,
.priority = 6,
+ .tstamp = 7,
};
struct bpf_prog_test_run_attr tattr = {
.data_in = &pkt_v4,
@@ -86,4 +87,8 @@ void test_skb_ctx(void)
"ctx_out_priority",
"skb->priority == %d, expected %d\n",
skb.priority, 7);
+ CHECK_ATTR(skb.tstamp != 8,
+ "ctx_out_tstamp",
+ "skb->tstamp == %lld, expected %d\n",
+ skb.tstamp, 8);
}