Commit 95fbda1e authored by Stanislav Fomichev's avatar Stanislav Fomichev Committed by Alexei Starovoitov

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: default avatarStanislav Fomichev <sdf@google.com>
Signed-off-by: default avatarAlexei Starovoitov <ast@kernel.org>
Acked-by: default avatarMartin KaFai Lau <kafai@fb.com>
Link: https://lore.kernel.org/bpf/20191015183125.124413-2-sdf@google.com
parent ba940948
...@@ -10,6 +10,7 @@ void test_skb_ctx(void) ...@@ -10,6 +10,7 @@ void test_skb_ctx(void)
.cb[3] = 4, .cb[3] = 4,
.cb[4] = 5, .cb[4] = 5,
.priority = 6, .priority = 6,
.tstamp = 7,
}; };
struct bpf_prog_test_run_attr tattr = { struct bpf_prog_test_run_attr tattr = {
.data_in = &pkt_v4, .data_in = &pkt_v4,
...@@ -86,4 +87,8 @@ void test_skb_ctx(void) ...@@ -86,4 +87,8 @@ void test_skb_ctx(void)
"ctx_out_priority", "ctx_out_priority",
"skb->priority == %d, expected %d\n", "skb->priority == %d, expected %d\n",
skb.priority, 7); skb.priority, 7);
CHECK_ATTR(skb.tstamp != 8,
"ctx_out_tstamp",
"skb->tstamp == %lld, expected %d\n",
skb.tstamp, 8);
} }
...@@ -16,6 +16,7 @@ int process(struct __sk_buff *skb) ...@@ -16,6 +16,7 @@ int process(struct __sk_buff *skb)
skb->cb[i]++; skb->cb[i]++;
} }
skb->priority++; skb->priority++;
skb->tstamp++;
return 0; return 0;
} }
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