Commit 82206a0c authored by Brendan Higgins's avatar Brendan Higgins Committed by Shuah Khan
Browse files

kunit: tool: handle when .kunit exists but .kunitconfig does not

Right now .kunitconfig and the build dir are automatically created if
the build dir does not exists; however, if the build dir is present and
.kunitconfig is not, kunit_tool will crash.

Fix this by checking for both the build dir as well as the .kunitconfig.

NOTE: This depends on commit 5578d008 ("kunit: tool: fix running
kunit_tool from outside kernel tree")

Link: https://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest.git/commit/?id=5578d008d9e06bb531fb3e62dd17096d9fd9c853


Signed-off-by: default avatarBrendan Higgins <brendanhiggins@google.com>
Signed-off-by: default avatarShuah Khan <skhan@linuxfoundation.org>
parent 67e2fae3
Loading
Loading
Loading
Loading
+8 −4
Original line number Diff line number Diff line
@@ -261,6 +261,8 @@ def main(argv, linux=None):
	if cli_args.subcommand == 'run':
		if not os.path.exists(cli_args.build_dir):
			os.mkdir(cli_args.build_dir)

		if not os.path.exists(kunit_kernel.kunitconfig_path):
			create_default_kunitconfig()

		if not linux:
@@ -277,9 +279,11 @@ def main(argv, linux=None):
		if result.status != KunitStatus.SUCCESS:
			sys.exit(1)
	elif cli_args.subcommand == 'config':
		if cli_args.build_dir:
			if not os.path.exists(cli_args.build_dir):
		if cli_args.build_dir and (
				not os.path.exists(cli_args.build_dir)):
			os.mkdir(cli_args.build_dir)

		if not os.path.exists(kunit_kernel.kunitconfig_path):
			create_default_kunitconfig()

		if not linux: