[PATCH 1/2] kunit: tool: Fix LinuxSourceTree's missed handling of 'build_dir'

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: SeongJae Park <sjpark@xxxxxxxxx>

Because commit d43c7fb05765 ("kunit: tool: fix improper treatment of
file location") removed 'kunit_kernel.kunitconfig_path' modification for
the '--builddir' argument, running kunit with '--build_dir' now fails
with below error message:

    Traceback (most recent call last):
      File "./tools/testing/kunit/kunit.py", line 325, in <module>
        main(sys.argv[1:])
      File "./tools/testing/kunit/kunit.py", line 245, in main
        linux = kunit_kernel.LinuxSourceTree()
      File "/home/sjpark/linux/tools/testing/kunit/kunit_kernel.py", line 109, in __init__
        self._kconfig.read_from_file(kunitconfig_path)
      File "/home/sjpark/linux/tools/testing/kunit/kunit_config.py", line 88, in read_from_file
        with open(path, 'r') as f:
    FileNotFoundError: [Errno 2] No such file or directory: '.kunitconfig'

As simply reverting the change now make the 'kunit_tool_test' fails
again, this commit fixes the problem by passing the 'build_dir' argument
to 'LinuxSourceTree' constructor.

Fixes: d43c7fb05765 ("kunit: tool: fix improper treatment of file location")
Signed-off-by: SeongJae Park <sjpark@xxxxxxxxx>
---
 tools/testing/kunit/kunit.py        | 8 ++++----
 tools/testing/kunit/kunit_kernel.py | 4 ++--
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/tools/testing/kunit/kunit.py b/tools/testing/kunit/kunit.py
index 425ef40067e7..611c23e178f8 100755
--- a/tools/testing/kunit/kunit.py
+++ b/tools/testing/kunit/kunit.py
@@ -242,7 +242,7 @@ def main(argv, linux=None):
 			os.mkdir(cli_args.build_dir)
 
 		if not linux:
-			linux = kunit_kernel.LinuxSourceTree()
+			linux = kunit_kernel.LinuxSourceTree(cli_args.build_dir)
 
 		request = KunitRequest(cli_args.raw_output,
 				       cli_args.timeout,
@@ -259,7 +259,7 @@ def main(argv, linux=None):
 				os.mkdir(cli_args.build_dir)
 
 		if not linux:
-			linux = kunit_kernel.LinuxSourceTree()
+			linux = kunit_kernel.LinuxSourceTree(cli_args.build_dir)
 
 		request = KunitConfigRequest(cli_args.build_dir,
 					     cli_args.make_options)
@@ -275,7 +275,7 @@ def main(argv, linux=None):
 				os.mkdir(cli_args.build_dir)
 
 		if not linux:
-			linux = kunit_kernel.LinuxSourceTree()
+			linux = kunit_kernel.LinuxSourceTree(cli_args.build_dir)
 
 		request = KunitBuildRequest(cli_args.jobs,
 					    cli_args.build_dir,
@@ -293,7 +293,7 @@ def main(argv, linux=None):
 				os.mkdir(cli_args.build_dir)
 
 		if not linux:
-			linux = kunit_kernel.LinuxSourceTree()
+			linux = kunit_kernel.LinuxSourceTree(cli_args.build_dir)
 
 		exec_request = KunitExecRequest(cli_args.timeout,
 						cli_args.build_dir,
diff --git a/tools/testing/kunit/kunit_kernel.py b/tools/testing/kunit/kunit_kernel.py
index e20e2056cb38..16a997504317 100644
--- a/tools/testing/kunit/kunit_kernel.py
+++ b/tools/testing/kunit/kunit_kernel.py
@@ -104,9 +104,9 @@ def get_kconfig_path(build_dir):
 class LinuxSourceTree(object):
 	"""Represents a Linux kernel source tree with KUnit tests."""
 
-	def __init__(self):
+	def __init__(self, build_dir):
 		self._kconfig = kunit_config.Kconfig()
-		self._kconfig.read_from_file(kunitconfig_path)
+		self._kconfig.read_from_file(os.path.join(build_dir, kunitconfig_path))
 		self._ops = LinuxSourceTreeOperations()
 		signal.signal(signal.SIGINT, self.signal_handler)
 
-- 
2.17.1




[Index of Archives]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]

  Powered by Linux