selftests/bpf: Cleanup comments in test_maps
authorAnton Protopopov <a.s.protopopov@gmail.com>
Wed, 27 May 2020 18:56:58 +0000 (18:56 +0000)
committerAlexei Starovoitov <ast@kernel.org>
Mon, 1 Jun 2020 21:38:21 +0000 (14:38 -0700)
Make comments inside the test_map_rdonly and test_map_wronly tests
consistent with logic.

Signed-off-by: Anton Protopopov <a.s.protopopov@gmail.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Link: https://lore.kernel.org/bpf/20200527185700.14658-4-a.s.protopopov@gmail.com
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
tools/testing/selftests/bpf/test_maps.c

index 46cf2c232964a0907321983368c0c24ebaca4bd7..08d63948514aa65f6ada8f099ce200f3e44c2280 100644 (file)
@@ -1394,11 +1394,11 @@ static void test_map_rdonly(void)
 
        key = 1;
        value = 1234;
-       /* Insert key=1 element. */
+       /* Try to insert key=1 element. */
        assert(bpf_map_update_elem(fd, &key, &value, BPF_ANY) == -1 &&
               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_get_next_key(fd, &key, &value) == -1 && errno == ENOENT);
 
@@ -1422,7 +1422,7 @@ static void test_map_wronly(void)
        /* Insert key=1 element. */
        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_get_next_key(fd, &key, &value) == -1 && errno == EPERM);