• Daniel Latypov's avatar
    kunit: add 'kunit.action' param to allow listing out tests · 9c6b0e1d
    Daniel Latypov authored
    Context:
    It's difficult to map a given .kunitconfig => set of enabled tests.
    Letting kunit.py figure that out would be useful.
    
    This patch:
    * is intended to be an implementation detail used only by kunit.py
    * adds a kunit.action module param with one valid non-null value, "list"
    * for the "list" action, it simply prints out "<suite>.<test>"
    * leaves the kunit.py changes to make use of this for another patch.
    
    Note: kunit.filter_glob is respected for this and all future actions.
    
    Hack: we print a TAP header (but no test plan) to allow kunit.py to
    use the same code to pick up KUnit output that it does for normal tests.
    Since this is intended to be an implementation detail, it seems fine for
    now. Maybe in the future we output each test as SKIPPED or the like.
    
    Go with a more generic "action" param, since it seems like we might
    eventually have more modes besides just running or listing tests, e.g.
    * perhaps a benchmark mode that reruns test cases and reports timing
    * perhaps a deflake mode that reruns test cases that failed
    * perhaps a mode where we randomize test order to try and catch
      hermeticity bugs like "test a only passes if run after test b"
    
    Tested:
    $ ./tools/testing/kunit/kunit.py run --kernel_arg=kunit.action=list --raw_output=kunit
    ...
    TAP version 14
    1..1
    example.example_simple_test
    example.example_skip_test
    example.example_mark_skipped_test
    reboot: System halted
    Signed-off-by: default avatarDaniel Latypov <dlatypov@google.com>
    Reviewed-by: default avatarDavid Gow <davidgow@google.com>
    Reviewed-by: default avatarBrendan Higgins <brendanhiggins@google.com>
    Signed-off-by: default avatarShuah Khan <skhan@linuxfoundation.org>
    9c6b0e1d
executor.c 6.71 KB