linux-kselftest.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Brendan Higgins <brendanhiggins@google.com>
To: SeongJae Park <sj38.park@gmail.com>
Cc: "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>,
	SeongJae Park <sjpark@amazon.de>
Subject: Re: [PATCH] kunit/kunit_kernel: Rebuild .config if .kunitconfig is modified
Date: Mon, 27 Jan 2020 16:02:48 -0800	[thread overview]
Message-ID: <CAFd5g46v-RyNMP7GROn4bUEAATOPZ=w5AyO+tvuTG25aqt6oAg@mail.gmail.com> (raw)
In-Reply-To: <20200126015924.4198-1-sj38.park@gmail.com>

On Sat, Jan 25, 2020 at 5:59 PM <sj38.park@gmail.com> wrote:
>
> From: SeongJae Park <sjpark@amazon.de>
>
> Deletions of configs in the '.kunitconfig' is not applied because kunit
> rebuilds '.config' only if the '.config' is not a subset of the
> '.kunitconfig'.  To allow the deletions to applied, this commit modifies
> the '.config' rebuild condition to addtionally check the modified times
> of those files.

The reason it only checks that .kunitconfig is a subset of .config is
because we don't want the .kunitconfig to remove options just because
it doesn't recognize them.

It runs `make ARCH=um olddefconfig` on the .config that it generates
from the .kunitconfig, and most of the time that means you will get a
.config with lots of things in it that aren't in the .kunitconfig.
Consequently, nothing should ever be deleted from the .config just
because it was deleted in the .kunitconfig (unless, of course, you
change a =y to a =n or # ... is not set), so I don't see what this
change would do.

Can you maybe provide an example?

> Signed-off-by: SeongJae Park <sjpark@amazon.de>
> ---
>  tools/testing/kunit/kunit_kernel.py | 17 +++++++++++------
>  1 file changed, 11 insertions(+), 6 deletions(-)
>
> diff --git a/tools/testing/kunit/kunit_kernel.py b/tools/testing/kunit/kunit_kernel.py
> index cc5d844ecca1..a3a5d6c7e66d 100644
> --- a/tools/testing/kunit/kunit_kernel.py
> +++ b/tools/testing/kunit/kunit_kernel.py
> @@ -111,17 +111,22 @@ class LinuxSourceTree(object):
>                 return True
>
>         def build_reconfig(self, build_dir):
> -               """Creates a new .config if it is not a subset of the .kunitconfig."""
> +               """Creates a new .config if it is not a subset of, or older than the .kunitconfig."""
>                 kconfig_path = get_kconfig_path(build_dir)
>                 if os.path.exists(kconfig_path):
>                         existing_kconfig = kunit_config.Kconfig()
>                         existing_kconfig.read_from_file(kconfig_path)
> -                       if not self._kconfig.is_subset_of(existing_kconfig):
> -                               print('Regenerating .config ...')
> -                               os.remove(kconfig_path)
> -                               return self.build_config(build_dir)
> -                       else:
> +                       subset = self._kconfig.is_subset_of(existing_kconfig)
> +
> +                       kunitconfig_mtime = os.path.getmtime(kunitconfig_path)
> +                       kconfig_mtime = os.path.getmtime(kconfig_path)
> +                       older = kconfig_mtime < kunitconfig_mtime
> +
> +                       if subset and not older:
>                                 return True
> +                       print('Regenerating .config ...')
> +                       os.remove(kconfig_path)
> +                       return self.build_config(build_dir)
>                 else:
>                         print('Generating .config ...')
>                         return self.build_config(build_dir)
> --
> 2.17.1
>

  parent reply	other threads:[~2020-01-28  0:03 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-26  1:59 [PATCH] kunit/kunit_kernel: Rebuild .config if .kunitconfig is modified sj38.park
2020-01-27 15:32 ` [PATCH] docs/kunit/start: Use '_KUNIT_TEST' config name suffix sjpark
2020-02-19 22:16   ` Brendan Higgins
2020-02-20  7:38     ` SeongJae Park
2020-01-28  0:02 ` Brendan Higgins [this message]
2020-01-28  6:03   ` Re: [PATCH] kunit/kunit_kernel: Rebuild .config if .kunitconfig is modified SeongJae Park
2020-02-05  0:46     ` Brendan Higgins
2020-02-05  2:14       ` SeongJae Park
2020-02-05 17:58         ` David Gow
2020-02-05 20:00           ` Brendan Higgins
2020-02-05 22:09             ` Russell Currey
2020-03-13 15:45               ` shuah
2020-02-04  6:41 ` SeongJae Park

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='CAFd5g46v-RyNMP7GROn4bUEAATOPZ=w5AyO+tvuTG25aqt6oAg@mail.gmail.com' \
    --to=brendanhiggins@google.com \
    --cc=kunit-dev@googlegroups.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=sj38.park@gmail.com \
    --cc=sjpark@amazon.de \
    /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;
as well as URLs for NNTP newsgroup(s).