lkml.org 
[lkml]   [2020]   [Aug]   [31]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH v2 1/2] kunit: tool: fix running kunit_tool from outside kernel tree
From
Date
On 8/11/20 3:27 PM, Brendan Higgins wrote:
> 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 | 13 +++++--------
> 1 file changed, 5 insertions(+), 8 deletions(-)
>
> diff --git a/tools/testing/kunit/kunit.py b/tools/testing/kunit/kunit.py
> index 425ef40067e7e..e2caf4e24ecb2 100755
> --- a/tools/testing/kunit/kunit.py
> +++ b/tools/testing/kunit/kunit.py
> @@ -237,9 +237,13 @@ def main(argv, linux=None):
>
> cli_args = parser.parse_args(argv)
>
> + if 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 +261,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()
> @@ -270,10 +275,6 @@ def main(argv, linux=None):
> if result.status != KunitStatus.SUCCESS:
> sys.exit(1)
> elif cli_args.subcommand == 'build':
> - if cli_args.build_dir:
> - if not os.path.exists(cli_args.build_dir):
> - os.mkdir(cli_args.build_dir)
> -
> if not linux:
> linux = kunit_kernel.LinuxSourceTree()
>
> @@ -288,10 +289,6 @@ def main(argv, linux=None):
> if result.status != KunitStatus.SUCCESS:
> sys.exit(1)
> elif cli_args.subcommand == 'exec':
> - if cli_args.build_dir:
> - if not os.path.exists(cli_args.build_dir):
> - os.mkdir(cli_args.build_dir)
> -
> if not linux:
> linux = kunit_kernel.LinuxSourceTree()
>
>
> base-commit: 30185b69a2d533c4ba6ca926b8390ce7de495e29
>


Applied the two patches in this seeries to linux-kselftest kunit-fixes
for the next 5.9-rc fixes

thanks,
-- Shuah

\
 
 \ /
  Last update: 2020-08-31 23:43    [W:0.038 / U:2.612 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site