]> git.baikalelectronics.ru Git - kernel.git/commit
kunit: tool: fix display of make errors
authorDaniel Latypov <dlatypov@google.com>
Wed, 30 Sep 2020 18:31:51 +0000 (11:31 -0700)
committerShuah Khan <skhan@linuxfoundation.org>
Fri, 9 Oct 2020 20:04:09 +0000 (14:04 -0600)
commit4e055467391ea63d4c3767d3ef134139ed7f8ed3
treebd924bc6b2064dd28126c25e1142876a9e8301da
parent7cd4d316cbe6fc49833f166d12ea396f6afea5a0
kunit: tool: fix display of make errors

CalledProcessError stores the output of the failed process as `bytes`,
not a `str`.

So when we log it on build error, the make output is all crammed into
one line with "\n" instead of actually printing new lines.

After this change, we get readable output with new lines, e.g.
>   CC      lib/kunit/kunit-example-test.o
> In file included from ../lib/kunit/test.c:9:
> ../include/kunit/test.h:22:1: error: unknown type name ‘invalid_type_that_causes_compile’
>    22 | invalid_type_that_causes_compile errors;
>       | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> make[3]: *** [../scripts/Makefile.build:283: lib/kunit/test.o] Error 1

Secondly, trying to concat exceptions to strings will fail with
> TypeError: can only concatenate str (not "OSError") to str
so fix this with an explicit cast to str.

Signed-off-by: Daniel Latypov <dlatypov@google.com>
Reviewed-by: Brendan Higgins <brendanhiggins@google.com>
Tested-by: Brendan Higgins <brendanhiggins@google.com>
Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
tools/testing/kunit/kunit_kernel.py