Skip to content

Commit

Permalink
selftests: bpf: Add selftest for __sk_buff tstamp
Browse files Browse the repository at this point in the history
Make sure BPF_PROG_TEST_RUN accepts tstamp and exports any
modifications that BPF program does.

Signed-off-by: Stanislav Fomichev <[email protected]>
Signed-off-by: Alexei Starovoitov <[email protected]>
Acked-by: Martin KaFai Lau <[email protected]>
Link: https://lore.kernel.org/bpf/[email protected]
  • Loading branch information
fomichev authored and Alexei Starovoitov committed Oct 15, 2019
1 parent ba94094 commit 95fbda1
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
5 changes: 5 additions & 0 deletions tools/testing/selftests/bpf/prog_tests/skb_ctx.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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);
}
1 change: 1 addition & 0 deletions tools/testing/selftests/bpf/progs/test_skb_ctx.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ int process(struct __sk_buff *skb)
skb->cb[i]++;
}
skb->priority++;
skb->tstamp++;

return 0;
}

0 comments on commit 95fbda1

Please sign in to comment.