• Rae Moar's avatar
    kunit: tool: Fix error messages for cases of no tests and wrong TAP header · ed01ad3a
    Rae Moar authored
    
    
    This patch addresses misleading error messages reported by kunit_tool in
    two cases. First, in the case of TAP output having an incorrect header
    format or missing a header, the parser used to output an error message of
    'no tests run!'. Now the parser outputs an error message of 'could not
    parse test results!'.
    
    As an example:
    
    Before:
    $ ./tools/testing/kunit/kunit.py parse /dev/null
    [ERROR] no tests run!
    ...
    
    After:
    $ ./tools/testing/kunit/kunit.py parse /dev/null
    [ERROR] could not parse test results!
    ...
    
    Second, in the case of TAP output with the correct header but no
    tests, the parser used to output an error message of 'could not parse
    test results!'. Now the parser outputs an error message of 'no tests
    run!'.
    
    As an example:
    
    Before:
    $ echo -e 'TAP version 14\n1..0' | ./tools/testing/kunit/kunit.py parse
    [ERROR] could not parse test results!
    
    After:
    $ echo -e 'TAP version 14\n1..0' | ./tools/testing/kunit/kunit.py parse
    [ERROR] no tests run!
    
    Additionally, this patch also corrects the tests in kunit_tool_test.py
    and adds a test to check the error in the case of TAP output with the
    correct header but no tests.
    Signed-off-by: default avatarRae Moar <rmoar@google.com>
    Reviewed-by: default avatarDavid Gow <davidgow@google.com>
    Reviewed-by: default avatarDaniel Latypov <dlatypov@google.com>
    Reviewed-by: default avatarBrendan Higgins <brendanhiggins@google.com>
    Signed-off-by: default avatarShuah Khan <skhan@linuxfoundation.org>
    ed01ad3a
test_is_test_passed-no_tests_run_no_header.log 3.83 KB