• 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
test_progs.h 3.08 KB