Re: [PATCH v2 1/2] kunit: kunit_parser: make parser more robust

From: shuah
Date: Fri Mar 13 2020 - 16:22:14 EST


On 3/5/20 2:25 PM, Brendan Higgins wrote:
On Thu, Mar 5, 2020 at 12:04 PM Heidi Fahim <heidifahim@xxxxxxxxxx> wrote:

Previously, kunit_parser did not properly handle kunit TAP output that
- had any prefixes (generated from different configs e.g.
CONFIG_PRINTK_TIME)
- had unrelated kernel output mixed in the middle of
it, which has shown up when testing with allyesconfig
To remove prefixes, the parser looks for the first line that includes
TAP output, "TAP version 14". It then determines the length of the
string before this sequence, and strips that number of characters off
the beginning of the following lines until the last KUnit output line is
reached.
These fixes have been tested with additional tests in the
KUnitParseTest and their associated logs have also been added.

Signed-off-by: Heidi Fahim <heidifahim@xxxxxxxxxx>

Reviewed-by: Brendan Higgins <brendanhiggins@xxxxxxxxxx>


Heidi and Brendan,

git apply is throwing away formatting in

tools/testing/kunit/test_data/test_config_printk_time.log


Applying: kunit: kunit_parser: make parser more robust
.git/rebase-apply/patch:396: space before tab in indent.
# Subtest: kunit-resource-test
.git/rebase-apply/patch:397: space before tab in indent.
1..5
.git/rebase-apply/patch:398: space before tab in indent.
ok 1 - kunit_resource_test_init_resources
.git/rebase-apply/patch:399: space before tab in indent.
ok 2 - kunit_resource_test_alloc_resource
.git/rebase-apply/patch:400: space before tab in indent.
ok 3 - kunit_resource_test_destroy_resource
warning: squelched 11 whitespace errors
warning: 16 lines add whitespace errors.

Can you fix this and resend patches. If apply this as is,
all the formatting you have in there goes away.

This is what gets applied.

[ 0.060000] TAP version 14
[ 0.060000] # Subtest: kunit-resource-test
[ 0.060000] 1..5
[ 0.060000] ok 1 - kunit_resource_test_init_resources
[ 0.060000] ok 2 - kunit_resource_test_alloc_resource
[ 0.060000] ok 3 - kunit_resource_test_destroy_resource
[ 0.060000] ok 4 - kunit_resource_test_cleanup_resources
[ 0.060000] ok 5 - kunit_resource_test_proper_free_ordering
[ 0.060000] ok 1 - kunit-resource-test
[ 0.060000] # Subtest: kunit-try-catch-test
[ 0.060000] 1..2
[ 0.060000] ok 1 - kunit_test_try_catch_successful_try_no_catch
[ 0.060000] ok 2 - kunit_test_try_catch_unsuccessful_try_does_catch
[ 0.060000] ok 2 - kunit-try-catch-test
[ 0.060000] # Subtest: string-stream-test
[ 0.060000] 1..3
[ 0.060000] ok 1 - string_stream_test_empty_on_creation
[ 0.060000] ok 2 - string_stream_test_not_empty_after_add
[ 0.060000] ok 3 - string_stream_test_get_string
[ 0.060000] ok 3 - string-stream-test
[ 0.060000] List of all partitions:
[ 0.060000] No filesystem could mount root, tried:

thanks,
-- Shuah