Skip to content

Commit

Permalink
bpf: add further test cases around div/mod and others
Browse files Browse the repository at this point in the history
Update selftests to relfect recent changes and add various new
test cases.

Signed-off-by: Daniel Borkmann <[email protected]>
Acked-by: Alexei Starovoitov <[email protected]>
Signed-off-by: Alexei Starovoitov <[email protected]>
  • Loading branch information
borkmann authored and Alexei Starovoitov committed Jan 27, 2018
1 parent 73ae3c0 commit 21ccaf2
Show file tree
Hide file tree
Showing 2 changed files with 336 additions and 15 deletions.
8 changes: 6 additions & 2 deletions lib/test_bpf.c
Original file line number Diff line number Diff line change
Expand Up @@ -2003,10 +2003,14 @@ static struct bpf_test tests[] = {
{ { 4, 0 }, { 5, 10 } }
},
{
"INT: DIV by zero",
/* This one doesn't go through verifier, but is just raw insn
* as opposed to cBPF tests from here. Thus div by 0 tests are
* done in test_verifier in BPF kselftests.
*/
"INT: DIV by -1",
.u.insns_int = {
BPF_ALU64_REG(BPF_MOV, R6, R1),
BPF_ALU64_IMM(BPF_MOV, R7, 0),
BPF_ALU64_IMM(BPF_MOV, R7, -1),
BPF_LD_ABS(BPF_B, 3),
BPF_ALU32_REG(BPF_DIV, R0, R7),
BPF_EXIT_INSN(),
Expand Down
Loading

0 comments on commit 21ccaf2

Please sign in to comment.