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
  • tools
  • testing
  • kunit
  • kunit_kernel.py
Find file BlameHistoryPermalink
  • Daniel Latypov's avatar
    kunit: tool: continue past invalid utf-8 output · 2ab5d5e6
    Daniel Latypov authored Oct 20, 2021
    kunit.py currently crashes and fails to parse kernel output if it's not
    fully valid utf-8.
    
    This can come from memory corruption or just inadvertently printing
    out binary data as strings.
    
    E.g. adding this line into a kunit test
      pr_info("\x80")
    will cause this exception
      UnicodeDecodeError: 'utf-8' codec can't decode byte 0x80 in position
      1961: invalid start byte
    
    We can tell Python how to handle errors, see
    https://docs.python.org/3/library/codecs.html#error-handlers
    
    
    
    Unfortunately, it doesn't seem like there's a way to specify this in
    just one location, so we need to repeat ourselves quite a bit.
    
    Specify `errors='backslashreplace'` so we instead:
    * print out the offending byte as '\x80'
    * try and continue parsing the output.
      * as long as the TAP lines themselves are valid, we're fine.
    
    Fixed spelling/grammar in commit log:
    Shuah Khan <<skhan@linuxfoundation.org>
    
    Signed-off-by: default avatarDaniel Latypov <dlatypov@google.com>
    Reviewed-by: default avatarBrendan Higgins <brendanhiggins@google.com>
    Tested-by: default avatarDavid Gow <davidgow@google.com>
    Signed-off-by: default avatarShuah Khan <skhan@linuxfoundation.org>
    2ab5d5e6
GitLab Nexedi Edition | About GitLab | About Nexedi | 沪ICP备2021021310号-2 | 沪ICP备2021021310号-7