linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v1 1/2] kunit: tool: fix running kunit_tool from outside kernel tree
@ 2020-08-08  1:16 Brendan Higgins
  2020-08-08  1:16 ` [PATCH v1 2/2] kunit: tool: allow generating test results in JSON Brendan Higgins
  2020-08-08  5:45 ` [PATCH v1 1/2] kunit: tool: fix running kunit_tool from outside kernel tree David Gow
  0 siblings, 2 replies; 7+ messages in thread
From: Brendan Higgins @ 2020-08-08  1:16 UTC (permalink / raw)
  To: shuah, davidgow; +Cc: linux-kselftest, kunit-dev, linux-kernel, Brendan Higgins

Currently kunit_tool does not work correctly when executed from a path
outside of the kernel tree, so make sure that the current working
directory is correct and the kunit_dir is properly initialized before
running.

Signed-off-by: Brendan Higgins <brendanhiggins@google.com>
---
 tools/testing/kunit/kunit.py | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/tools/testing/kunit/kunit.py b/tools/testing/kunit/kunit.py
index 425ef40067e7..96344a11ff1f 100755
--- a/tools/testing/kunit/kunit.py
+++ b/tools/testing/kunit/kunit.py
@@ -237,9 +237,14 @@ def main(argv, linux=None):
 
 	cli_args = parser.parse_args(argv)
 
+	if get_kernel_root_path():
+		print('cd ' + get_kernel_root_path())
+		os.chdir(get_kernel_root_path())
+
 	if cli_args.subcommand == 'run':
 		if not os.path.exists(cli_args.build_dir):
 			os.mkdir(cli_args.build_dir)
+			create_default_kunitconfig()
 
 		if not linux:
 			linux = kunit_kernel.LinuxSourceTree()
@@ -257,6 +262,7 @@ def main(argv, linux=None):
 		if cli_args.build_dir:
 			if not os.path.exists(cli_args.build_dir):
 				os.mkdir(cli_args.build_dir)
+				create_default_kunitconfig()
 
 		if not linux:
 			linux = kunit_kernel.LinuxSourceTree()
@@ -273,6 +279,7 @@ def main(argv, linux=None):
 		if cli_args.build_dir:
 			if not os.path.exists(cli_args.build_dir):
 				os.mkdir(cli_args.build_dir)
+				create_default_kunitconfig()
 
 		if not linux:
 			linux = kunit_kernel.LinuxSourceTree()
@@ -291,6 +298,7 @@ def main(argv, linux=None):
 		if cli_args.build_dir:
 			if not os.path.exists(cli_args.build_dir):
 				os.mkdir(cli_args.build_dir)
+				create_default_kunitconfig()
 
 		if not linux:
 			linux = kunit_kernel.LinuxSourceTree()

base-commit: 30185b69a2d533c4ba6ca926b8390ce7de495e29
-- 
2.28.0.236.gb10cc79966-goog


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

end of thread, other threads:[~2020-08-11 20:00 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-08  1:16 [PATCH v1 1/2] kunit: tool: fix running kunit_tool from outside kernel tree Brendan Higgins
2020-08-08  1:16 ` [PATCH v1 2/2] kunit: tool: allow generating test results in JSON Brendan Higgins
2020-08-11 19:56   ` Bird, Tim
2020-08-11 20:00     ` Brendan Higgins
2020-08-08  5:45 ` [PATCH v1 1/2] kunit: tool: fix running kunit_tool from outside kernel tree David Gow
2020-08-08  8:50   ` Brendan Higgins
2020-08-11  4:29     ` David Gow

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).