Commit efbc3b8f authored by Anton Protopopov's avatar Anton Protopopov Committed by Alexei Starovoitov

selftests/bpf: Cleanup comments in test_maps

Make comments inside the test_map_rdonly and test_map_wronly tests
consistent with logic.
Signed-off-by: default avatarAnton Protopopov <a.s.protopopov@gmail.com>
Signed-off-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
Link: https://lore.kernel.org/bpf/20200527185700.14658-4-a.s.protopopov@gmail.comSigned-off-by: default avatarAlexei Starovoitov <ast@kernel.org>
parent 36ef9a2d
...@@ -1394,11 +1394,11 @@ static void test_map_rdonly(void) ...@@ -1394,11 +1394,11 @@ static void test_map_rdonly(void)
key = 1; key = 1;
value = 1234; value = 1234;
/* Insert key=1 element. */ /* Try to insert key=1 element. */
assert(bpf_map_update_elem(fd, &key, &value, BPF_ANY) == -1 && assert(bpf_map_update_elem(fd, &key, &value, BPF_ANY) == -1 &&
errno == EPERM); errno == EPERM);
/* Check that key=2 is not found. */ /* Check that key=1 is not found. */
assert(bpf_map_lookup_elem(fd, &key, &value) == -1 && errno == ENOENT); assert(bpf_map_lookup_elem(fd, &key, &value) == -1 && errno == ENOENT);
assert(bpf_map_get_next_key(fd, &key, &value) == -1 && errno == ENOENT); assert(bpf_map_get_next_key(fd, &key, &value) == -1 && errno == ENOENT);
...@@ -1422,7 +1422,7 @@ static void test_map_wronly(void) ...@@ -1422,7 +1422,7 @@ static void test_map_wronly(void)
/* Insert key=1 element. */ /* Insert key=1 element. */
assert(bpf_map_update_elem(fd, &key, &value, BPF_ANY) == 0); assert(bpf_map_update_elem(fd, &key, &value, BPF_ANY) == 0);
/* Check that key=2 is not found. */ /* Check that reading elements and keys from the map is not allowed. */
assert(bpf_map_lookup_elem(fd, &key, &value) == -1 && errno == EPERM); assert(bpf_map_lookup_elem(fd, &key, &value) == -1 && errno == EPERM);
assert(bpf_map_get_next_key(fd, &key, &value) == -1 && errno == EPERM); assert(bpf_map_get_next_key(fd, &key, &value) == -1 && errno == EPERM);
......
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