diff mbox series

[4/6] kunit: Create default config in 'build_dir'

Message ID 1575242724-4937-5-git-send-email-sj38.park@gmail.com (mailing list archive)
State New
Headers show
Series Fix nits in the kunit | expand

Commit Message

SeongJae Park Dec. 1, 2019, 11:25 p.m. UTC
From: SeongJae Park <sjpark@amazon.de>

If both '--build_dir' and '--defconfig' are given, the handling of
'--defconfig' ignores '--build_dir' option.  This commit modifies the
behavior to respect '--build_dir' option.

Signed-off-by: SeongJae Park <sjpark@amazon.de>
---
 tools/testing/kunit/kunit.py | 5 +++++
 1 file changed, 5 insertions(+)

Comments

Brendan Higgins Dec. 3, 2019, 6:40 a.m. UTC | #1
On Sun, Dec 1, 2019 at 3:25 PM SeongJae Park <sj38.park@gmail.com> wrote:
>
> From: SeongJae Park <sjpark@amazon.de>
>
> If both '--build_dir' and '--defconfig' are given, the handling of
> '--defconfig' ignores '--build_dir' option.  This commit modifies the
> behavior to respect '--build_dir' option.
>
> Signed-off-by: SeongJae Park <sjpark@amazon.de>
> ---
>  tools/testing/kunit/kunit.py | 5 +++++
>  1 file changed, 5 insertions(+)
>
> diff --git a/tools/testing/kunit/kunit.py b/tools/testing/kunit/kunit.py
> index f8f2695..1746330 100755
> --- a/tools/testing/kunit/kunit.py
> +++ b/tools/testing/kunit/kunit.py
> @@ -114,6 +114,11 @@ def main(argv, linux=None):
>         cli_args = parser.parse_args(argv)
>
>         if cli_args.subcommand == 'run':
> +               if cli_args.build_dir:
> +                       kunit_kernel.KUNITCONFIG_PATH = os.path.join(

If you are going to modify the value of KUNITCONFIG_PATH can you
rename the variable to make it lower_snake_case? UPPER_SNAKE_CASE in
Python is usually (at least in this directory) used to indicate the
variable is a constant.

> +                               cli_args.build_dir,
> +                               kunit_kernel.KUNITCONFIG_PATH)
> +
>                 if cli_args.defconfig:
>                         create_default_kunitconfig()
>
> --
> 2.7.4
>
SeongJae Park Dec. 3, 2019, 8:28 a.m. UTC | #2
On Tue, Dec 3, 2019 at 7:41 AM Brendan Higgins
<brendanhiggins@google.com> wrote:
>
> On Sun, Dec 1, 2019 at 3:25 PM SeongJae Park <sj38.park@gmail.com> wrote:
> >
> > From: SeongJae Park <sjpark@amazon.de>
> >
> > If both '--build_dir' and '--defconfig' are given, the handling of
> > '--defconfig' ignores '--build_dir' option.  This commit modifies the
> > behavior to respect '--build_dir' option.
> >
> > Signed-off-by: SeongJae Park <sjpark@amazon.de>
> > ---
> >  tools/testing/kunit/kunit.py | 5 +++++
> >  1 file changed, 5 insertions(+)
> >
> > diff --git a/tools/testing/kunit/kunit.py b/tools/testing/kunit/kunit.py
> > index f8f2695..1746330 100755
> > --- a/tools/testing/kunit/kunit.py
> > +++ b/tools/testing/kunit/kunit.py
> > @@ -114,6 +114,11 @@ def main(argv, linux=None):
> >         cli_args = parser.parse_args(argv)
> >
> >         if cli_args.subcommand == 'run':
> > +               if cli_args.build_dir:
> > +                       kunit_kernel.KUNITCONFIG_PATH = os.path.join(
>
> If you are going to modify the value of KUNITCONFIG_PATH can you
> rename the variable to make it lower_snake_case? UPPER_SNAKE_CASE in
> Python is usually (at least in this directory) used to indicate the
> variable is a constant.

Changed as you suggested in the second version patchset[1].

[1] https://lore.kernel.org/linux-doc/1575361141-6806-1-git-send-email-sj38.park@gmail.com/


Thanks,
SeongJae Park

>
> > +                               cli_args.build_dir,
> > +                               kunit_kernel.KUNITCONFIG_PATH)
> > +
> >                 if cli_args.defconfig:
> >                         create_default_kunitconfig()
> >
> > --
> > 2.7.4
> >
diff mbox series

Patch

diff --git a/tools/testing/kunit/kunit.py b/tools/testing/kunit/kunit.py
index f8f2695..1746330 100755
--- a/tools/testing/kunit/kunit.py
+++ b/tools/testing/kunit/kunit.py
@@ -114,6 +114,11 @@  def main(argv, linux=None):
 	cli_args = parser.parse_args(argv)
 
 	if cli_args.subcommand == 'run':
+		if cli_args.build_dir:
+			kunit_kernel.KUNITCONFIG_PATH = os.path.join(
+				cli_args.build_dir,
+				kunit_kernel.KUNITCONFIG_PATH)
+
 		if cli_args.defconfig:
 			create_default_kunitconfig()