Skip to contentSkip to conversation

samples/bpf: Fix test_maps/bpf_get_next_key() test

PATCH New Michael Holzheu 1 participant 1 message Jan 22, 2015 BPF

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 samples/bpf: Fix test_maps/bpf_get_next_key() test

Looks like the "test_maps" test case expects to get the keys in the wrong order when iterating over the elements:

test_maps: samples/bpf/test_maps.c:79: test_hashmap_sanity: Assertion `bpf_get_next_key(map_fd, &key, &next_key) == 0 && next_key == 2' failed. Aborted

Fix this and test for the correct order.

---
 samples/bpf/test_maps.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
samples/bpf/test_maps.c +2 -2
@@ -69,9 +69,9 @@ static void test_hashmap_sanity(int i, v
 
 	/* iterate over two elements */
 	assert(bpf_get_next_key(map_fd, &key, &next_key) == 0 &&
-	       next_key == 2);
-	assert(bpf_get_next_key(map_fd, &next_key, &next_key) == 0 &&
 	       next_key == 1);
+	assert(bpf_get_next_key(map_fd, &next_key, &next_key) == 0 &&
+	       next_key == 2);
 	assert(bpf_get_next_key(map_fd, &next_key, &next_key) == -1 &&
 	       errno == ENOENT);