linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] kunit: kunit_tool: Fix invalid result when build fails
@ 2020-06-16  6:47 David Gow
  2020-06-18 19:59 ` Brendan Higgins
  0 siblings, 1 reply; 2+ messages in thread
From: David Gow @ 2020-06-16  6:47 UTC (permalink / raw)
  To: Brendan Higgins, Shuah Khan
  Cc: linux-kselftest, kunit-dev, linux-kernel, David Gow

When separating out different phases of running tests[1]
(build/exec/parse/etc), the format of the KunitResult tuple changed
(adding an elapsed_time variable). This is not populated during a build
failure, causing kunit.py to crash.

This fixes [1] to probably populate the result variable, causing a
failing build to be reported properly.

[1]:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=45ba7a893ad89114e773b3dc32f6431354c465d6

Signed-off-by: David Gow <davidgow@google.com>
---
 tools/testing/kunit/kunit.py | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/tools/testing/kunit/kunit.py b/tools/testing/kunit/kunit.py
index 787b6d4ad716..f9b769f3437d 100755
--- a/tools/testing/kunit/kunit.py
+++ b/tools/testing/kunit/kunit.py
@@ -82,7 +82,9 @@ def build_tests(linux: kunit_kernel.LinuxSourceTree,
 					request.make_options)
 	build_end = time.time()
 	if not success:
-		return KunitResult(KunitStatus.BUILD_FAILURE, 'could not build kernel')
+		return KunitResult(KunitStatus.BUILD_FAILURE,
+				   'could not build kernel',
+				   build_end - build_start)
 	if not success:
 		return KunitResult(KunitStatus.BUILD_FAILURE,
 				   'could not build kernel',
-- 
2.27.0.290.gba653c62da-goog


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] kunit: kunit_tool: Fix invalid result when build fails
  2020-06-16  6:47 [PATCH] kunit: kunit_tool: Fix invalid result when build fails David Gow
@ 2020-06-18 19:59 ` Brendan Higgins
  0 siblings, 0 replies; 2+ messages in thread
From: Brendan Higgins @ 2020-06-18 19:59 UTC (permalink / raw)
  To: David Gow
  Cc: Shuah Khan, open list:KERNEL SELFTEST FRAMEWORK,
	KUnit Development, Linux Kernel Mailing List

On Mon, Jun 15, 2020 at 11:47 PM David Gow <davidgow@google.com> wrote:
>
> When separating out different phases of running tests[1]
> (build/exec/parse/etc), the format of the KunitResult tuple changed
> (adding an elapsed_time variable). This is not populated during a build
> failure, causing kunit.py to crash.
>
> This fixes [1] to probably populate the result variable, causing a
> failing build to be reported properly.
>
> [1]:
> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=45ba7a893ad89114e773b3dc32f6431354c465d6
>
> Signed-off-by: David Gow <davidgow@google.com>

Oh wow! This is an old issue.

Nice work!

Reviewed-by: Brendan Higgins <brendanhiggins@google.com>
Tested-by: Brendan Higgins <brendanhiggins@google.com>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-06-18 19:59 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-16  6:47 [PATCH] kunit: kunit_tool: Fix invalid result when build fails David Gow
2020-06-18 19:59 ` Brendan Higgins

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).