• John Fastabend's avatar
    bpf: Selftests, break down test_sockmap into subtests · 328aa08a
    John Fastabend authored
    At the moment test_sockmap runs all 800+ tests ungrouped which is not
    ideal because it makes it hard to see what is failing but also more
    importantly its hard to confirm all cases are tested. Additionally,
    after inspecting we noticed the runtime is bloated because we run
    many duplicate tests. Worse some of these tests are known error cases
    that wait for the recvmsg handler to timeout which creats long delays.
    Also we noted some tests were not clearing their options and as a
    result the following tests would run with extra and incorrect options.
    
    Fix this by reorganizing test code so its clear what tests are running
    and when. Then it becomes easy to remove duplication and run tests with
    only the set of send/recv patterns that are relavent.
    
    To accomplish this break test_sockmap into subtests and remove
    unnecessary duplication. The output is more readable now and
    the runtime reduced.
    
    Now default output prints subtests like this,
    
     $ ./test_sockmap
     # 1/ 6  sockmap:txmsg test passthrough:OK
     ...
     #22/ 1 sockhash:txmsg test push/pop data:OK
     Pass: 22 Fail: 0
    Signed-off-by: default avatarJohn Fastabend <john.fastabend@gmail.com>
    Signed-off-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
    Reviewed-by: default avatarJakub Sitnicki <jakub@cloudflare.com>
    Link: https://lore.kernel.org/bpf/158939728384.15176.13601520183665880762.stgit@john-Precision-5820-Tower
    328aa08a
test_sockmap.c 38.8 KB