linux-kselftest.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] kunit: Fix kunit.py parse subcommand (use null build_dir)
@ 2020-10-21  7:16 David Gow
  2020-10-30 21:29 ` Brendan Higgins
  0 siblings, 1 reply; 2+ messages in thread
From: David Gow @ 2020-10-21  7:16 UTC (permalink / raw)
  To: Brendan Higgins, Heidi Fahim, Shuah Khan
  Cc: David Gow, kunit-dev, linux-kselftest, linux-kernel

When JSON support was added in [1], the KunitParseRequest tuple was
updated to contain a 'build_dir' field, but kunit.py parse doesn't
accept --build_dir as an option. The code nevertheless tried to access
it, resulting in this error:

AttributeError: 'Namespace' object has no attribute 'build_dir'

Given that the parser only uses the build_dir variable to set the
'build_environment' json field, we set it to None (which gives the JSON
'null') for now. Ultimately, we probably do want to be able to set this,
but since it's new functionality which (for the parse subcommand) never
worked, this is the quickest way of getting it back up and running.

[1]: https://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest.git/commit/?h=kunit-fixes&id=21a6d1780d5bbfca0ce9b8104ca6233502fcbf86

Fixes: 21a6d1780d5bbfca0ce9b8104ca6233502fcbf86 ("kunit: tool: allow generating test results in JSON")
Signed-off-by: David Gow <davidgow@google.com>
---

This is a quick fix because kunit.py parse is completely broken: it
appears it was introduced in the rebase of the JSON parser after the
separation of concerns patch.

 tools/testing/kunit/kunit.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/testing/kunit/kunit.py b/tools/testing/kunit/kunit.py
index ebf5f5763dee..a6d5f219f714 100755
--- a/tools/testing/kunit/kunit.py
+++ b/tools/testing/kunit/kunit.py
@@ -337,7 +337,7 @@ def main(argv, linux=None):
 				kunit_output = f.read().splitlines()
 		request = KunitParseRequest(cli_args.raw_output,
 					    kunit_output,
-					    cli_args.build_dir,
+					    None,
 					    cli_args.json)
 		result = parse_tests(request)
 		if result.status != KunitStatus.SUCCESS:

base-commit: c4d6fe7311762f2e03b3c27ad38df7c40c80cc93
-- 
2.29.0.rc1.297.gfa9743e501-goog


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

* Re: [PATCH] kunit: Fix kunit.py parse subcommand (use null build_dir)
  2020-10-21  7:16 [PATCH] kunit: Fix kunit.py parse subcommand (use null build_dir) David Gow
@ 2020-10-30 21:29 ` Brendan Higgins
  0 siblings, 0 replies; 2+ messages in thread
From: Brendan Higgins @ 2020-10-30 21:29 UTC (permalink / raw)
  To: David Gow
  Cc: Heidi Fahim, Shuah Khan, KUnit Development,
	open list:KERNEL SELFTEST FRAMEWORK, Linux Kernel Mailing List

On Wed, Oct 21, 2020 at 12:16 AM David Gow <davidgow@google.com> wrote:
>
> When JSON support was added in [1], the KunitParseRequest tuple was
> updated to contain a 'build_dir' field, but kunit.py parse doesn't
> accept --build_dir as an option. The code nevertheless tried to access
> it, resulting in this error:
>
> AttributeError: 'Namespace' object has no attribute 'build_dir'
>
> Given that the parser only uses the build_dir variable to set the
> 'build_environment' json field, we set it to None (which gives the JSON
> 'null') for now. Ultimately, we probably do want to be able to set this,
> but since it's new functionality which (for the parse subcommand) never
> worked, this is the quickest way of getting it back up and running.
>
> [1]: https://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest.git/commit/?h=kunit-fixes&id=21a6d1780d5bbfca0ce9b8104ca6233502fcbf86
>
> Fixes: 21a6d1780d5bbfca0ce9b8104ca6233502fcbf86 ("kunit: tool: allow generating test results in JSON")
> Signed-off-by: David Gow <davidgow@google.com>

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-10-30 21:30 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-21  7:16 [PATCH] kunit: Fix kunit.py parse subcommand (use null build_dir) David Gow
2020-10-30 21:29 ` 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).