Skip to content

Commit

Permalink
samples: bpf: relax test_maps check
Browse files Browse the repository at this point in the history
hash map is unordered, so get_next_key() iterator shouldn't
rely on particular order of elements. So relax this test.

Fixes: ffb65f2 ("bpf: add a testsuite for eBPF maps")
Reported-by: Michael Holzheu <holzheu@linux.vnet.ibm.com>
Signed-off-by: Alexei Starovoitov <ast@plumgrid.com>
Acked-by: Daniel Borkmann <dborkman@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Alexei Starovoitov authored and davem330 committed Jan 27, 2015
1 parent 8ebe667 commit ba1a68b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions samples/bpf/test_maps.c
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,9 @@ static void test_hashmap_sanity(int i, void *data)

/* iterate over two elements */
assert(bpf_get_next_key(map_fd, &key, &next_key) == 0 &&
next_key == 2);
(next_key == 1 || next_key == 2));
assert(bpf_get_next_key(map_fd, &next_key, &next_key) == 0 &&
next_key == 1);
(next_key == 1 || next_key == 2));
assert(bpf_get_next_key(map_fd, &next_key, &next_key) == -1 &&
errno == ENOENT);

Expand Down

0 comments on commit ba1a68b

Please sign in to comment.