2021-10-08 05:08:24

by Stephen Rothwell

[permalink] [raw]
Subject: linux-next: manual merge of the kunit-next tree with the kunit-fixes tree

Hi all,

Today's linux-next merge of the kunit-next tree got a conflict in:

tools/testing/kunit/kunit.py

between commit:

d8c23ead708b ("kunit: tool: better handling of quasi-bool args (--json, --raw_output)")

from the kunit-fixes tree and commit:

6710951ee039 ("kunit: tool: support running each suite/test separately")

from the kunit-next tree.

I fixed it up (see below) and can carry the fix as necessary. This
is now fixed as far as linux-next is concerned, but any non trivial
conflicts should be mentioned to your upstream maintainer when your tree
is submitted for merging. You may also want to consider cooperating
with the maintainer of the conflicting tree to minimise any particularly
complex conflicts.

--
Cheers,
Stephen Rothwell

diff --cc tools/testing/kunit/kunit.py
index ac35c61f65f5,7197e5fb8342..000000000000
--- a/tools/testing/kunit/kunit.py
+++ b/tools/testing/kunit/kunit.py
@@@ -16,9 -17,8 +17,8 @@@ assert sys.version_info >= (3, 7), "Pyt

from collections import namedtuple
from enum import Enum, auto
- from typing import Iterable, Sequence
-from typing import Iterable, List
++from typing import Iterable, Sequence, List

- import kunit_config
import kunit_json
import kunit_kernel
import kunit_parser
@@@ -184,28 -231,8 +231,28 @@@ def run_tests(linux: kunit_kernel.Linux
config_result.elapsed_time,
build_result.elapsed_time,
exec_result.elapsed_time))
- return parse_result
+ return exec_result

+# Problem:
+# $ kunit.py run --json
+# works as one would expect and prints the parsed test results as JSON.
+# $ kunit.py run --json suite_name
+# would *not* pass suite_name as the filter_glob and print as json.
+# argparse will consider it to be another way of writing
+# $ kunit.py run --json=suite_name
+# i.e. it would run all tests, and dump the json to a `suite_name` file.
+# So we hackily automatically rewrite --json => --json=stdout
+pseudo_bool_flag_defaults = {
+ '--json': 'stdout',
+ '--raw_output': 'kunit',
+}
+def massage_argv(argv: Sequence[str]) -> Sequence[str]:
+ def massage_arg(arg: str) -> str:
+ if arg not in pseudo_bool_flag_defaults:
+ return arg
+ return f'{arg}={pseudo_bool_flag_defaults[arg]}'
+ return list(map(massage_arg, argv))
+
def add_common_opts(parser) -> None:
parser.add_argument('--build_dir',
help='As in the make command, it specifies the build '


Attachments:
(No filename) (499.00 B)
OpenPGP digital signature

2021-10-08 16:34:22

by Shuah Khan

[permalink] [raw]
Subject: Re: linux-next: manual merge of the kunit-next tree with the kunit-fixes tree

On 10/7/21 10:29 PM, Stephen Rothwell wrote:
> Hi all,
>
> Today's linux-next merge of the kunit-next tree got a conflict in:
>
> tools/testing/kunit/kunit.py
>
> between commit:
>
> d8c23ead708b ("kunit: tool: better handling of quasi-bool args (--json, --raw_output)")
>
> from the kunit-fixes tree and commit:
>
> 6710951ee039 ("kunit: tool: support running each suite/test separately")
>
> from the kunit-next tree.
>
> I fixed it up (see below) and can carry the fix as necessary. This
> is now fixed as far as linux-next is concerned, but any non trivial
> conflicts should be mentioned to your upstream maintainer when your tree
> is submitted for merging. You may also want to consider cooperating
> with the maintainer of the conflicting tree to minimise any particularly
> complex conflicts.
>

Thank you for the fixing it up. I will fix this up in the kunit-next once
the kunit-fixes pull request goes out.

thanks,
-- Shuah

2021-10-08 20:08:11

by Brendan Higgins

[permalink] [raw]
Subject: Re: linux-next: manual merge of the kunit-next tree with the kunit-fixes tree

On Fri, Oct 8, 2021 at 9:31 AM Shuah Khan <[email protected]> wrote:
>
> On 10/7/21 10:29 PM, Stephen Rothwell wrote:
> > Hi all,
> >
> > Today's linux-next merge of the kunit-next tree got a conflict in:
> >
> > tools/testing/kunit/kunit.py
> >
> > between commit:
> >
> > d8c23ead708b ("kunit: tool: better handling of quasi-bool args (--json, --raw_output)")
> >
> > from the kunit-fixes tree and commit:
> >
> > 6710951ee039 ("kunit: tool: support running each suite/test separately")
> >
> > from the kunit-next tree.
> >
> > I fixed it up (see below) and can carry the fix as necessary. This
> > is now fixed as far as linux-next is concerned, but any non trivial
> > conflicts should be mentioned to your upstream maintainer when your tree
> > is submitted for merging. You may also want to consider cooperating
> > with the maintainer of the conflicting tree to minimise any particularly
> > complex conflicts.
> >
>
> Thank you for the fixing it up. I will fix this up in the kunit-next once
> the kunit-fixes pull request goes out.

Thanks for taking care of this everyone.

Daniel, can you double check the merge conflict to make sure it is
done correctly?

2021-10-08 20:50:26

by Daniel Latypov

[permalink] [raw]
Subject: Re: linux-next: manual merge of the kunit-next tree with the kunit-fixes tree

On Fri, Oct 8, 2021 at 1:03 PM Brendan Higgins
<[email protected]> wrote:
>
> On Fri, Oct 8, 2021 at 9:31 AM Shuah Khan <[email protected]> wrote:
> >
> > On 10/7/21 10:29 PM, Stephen Rothwell wrote:
> > > Hi all,
> > >
> > > Today's linux-next merge of the kunit-next tree got a conflict in:
> > >
> > > tools/testing/kunit/kunit.py
> > >
> > > between commit:
> > >
> > > d8c23ead708b ("kunit: tool: better handling of quasi-bool args (--json, --raw_output)")
> > >
> > > from the kunit-fixes tree and commit:
> > >
> > > 6710951ee039 ("kunit: tool: support running each suite/test separately")
> > >
> > > from the kunit-next tree.
> > >
> > > I fixed it up (see below) and can carry the fix as necessary. This
> > > is now fixed as far as linux-next is concerned, but any non trivial
> > > conflicts should be mentioned to your upstream maintainer when your tree
> > > is submitted for merging. You may also want to consider cooperating
> > > with the maintainer of the conflicting tree to minimise any particularly
> > > complex conflicts.
> > >
> >
> > Thank you for the fixing it up. I will fix this up in the kunit-next once
> > the kunit-fixes pull request goes out.
>
> Thanks for taking care of this everyone.
>
> Daniel, can you double check the merge conflict to make sure it is
> done correctly?

Looks good to me.
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/tree/tools/testing/kunit/kunit.py

Not sure if I'm parsing the 3-way diff properly, but it looks like
it's just the typing import and the fact we added some code right
below run_tests(), which got changed.
So yeah, the combined Typing import and telling git it's being
paranoid about run_tests and massage_argv seems fine.

2021-10-19 21:28:53

by Shuah Khan

[permalink] [raw]
Subject: Re: linux-next: manual merge of the kunit-next tree with the kunit-fixes tree

On 10/8/21 10:31 AM, Shuah Khan wrote:
> On 10/7/21 10:29 PM, Stephen Rothwell wrote:
>> Hi all,
>>
>> Today's linux-next merge of the kunit-next tree got a conflict in:
>>
>> ?? tools/testing/kunit/kunit.py
>>
>> between commit:
>>
>> ?? d8c23ead708b ("kunit: tool: better handling of quasi-bool args (--json, --raw_output)")
>>
>> from the kunit-fixes tree and commit:
>>
>> ?? 6710951ee039 ("kunit: tool: support running each suite/test separately")
>>
>> from the kunit-next tree.
>>
>> I fixed it up (see below) and can carry the fix as necessary. This
>> is now fixed as far as linux-next is concerned, but any non trivial
>> conflicts should be mentioned to your upstream maintainer when your tree
>> is submitted for merging.? You may also want to consider cooperating
>> with the maintainer of the conflicting tree to minimise any particularly
>> complex conflicts.
>>
>
> Thank you for the fixing it up. I will fix this up in the kunit-next once
> the kunit-fixes pull request goes out.
>

I fixed the merge conflict in kunit-next tree after rebase to Linux 5.15-rc6.
There is no need to carry this fix.

Daniel! Please review to see if it looks good. It was very minor fix-up.

- from typing import Iterable, Sequence
-from typing import Iterable, List
++from typing import Iterable, Sequence, List

thanks,
-- Shuah

2021-10-19 21:42:06

by Daniel Latypov

[permalink] [raw]
Subject: Re: linux-next: manual merge of the kunit-next tree with the kunit-fixes tree

On Tue, Oct 19, 2021 at 2:26 PM Shuah Khan <[email protected]> wrote:
>
> On 10/8/21 10:31 AM, Shuah Khan wrote:
> > On 10/7/21 10:29 PM, Stephen Rothwell wrote:
> >> Hi all,
> >>
> >> Today's linux-next merge of the kunit-next tree got a conflict in:
> >>
> >> tools/testing/kunit/kunit.py
> >>
> >> between commit:
> >>
> >> d8c23ead708b ("kunit: tool: better handling of quasi-bool args (--json, --raw_output)")
> >>
> >> from the kunit-fixes tree and commit:
> >>
> >> 6710951ee039 ("kunit: tool: support running each suite/test separately")
> >>
> >> from the kunit-next tree.
> >>
> >> I fixed it up (see below) and can carry the fix as necessary. This
> >> is now fixed as far as linux-next is concerned, but any non trivial
> >> conflicts should be mentioned to your upstream maintainer when your tree
> >> is submitted for merging. You may also want to consider cooperating
> >> with the maintainer of the conflicting tree to minimise any particularly
> >> complex conflicts.
> >>
> >
> > Thank you for the fixing it up. I will fix this up in the kunit-next once
> > the kunit-fixes pull request goes out.
> >
>
> I fixed the merge conflict in kunit-next tree after rebase to Linux 5.15-rc6.
> There is no need to carry this fix.
>
> Daniel! Please review to see if it looks good. It was very minor fix-up.

ff9e09a3762fbd7aba83cfd1530972b57ae52b3b looks good to me.
Thanks, Shuah!

To be extra safe, I checked

Test that test-level filtering and hermetic testing work as expected
$ ./tools/testing/kunit/kunit.py run --run_isolated=suite '*ex*.*skipped*'
$ ./tools/testing/kunit/kunit.py run --run_isolated=suite '*ex*.*s[iu]*'

kunit.py's unit test:
$ ./tools/testing/kunit/kunit_tool_test.py

Type-checkers:
$ pytype ./tools/testing/kunit/*.py
$ mypy ./tools/testing/kunit/*.py # this had the expected errors

>
> - from typing import Iterable, Sequence
> -from typing import Iterable, List
> ++from typing import Iterable, Sequence, List
>
> thanks,
> -- Shuah
>

2021-10-19 22:23:14

by Stephen Rothwell

[permalink] [raw]
Subject: Re: linux-next: manual merge of the kunit-next tree with the kunit-fixes tree

Hi Shuah,

On Tue, 19 Oct 2021 15:26:40 -0600 Shuah Khan <[email protected]> wrote:
>
> I fixed the merge conflict in kunit-next tree after rebase to Linux 5.15-rc6.
> There is no need to carry this fix.
>
> Daniel! Please review to see if it looks good. It was very minor fix-up.

There was really no need to rebase. A simple merge of the kunit-fixes
tree into the kunit-next tree would has sufficed, maintained history
and allowed a place for an explanation. Or you could have mentioned
the conflict to Linus during the merge window.

--
Cheers,
Stephen Rothwell


Attachments:
(No filename) (499.00 B)
OpenPGP digital signature