All of lore.kernel.org
 help / color / mirror / Atom feed
From: David Gow <davidgow@google.com>
To: Daniel Latypov <dlatypov@google.com>
Cc: Brendan Higgins <brendanhiggins@google.com>,
	Marco Elver <elver@google.com>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	kasan-dev <kasan-dev@googlegroups.com>,
	KUnit Development <kunit-dev@googlegroups.com>,
	"open list:KERNEL SELFTEST FRAMEWORK" 
	<linux-kselftest@vger.kernel.org>,
	Shuah Khan <skhan@linuxfoundation.org>
Subject: Re: [PATCH 2/3] kunit: tool: simplify creating LinuxSourceTreeOperations
Date: Thu, 19 May 2022 21:20:07 +0800	[thread overview]
Message-ID: <CABVgOSmgxYtA0cudjHy130gMQAYBp27C8D_i2u3Zb+Jahd1toQ@mail.gmail.com> (raw)
In-Reply-To: <20220518170124.2849497-3-dlatypov@google.com>

[-- Attachment #1: Type: text/plain, Size: 3393 bytes --]

On Thu, May 19, 2022 at 1:01 AM Daniel Latypov <dlatypov@google.com> wrote:
>
> Drop get_source_tree_ops() and just call what used to be
> get_source_tree_ops_from_qemu_config() in both cases.
>
> Also rename the functions to have shorter names and add a "_" prefix to
> note they're not meant to be used outside this function.
>
> Signed-off-by: Daniel Latypov <dlatypov@google.com>
> ---

Reviewed-by: David Gow <davidgow@google.com>


-- David

>  tools/testing/kunit/kunit_kernel.py | 20 ++++++++++----------
>  1 file changed, 10 insertions(+), 10 deletions(-)
>
> diff --git a/tools/testing/kunit/kunit_kernel.py b/tools/testing/kunit/kunit_kernel.py
> index 8bc8305ba817..e93f07ac0af1 100644
> --- a/tools/testing/kunit/kunit_kernel.py
> +++ b/tools/testing/kunit/kunit_kernel.py
> @@ -178,19 +178,16 @@ def get_old_kunitconfig_path(build_dir: str) -> str:
>  def get_outfile_path(build_dir: str) -> str:
>         return os.path.join(build_dir, OUTFILE_PATH)
>
> -def get_source_tree_ops(arch: str, cross_compile: Optional[str]) -> LinuxSourceTreeOperations:
> +def _default_qemu_config_path(arch: str) -> str:
>         config_path = os.path.join(QEMU_CONFIGS_DIR, arch + '.py')
> -       if arch == 'um':
> -               return LinuxSourceTreeOperationsUml(cross_compile=cross_compile)
>         if os.path.isfile(config_path):
> -               return get_source_tree_ops_from_qemu_config(config_path, cross_compile)[1]
> +               return config_path
>
>         options = [f[:-3] for f in os.listdir(QEMU_CONFIGS_DIR) if f.endswith('.py')]
>         raise ConfigError(arch + ' is not a valid arch, options are ' + str(sorted(options)))
>
> -def get_source_tree_ops_from_qemu_config(config_path: str,
> -                                        cross_compile: Optional[str]) -> Tuple[
> -                                                        str, LinuxSourceTreeOperations]:
> +def _get_qemu_ops(config_path: str,
> +                 cross_compile: Optional[str]) -> Tuple[str, LinuxSourceTreeOperations]:
>         # The module name/path has very little to do with where the actual file
>         # exists (I learned this through experimentation and could not find it
>         # anywhere in the Python documentation).
> @@ -226,11 +223,14 @@ class LinuxSourceTree:
>               qemu_config_path=None) -> None:
>                 signal.signal(signal.SIGINT, self.signal_handler)
>                 if qemu_config_path:
> -                       self._arch, self._ops = get_source_tree_ops_from_qemu_config(
> -                                       qemu_config_path, cross_compile)
> +                       self._arch, self._ops = _get_qemu_ops(qemu_config_path, cross_compile)
>                 else:
>                         self._arch = 'um' if arch is None else arch
> -                       self._ops = get_source_tree_ops(self._arch, cross_compile)
> +                       if self._arch == 'um':
> +                               self._ops = LinuxSourceTreeOperationsUml(cross_compile=cross_compile)
> +                       else:
> +                               qemu_config_path = _default_qemu_config_path(self._arch)
> +                               _, self._ops = _get_qemu_ops(qemu_config_path, cross_compile)
>
>                 if kunitconfig_path:
>                         if os.path.isdir(kunitconfig_path):
> --
> 2.36.1.124.g0e6072fb45-goog
>

[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 4003 bytes --]

  reply	other threads:[~2022-05-19 13:20 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-18 17:01 [PATCH 0/3] kunit: add support in kunit.py for --qemu_args Daniel Latypov
2022-05-18 17:01 ` [PATCH 1/3] Documentation: kunit: fix example run_kunit func to allow spaces in args Daniel Latypov
2022-05-19 13:20   ` David Gow
2022-07-06 18:34   ` Brendan Higgins
2022-05-18 17:01 ` [PATCH 2/3] kunit: tool: simplify creating LinuxSourceTreeOperations Daniel Latypov
2022-05-19 13:20   ` David Gow [this message]
2022-07-06 20:06   ` Brendan Higgins
2022-05-18 17:01 ` [PATCH 3/3] kunit: tool: introduce --qemu_args Daniel Latypov
2022-05-19 13:20   ` David Gow
2022-07-06 20:11   ` Brendan Higgins

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=CABVgOSmgxYtA0cudjHy130gMQAYBp27C8D_i2u3Zb+Jahd1toQ@mail.gmail.com \
    --to=davidgow@google.com \
    --cc=brendanhiggins@google.com \
    --cc=dlatypov@google.com \
    --cc=elver@google.com \
    --cc=kasan-dev@googlegroups.com \
    --cc=kunit-dev@googlegroups.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=skhan@linuxfoundation.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.