Skip to content
Snippets Groups Projects
  1. Sep 04, 2020
  2. Jan 10, 2020
  3. Nov 25, 2019
  4. Aug 27, 2019
  5. Aug 07, 2019
  6. Aug 06, 2019
  7. Jul 28, 2019
    • Andrii Nakryiko's avatar
      selftests/bpf: convert bpf_verif_scale.c to sub-tests API · 51436ed7
      Andrii Nakryiko authored
      
      Expose each BPF verifier scale test as individual sub-test to allow
      independent results output and test selection.
      
      Test run results now look like this:
      
        $ sudo ./test_progs -t verif/
        #3/1 loop3.o:OK
        #3/2 test_verif_scale1.o:OK
        #3/3 test_verif_scale2.o:OK
        #3/4 test_verif_scale3.o:OK
        #3/5 pyperf50.o:OK
        #3/6 pyperf100.o:OK
        #3/7 pyperf180.o:OK
        #3/8 pyperf600.o:OK
        #3/9 pyperf600_nounroll.o:OK
        #3/10 loop1.o:OK
        #3/11 loop2.o:OK
        #3/12 strobemeta.o:OK
        #3/13 strobemeta_nounroll1.o:OK
        #3/14 strobemeta_nounroll2.o:OK
        #3/15 test_sysctl_loop1.o:OK
        #3/16 test_sysctl_loop2.o:OK
        #3/17 test_xdp_loop.o:OK
        #3/18 test_seg6_loop.o:OK
        #3 bpf_verif_scale:OK
      
      Signed-off-by: default avatarAndrii Nakryiko <andriin@fb.com>
      Signed-off-by: default avatarAlexei Starovoitov <ast@kernel.org>
      51436ed7
    • Andrii Nakryiko's avatar
      selftests/bpf: abstract away test log output · 0ff97e56
      Andrii Nakryiko authored
      
      This patch changes how test output is printed out. By default, if test
      had no errors, the only output will be a single line with test number,
      name, and verdict at the end, e.g.:
      
        #31 xdp:OK
      
      If test had any errors, all log output captured during test execution
      will be output after test completes.
      
      It's possible to force output of log with `-v` (`--verbose`) option, in
      which case output won't be buffered and will be output immediately.
      
      To support this, individual tests are required to use helper methods for
      logging: `test__printf()` and `test__vprintf()`.
      
      Signed-off-by: default avatarAndrii Nakryiko <andriin@fb.com>
      Signed-off-by: default avatarAlexei Starovoitov <ast@kernel.org>
      0ff97e56
    • Andrii Nakryiko's avatar
      selftest/bpf: centralize libbpf logging management for test_progs · 329e38f7
      Andrii Nakryiko authored
      
      Make test_progs test runner own libbpf logging. Also introduce two
      levels of verbosity: -v and -vv. First one will be used in subsequent
      patches to enable test log output always. Second one increases verbosity
      level of libbpf logging further to include debug output as well.
      
      Signed-off-by: default avatarAndrii Nakryiko <andriin@fb.com>
      Signed-off-by: default avatarAlexei Starovoitov <ast@kernel.org>
      329e38f7
  8. Jun 19, 2019
    • Alexei Starovoitov's avatar
      selftests/bpf: add realistic loop tests · b061017f
      Alexei Starovoitov authored
      
      Add a bunch of loop tests. Most of them are created by replacing
      '#pragma unroll' with '#pragma clang loop unroll(disable)'
      
      Several tests are artificially large:
        /* partial unroll. llvm will unroll loop ~150 times.
         * C loop count -> 600.
         * Asm loop count -> 4.
         * 16k insns in loop body.
         * Total of 5 such loops. Total program size ~82k insns.
         */
        "./pyperf600.o",
      
        /* no unroll at all.
         * C loop count -> 600.
         * ASM loop count -> 600.
         * ~110 insns in loop body.
         * Total of 5 such loops. Total program size ~1500 insns.
         */
        "./pyperf600_nounroll.o",
      
        /* partial unroll. 19k insn in a loop.
         * Total program size 20.8k insn.
         * ~350k processed_insns
         */
        "./strobemeta.o",
      
      Signed-off-by: default avatarAlexei Starovoitov <ast@kernel.org>
      Acked-by: default avatarAndrii Nakryiko <andriin@fb.com>
      Signed-off-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
      b061017f
  9. May 25, 2019
    • Jiong Wang's avatar
      selftests: bpf: enable hi32 randomization for all tests · 9d120b41
      Jiong Wang authored
      
      The previous libbpf patch allows user to specify "prog_flags" to bpf
      program load APIs. To enable high 32-bit randomization for a test, we need
      to set BPF_F_TEST_RND_HI32 in "prog_flags".
      
      To enable such randomization for all tests, we need to make sure all places
      are passing BPF_F_TEST_RND_HI32. Changing them one by one is not
      convenient, also, it would be better if a test could be switched to
      "normal" running mode without code change.
      
      Given the program load APIs used across bpf selftests are mostly:
        bpf_prog_load:      load from file
        bpf_load_program:   load from raw insns
      
      A test_stub.c is implemented for bpf seltests, it offers two functions for
      testing purpose:
      
        bpf_prog_test_load
        bpf_test_load_program
      
      The are the same as "bpf_prog_load" and "bpf_load_program", except they
      also set BPF_F_TEST_RND_HI32. Given *_xattr functions are the APIs to
      customize any "prog_flags", it makes little sense to put these two
      functions into libbpf.
      
      Then, the following CFLAGS are passed to compilations for host programs:
        -Dbpf_prog_load=bpf_prog_test_load
        -Dbpf_load_program=bpf_test_load_program
      
      They migrate the used load APIs to the test version, hence enable high
      32-bit randomization for these tests without changing source code.
      
      Besides all these, there are several testcases are using
      "bpf_prog_load_attr" directly, their call sites are updated to pass
      BPF_F_TEST_RND_HI32.
      
      Signed-off-by: default avatarJiong Wang <jiong.wang@netronome.com>
      Signed-off-by: default avatarAlexei Starovoitov <ast@kernel.org>
      9d120b41
  10. May 23, 2019
  11. May 09, 2019
  12. Apr 03, 2019
    • Alexei Starovoitov's avatar
      selftests/bpf: add few verifier scale tests · e5e7a8f2
      Alexei Starovoitov authored
      
      Add 3 basic tests that stress verifier scalability.
      
      test_verif_scale1.c calls non-inlined jhash() function 90 times on
      different position in the packet.
      This test simulates network packet parsing.
      jhash function is ~140 instructions and main program is ~1200 insns.
      
      test_verif_scale2.c force inlines jhash() function 90 times.
      This program is ~15k instructions long.
      
      test_verif_scale3.c calls non-inlined jhash() function 90 times on
      But this time jhash has to process 32-bytes from the packet
      instead of 14-bytes in tests 1 and 2.
      jhash function is ~230 insns and main program is ~1200 insns.
      
      $ test_progs -s
      can be used to see verifier stats.
      
      Signed-off-by: default avatarAlexei Starovoitov <ast@kernel.org>
      Signed-off-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
      e5e7a8f2
Loading