Skip to content
GitLab
Projects Groups Topics Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
  • Register
  • Sign in
  • L linux
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributor statistics
    • Graph
    • Compare revisions
  • Issues 0
    • Issues 0
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 0
    • Merge requests 0
  • Deployments
    • Deployments
    • Releases
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Commits
  • Issue Boards
Collapse sidebar
  • Kirill Smelkov
  • linux
  • Repository
  • linux
  • lib
  • kunit
  • executor_test.c
Find file BlameHistoryPermalink
  • Daniel Latypov's avatar
    kunit: bail out of test filtering logic quicker if OOM · a02353f4
    Daniel Latypov authored May 11, 2022
    When filtering what tests to run (suites and/or cases) via
    kunit.filter_glob (e.g. kunit.py run <glob>), we allocate copies of
    suites.
    
    These allocations can fail, and we largely don't handle that.
    Note: realistically, this probably doesn't matter much.
    We're not allocating much memory and this happens early in boot, so if
    we can't do that, then there's likely far bigger problems.
    
    This patch makes us immediately bail out from the top-level function
    (kunit_filter_suites) with -ENOMEM if any of the underlying kmalloc()
    calls return NULL.
    
    Implementation note: we used to return NULL pointers from some functions
    to indicate either that all suites/tests were filtered out or there was
    an error allocating the new array.
    
    We'll log a short error in this case and not run any tests or print a
    TAP header. From a kunit.py user's perspective, they'll get a message
    about missing/invalid TAP output and have to dig into the test.log to
    see it. Since hitting this error seems so unlikely, it's probably fine
    to not invent a way to plumb this error message more visibly.
    
    See also: https://lore.kernel.org/linux-kselftest/20220329103919.2376818-1-lv.ruyi@zte.com.cn/
    
    
    
    Signed-off-by: default avatarDaniel Latypov <dlatypov@google.com>
    Reported-by: default avatarZeal Robot <zealci@zte.com.cn>
    Reported-by: default avatarLv Ruyi <lv.ruyi@zte.com.cn>
    Reviewed-by: default avatarBrendan Higgins <brendanhiggins@google.com>
    Signed-off-by: default avatarShuah Khan <skhan@linuxfoundation.org>
    a02353f4
GitLab Nexedi Edition | About GitLab | About Nexedi | 沪ICP备2021021310号-2 | 沪ICP备2021021310号-7