From: Brendan Higgins <brendanhiggins@google.com>
To: David Gow <davidgow@google.com>
Cc: Shuah Khan <shuah@kernel.org>,
"open list:KERNEL SELFTEST FRAMEWORK"
<linux-kselftest@vger.kernel.org>,
KUnit Development <kunit-dev@googlegroups.com>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v1 1/2] kunit: tool: fix running kunit_tool from outside kernel tree
Date: Sat, 8 Aug 2020 01:50:53 -0700 [thread overview]
Message-ID: <CAFd5g47itmDHzVRiihUe_P2yjqGuvGC8LPLpiDx1D8aQX1T1BA@mail.gmail.com> (raw)
In-Reply-To: <CABVgOSkEiQkcOy+gF9irJo-R6xCeiCvDRZXa_ubzCfz+9Yx2ZA@mail.gmail.com>
On Fri, Aug 7, 2020 at 10:45 PM David Gow <davidgow@google.com> wrote:
>
> On Sat, Aug 8, 2020 at 9:17 AM Brendan Higgins
> <brendanhiggins@google.com> 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 | 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())
> Do we want to print this, or is it a leftover debug statement?
Whoops, I was supposed to delete that. That's embarrassing... ^_^;
> > + 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()
> Why are we adding this everywhere when it's already in config_tests,
> which should already be called in all of the places where a
> kunitconfig is required?
Ah yes, .kunitconfig needs to be created before config_tests() can be
called because the LinuxSourceTree constructor needs .kunitconfig to
exist.
> Is the goal to always copy the default kunitconfig when creating a new
> build_dir? While I can sort-of see why we might want to do that, if
> the build dir doesn't exist, most of the subcommands will fail anyway
> (maybe we should only create the build-dir for 'config' and 'run'?)
I just did it because we were getting a failure in a constructor so we
couldn't do much. Ideally we would check that the current state allows
for the command that the user intended to run, but I think that's
beyond the scope of this change.
So I guess the real question is: Is it okay for it to crash in the
constructor with a cryptic error message for now, or do we want to let
it fail with a slightly less cryptic message later?
> > 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
> >
next prev parent reply other threads:[~2020-08-08 8:51 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
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-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 [this message]
2020-08-11 4:29 ` David Gow
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CAFd5g47itmDHzVRiihUe_P2yjqGuvGC8LPLpiDx1D8aQX1T1BA@mail.gmail.com \
--to=brendanhiggins@google.com \
--cc=davidgow@google.com \
--cc=kunit-dev@googlegroups.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=shuah@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®