• Andrii Nakryiko's avatar
    selftests/bpf: Add whitelist/blacklist of test names to test_progs · b65053cd
    Andrii Nakryiko authored
    Add ability to specify a list of test name substrings for selecting which
    tests to run. So now -t is accepting a comma-separated list of strings,
    similarly to how -n accepts a comma-separated list of test numbers.
    
    Additionally, add ability to blacklist tests by name. Blacklist takes
    precedence over whitelist. Blacklisting is important for cases where it's
    known that some tests can't pass (e.g., due to perf hardware events that are
    not available within VM). This is going to be used for libbpf testing in
    Travis CI in its Github repo.
    
    Example runs with just whitelist and whitelist + blacklist:
    
      $ sudo ./test_progs -tattach,core/existence
      #1 attach_probe:OK
      #6 cgroup_attach_autodetach:OK
      #7 cgroup_attach_multi:OK
      #8 cgroup_attach_override:OK
      #9 core_extern:OK
      #10/44 existence:OK
      #10/45 existence___minimal:OK
      #10/46 existence__err_int_sz:OK
      #10/47 existence__err_int_type:OK
      #10/48 existence__err_int_kind:OK
      #10/49 existence__err_arr_kind:OK
      #10/50 existence__err_arr_value_type:OK
      #10/51 existence__err_struct_type:OK
      #10 core_reloc:OK
      #19 flow_dissector_reattach:OK
      #60 tp_attach_query:OK
      Summary: 8/8 PASSED, 0 SKIPPED, 0 FAILED
    
      $ sudo ./test_progs -tattach,core/existence -bcgroup,flow/arr
      #1 attach_probe:OK
      #9 core_extern:OK
      #10/44 existence:OK
      #10/45 existence___minimal:OK
      #10/46 existence__err_int_sz:OK
      #10/47 existence__err_int_type:OK
      #10/48 existence__err_int_kind:OK
      #10/51 existence__err_struct_type:OK
      #10 core_reloc:OK
      #60 tp_attach_query:OK
      Summary: 4/6 PASSED, 0 SKIPPED, 0 FAILED
    Signed-off-by: default avatarAndrii Nakryiko <andriin@fb.com>
    Signed-off-by: default avatarAlexei Starovoitov <ast@kernel.org>
    Cc: Julia Kartseva <hex@fb.com>
    Link: https://lore.kernel.org/bpf/20200116005549.3644118-1-andriin@fb.com
    b65053cd
test_progs.c 14 KB