1. 19 Oct, 2021 2 commits
    • Daniel Latypov's avatar
      kunit: tool: allow filtering test cases via glob · a127b154
      Daniel Latypov authored
      Commit 1d71307a ("kunit: add unit test for filtering suites by
      names") introduced the ability to filter which suites we run via glob.
      
      This change extends it so we can also filter individual test cases
      inside of suites as well.
      
      This is quite useful when, e.g.
      * trying to run just the tests cases you've just added or are working on
      * trying to debug issues with test hermeticity
      
      Examples:
      $ ./tools/testing/kunit/kunit.py run --kunitconfig=lib/kunit '*exec*.parse*'
      ...
      ============================================================
      ======== [PASSED] kunit_executor_test ========
      [PASSED] parse_filter_test
      ============================================================
      Testing complete. 1 tests run. 0 failed. 0 crashed.
      
      $ ./tools/testing/kunit/kunit.py run --kunitconfig=lib/kunit '*.no_matching_tests'
      ...
      [ERROR] no tests run!
      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>
      a127b154
    • Daniel Latypov's avatar
      kunit: drop assumption in kunit-log-test about current suite · b7cbaef3
      Daniel Latypov authored
      This test assumes that the declared kunit_suite object is the exact one
      which is being executed, which KUnit will not guarantee [1].
      
      Specifically, `suite->log` is not initialized until a suite object is
      executed. So if KUnit makes a copy of the suite and runs that instead,
      this test dereferences an invalid pointer and (hopefully) segfaults.
      
      N.B. since we no longer assume this, we can no longer verify that
      `suite->log` is *not* allocated during normal execution.
      
      An alternative to this patch that would allow us to test that would
      require exposing an API for the current test to get its current suite.
      Exposing that for one internal kunit test seems like overkill, and
      grants users more footguns (e.g. reusing a test case in multiple suites
      and changing behavior based on the suite name, dynamically modifying the
      setup/cleanup funcs, storing/reading stuff out of the suite->log, etc.).
      
      [1] In a subsequent patch, KUnit will allow running subsets of test
      cases within a suite by making a copy of the suite w/ the filtered test
      list. But there are other reasons KUnit might execute a copy, e.g. if it
      ever wants to support parallel execution of different suites, recovering
      from errors and restarting suites
      Signed-off-by: default avatarDaniel Latypov <dlatypov@google.com>
      Reviewed-by: default avatarBrendan Higgins <brendanhiggins@google.com>
      Signed-off-by: default avatarShuah Khan <skhan@linuxfoundation.org>
      b7cbaef3
  2. 18 Oct, 2021 17 commits
  3. 17 Oct, 2021 3 commits
  4. 16 Oct, 2021 18 commits