1. 31 Jul, 2019 2 commits
  2. 29 Jul, 2019 7 commits
  3. 28 Jul, 2019 10 commits
    • Alexei Starovoitov's avatar
      Merge branch 'revamp-test_progs' · 475e31f8
      Alexei Starovoitov authored
      Andrii Nakryiko says:
      
      ====================
      This patch set makes a number of changes to test_progs selftest, which is
      a collection of many other tests (and sometimes sub-tests as well), to provide
      better testing experience and allow to start convering many individual test
      programs under selftests/bpf into a single and convenient test runner.
      
      Patch #1 fixes issue with Makefile, which makes prog_tests/test.h compiled as
      a C code. This fix allows to change how test.h is generated, providing ability
      to have more control on what and how tests are run.
      
      Patch #2 changes how test.h is auto-generated, which allows to have test
      definitions, instead of just running test functions. This gives ability to do
      more complicated test run policies.
      
      Patch #3 adds `-t <test-name>` and `-n <test-num>` selectors to run only
      subset of tests.
      
      Patch #4 changes libbpf_set_print() to return previously set print callback,
      allowing to temporarily replace current print callback and then set it back.
      This is necessary for some tests that want more control over libbpf logging.
      
      Patch #5 sets up and takes over libbpf logging from individual tests to
      test_prog runner, adding -vv verbosity to capture debug output from libbpf.
      This is useful when debugging failing tests.
      
      Patch #6 furthers test output management and buffers it by default, emitting
      log output only if test fails. This give succinct and clean default test
      output. It's possible to bypass this behavior with -v flag, which will turn
      off test output buffering.
      
      Patch #7 adds support for sub-tests. It also enhances -t and -n selectors to
      both support ability to specify sub-test selectors, as well as enhancing
      number selector to accept sets of test, instead of just individual test
      number.
      
      Patch #8 converts bpf_verif_scale.c test to use sub-test APIs.
      
      Patch #9 converts send_signal.c tests to use sub-test APIs.
      
      v2->v3:
        - fix buffered output rare unitialized value bug (Alexei);
        - fix buffered output va_list reuse bug (Alexei);
        - fix buffered output truncation due to interleaving zero terminators;
      
      v1->v2:
        - drop libbpf_swap_print, instead return previous function from
          libbpf_set_print (Stanislav);
      ====================
      Signed-off-by: default avatarAlexei Starovoitov <ast@kernel.org>
      475e31f8
    • Andrii Nakryiko's avatar
      selftests/bpf: convert send_signal.c to use subtests · b207edfe
      Andrii Nakryiko authored
      Convert send_signal set of tests to be exposed as three sub-tests.
      Signed-off-by: default avatarAndrii Nakryiko <andriin@fb.com>
      Signed-off-by: default avatarAlexei Starovoitov <ast@kernel.org>
      b207edfe
    • 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: add sub-tests support for test_progs · 3a516a0a
      Andrii Nakryiko authored
      Allow tests to have their own set of sub-tests. Also add ability to do
      test/subtest selection using `-t <test-name>/<subtest-name>` and `-n
      <test-nums-set>/<subtest-nums-set>`, as an extension of existing -t/-n
      selector options. For the <test-num-set> format: it's a comma-separated
      list of either individual test numbers (1-based), or range of test
      numbers. E.g., all of the following are valid sets of test numbers:
        - 10
        - 1,2,3
        - 1-3
        - 5-10,1,3-4
      
      '/<subtest' part is optional, but has the same format. E.g., to select
      test #3 and its sub-tests #10 through #15, use: -t 3/10-15.
      
      Similarly, to select tests by name, use `-t verif/strobe`:
      
        $ sudo ./test_progs -t verif/strobe
        #3/12 strobemeta.o:OK
        #3/13 strobemeta_nounroll1.o:OK
        #3/14 strobemeta_nounroll2.o:OK
        #3 bpf_verif_scale:OK
        Summary: 1/3 PASSED, 0 FAILED
      
      Example of using subtest API is in the next patch, converting
      bpf_verif_scale.c tests to use sub-tests.
      Signed-off-by: default avatarAndrii Nakryiko <andriin@fb.com>
      Signed-off-by: default avatarAlexei Starovoitov <ast@kernel.org>
      3a516a0a
    • 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
    • Andrii Nakryiko's avatar
      libbpf: return previous print callback from libbpf_set_print · e87fd8ba
      Andrii Nakryiko authored
      By returning previously set print callback from libbpf_set_print, it's
      possible to restore it, eventually. This is useful when running many
      independent test with one default print function, but overriding log
      verbosity for particular subset of tests.
      Signed-off-by: default avatarAndrii Nakryiko <andriin@fb.com>
      Signed-off-by: default avatarAlexei Starovoitov <ast@kernel.org>
      e87fd8ba
    • Andrii Nakryiko's avatar
      selftests/bpf: add test selectors by number and name to test_progs · 8160bae2
      Andrii Nakryiko authored
      Add ability to specify either test number or test name substring to
      narrow down a set of test to run.
      
      Usage:
      sudo ./test_progs -n 1
      sudo ./test_progs -t attach_probe
      Signed-off-by: default avatarAndrii Nakryiko <andriin@fb.com>
      Signed-off-by: default avatarAlexei Starovoitov <ast@kernel.org>
      8160bae2
    • Andrii Nakryiko's avatar
      selftests/bpf: revamp test_progs to allow more control · 766f2a59
      Andrii Nakryiko authored
      Refactor test_progs to allow better control on what's being run.
      Also use argp to do argument parsing, so that it's easier to keep adding
      more options.
      Signed-off-by: default avatarAndrii Nakryiko <andriin@fb.com>
      Signed-off-by: default avatarAlexei Starovoitov <ast@kernel.org>
      766f2a59
    • Andrii Nakryiko's avatar
      selftests/bpf: prevent headers to be compiled as C code · 61098e89
      Andrii Nakryiko authored
      Apprently listing header as a normal dependency for a binary output
      makes it go through compilation as if it was C code. This currently
      works without a problem, but in subsequent commits causes problems for
      differently generated test.h for test_progs. Marking those headers as
      order-only dependency solves the issue.
      Signed-off-by: default avatarAndrii Nakryiko <andriin@fb.com>
      Signed-off-by: default avatarAlexei Starovoitov <ast@kernel.org>
      61098e89
  4. 26 Jul, 2019 10 commits
  5. 23 Jul, 2019 11 commits