live-patching.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] selftests/livepatch: Do not check order when using "comm" for dmesg checking
@ 2020-08-27 11:07 Miroslav Benes
  2020-08-27 13:20 ` Joe Lawrence
  0 siblings, 1 reply; 6+ messages in thread
From: Miroslav Benes @ 2020-08-27 11:07 UTC (permalink / raw)
  To: jpoimboe, jikos, pmladek, joe.lawrence, shuah
  Cc: live-patching, linux-kselftest, linux-kernel, Miroslav Benes

check_result() uses "comm" to check expected results of selftests output
in dmesg. Everything works fine if timestamps in dmesg are unique. If
not, like in this example

[   86.844422] test_klp_callbacks_demo: pre_unpatch_callback: test_klp_callbacks_mod -> [MODULE_STATE_LIVE] Normal state
[   86.844422] livepatch: 'test_klp_callbacks_demo': starting unpatching transition

, "comm" fails with "comm: file 2 is not in sorted order". Suppress the
order checking with --nocheck-order option.

Signed-off-by: Miroslav Benes <mbenes@suse.cz>
---

The strange thing is, I can reproduce the issue easily and reliably on
older codestreams (4.12) but not on current upstream in my testing
environment. I think the change makes sense regardless though.

 tools/testing/selftests/livepatch/functions.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/testing/selftests/livepatch/functions.sh b/tools/testing/selftests/livepatch/functions.sh
index 1aba83c87ad3..846c7ed71556 100644
--- a/tools/testing/selftests/livepatch/functions.sh
+++ b/tools/testing/selftests/livepatch/functions.sh
@@ -278,7 +278,7 @@ function check_result {
 	# help differentiate repeated testing runs.  Remove them with a
 	# post-comparison sed filter.
 
-	result=$(dmesg | comm -13 "$SAVED_DMESG" - | \
+	result=$(dmesg | comm --nocheck-order -13 "$SAVED_DMESG" - | \
 		 grep -e 'livepatch:' -e 'test_klp' | \
 		 grep -v '\(tainting\|taints\) kernel' | \
 		 sed 's/^\[[ 0-9.]*\] //')
-- 
2.28.0


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] selftests/livepatch: Do not check order when using "comm" for dmesg checking
  2020-08-27 11:07 [PATCH] selftests/livepatch: Do not check order when using "comm" for dmesg checking Miroslav Benes
@ 2020-08-27 13:20 ` Joe Lawrence
  2020-08-27 13:28   ` Jiri Kosina
  0 siblings, 1 reply; 6+ messages in thread
From: Joe Lawrence @ 2020-08-27 13:20 UTC (permalink / raw)
  To: Miroslav Benes
  Cc: jpoimboe, jikos, pmladek, shuah, live-patching, linux-kselftest,
	linux-kernel

On Thu, Aug 27, 2020 at 01:07:09PM +0200, Miroslav Benes wrote:
> check_result() uses "comm" to check expected results of selftests output
> in dmesg. Everything works fine if timestamps in dmesg are unique. If
> not, like in this example
> 
> [   86.844422] test_klp_callbacks_demo: pre_unpatch_callback: test_klp_callbacks_mod -> [MODULE_STATE_LIVE] Normal state
> [   86.844422] livepatch: 'test_klp_callbacks_demo': starting unpatching transition
> 

Heh, our assumption that the timestamps would provide sorting wasn't
true after all.

> , "comm" fails with "comm: file 2 is not in sorted order". Suppress the
> order checking with --nocheck-order option.
> 
> Signed-off-by: Miroslav Benes <mbenes@suse.cz>

Acked-by: Joe Lawrence <joe.lawrence@redhat.com>

And not so important for selftests, but helpful for backporting efforts:

Fixes: 2f3f651f3756 ("selftests/livepatch: Use "comm" instead of "diff" for dmesg")

> ---
> 
> The strange thing is, I can reproduce the issue easily and reliably on
> older codestreams (4.12) but not on current upstream in my testing
> environment. I think the change makes sense regardless though.
> 

We haven't backported v5.8 changes just yet, so thanks for finding this
one and posting a fix.

-- Joe

>  tools/testing/selftests/livepatch/functions.sh | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/tools/testing/selftests/livepatch/functions.sh b/tools/testing/selftests/livepatch/functions.sh
> index 1aba83c87ad3..846c7ed71556 100644
> --- a/tools/testing/selftests/livepatch/functions.sh
> +++ b/tools/testing/selftests/livepatch/functions.sh
> @@ -278,7 +278,7 @@ function check_result {
>  	# help differentiate repeated testing runs.  Remove them with a
>  	# post-comparison sed filter.
>  
> -	result=$(dmesg | comm -13 "$SAVED_DMESG" - | \
> +	result=$(dmesg | comm --nocheck-order -13 "$SAVED_DMESG" - | \
>  		 grep -e 'livepatch:' -e 'test_klp' | \
>  		 grep -v '\(tainting\|taints\) kernel' | \
>  		 sed 's/^\[[ 0-9.]*\] //')
> -- 
> 2.28.0
> 


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] selftests/livepatch: Do not check order when using "comm" for dmesg checking
  2020-08-27 13:20 ` Joe Lawrence
@ 2020-08-27 13:28   ` Jiri Kosina
  2020-10-14 21:48     ` Joe Lawrence
  0 siblings, 1 reply; 6+ messages in thread
From: Jiri Kosina @ 2020-08-27 13:28 UTC (permalink / raw)
  To: Joe Lawrence
  Cc: Miroslav Benes, jpoimboe, pmladek, shuah, live-patching,
	linux-kselftest, linux-kernel

On Thu, 27 Aug 2020, Joe Lawrence wrote:

> > , "comm" fails with "comm: file 2 is not in sorted order". Suppress the
> > order checking with --nocheck-order option.
> > 
> > Signed-off-by: Miroslav Benes <mbenes@suse.cz>
> 
> Acked-by: Joe Lawrence <joe.lawrence@redhat.com>
> 
> And not so important for selftests, but helpful for backporting efforts:
> 
> Fixes: 2f3f651f3756 ("selftests/livepatch: Use "comm" instead of "diff" for dmesg")

I've added the Fixes: tag and applied to for-5.9/upstream-fixes. Thanks,

-- 
Jiri Kosina
SUSE Labs


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] selftests/livepatch: Do not check order when using "comm" for dmesg checking
  2020-08-27 13:28   ` Jiri Kosina
@ 2020-10-14 21:48     ` Joe Lawrence
  2020-10-14 21:53       ` Jiri Kosina
  0 siblings, 1 reply; 6+ messages in thread
From: Joe Lawrence @ 2020-10-14 21:48 UTC (permalink / raw)
  To: Jiri Kosina; +Cc: Miroslav Benes, jpoimboe, pmladek, shuah, live-patching

On 8/27/20 9:28 AM, Jiri Kosina wrote:
> On Thu, 27 Aug 2020, Joe Lawrence wrote:
> 
>>> , "comm" fails with "comm: file 2 is not in sorted order". Suppress the
>>> order checking with --nocheck-order option.
>>>
>>> Signed-off-by: Miroslav Benes <mbenes@suse.cz>
>>
>> Acked-by: Joe Lawrence <joe.lawrence@redhat.com>
>>
>> And not so important for selftests, but helpful for backporting efforts:
>>
>> Fixes: 2f3f651f3756 ("selftests/livepatch: Use "comm" instead of "diff" for dmesg")
> 
> I've added the Fixes: tag and applied to for-5.9/upstream-fixes. Thanks,
> 

Hi Jiri,

I was looking at a list of livepatching commits that went into 5.9 for 
backporting and was wondering if we ever merged this one?

It's not a show-stopper, but would be nice to get this one in for 5.10 
if possible.

Thanks,

-- Joe


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] selftests/livepatch: Do not check order when using "comm" for dmesg checking
  2020-10-14 21:48     ` Joe Lawrence
@ 2020-10-14 21:53       ` Jiri Kosina
  2020-10-14 22:15         ` Joe Lawrence
  0 siblings, 1 reply; 6+ messages in thread
From: Jiri Kosina @ 2020-10-14 21:53 UTC (permalink / raw)
  To: Joe Lawrence; +Cc: Miroslav Benes, jpoimboe, pmladek, shuah, live-patching

On Wed, 14 Oct 2020, Joe Lawrence wrote:

> >> Acked-by: Joe Lawrence <joe.lawrence@redhat.com>
> >>
> >> And not so important for selftests, but helpful for backporting efforts:
> >>
> >> Fixes: 2f3f651f3756 ("selftests/livepatch: Use "comm" instead of "diff" for
> >> dmesg")
> > 
> > I've added the Fixes: tag and applied to for-5.9/upstream-fixes. Thanks,
> > 
> 
> Hi Jiri,
> 
> I was looking at a list of livepatching commits that went into 5.9 for
> backporting and was wondering if we ever merged this one?
> 
> It's not a show-stopper, but would be nice to get this one in for 5.10 if
> possible.

Hi Joe,

it was not enough of a trigger to actually send 5.9-rc pull request. But 
in cases like this, for-5.x/upstream-fixes branch gets included in 5.x+1 
pull request. So it absolutely will land in 5.10.

Thanks,

-- 
Jiri Kosina
SUSE Labs


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] selftests/livepatch: Do not check order when using "comm" for dmesg checking
  2020-10-14 21:53       ` Jiri Kosina
@ 2020-10-14 22:15         ` Joe Lawrence
  0 siblings, 0 replies; 6+ messages in thread
From: Joe Lawrence @ 2020-10-14 22:15 UTC (permalink / raw)
  To: Jiri Kosina; +Cc: Miroslav Benes, jpoimboe, pmladek, shuah, live-patching

On 10/14/20 5:53 PM, Jiri Kosina wrote:
> On Wed, 14 Oct 2020, Joe Lawrence wrote:
> 
>>>> Acked-by: Joe Lawrence <joe.lawrence@redhat.com>
>>>>
>>>> And not so important for selftests, but helpful for backporting efforts:
>>>>
>>>> Fixes: 2f3f651f3756 ("selftests/livepatch: Use "comm" instead of "diff" for
>>>> dmesg")
>>>
>>> I've added the Fixes: tag and applied to for-5.9/upstream-fixes. Thanks,
>>>
>>
>> Hi Jiri,
>>
>> I was looking at a list of livepatching commits that went into 5.9 for
>> backporting and was wondering if we ever merged this one?
>>
>> It's not a show-stopper, but would be nice to get this one in for 5.10 if
>> possible.
> 
> Hi Joe,
> 
> it was not enough of a trigger to actually send 5.9-rc pull request. But
> in cases like this, for-5.x/upstream-fixes branch gets included in 5.x+1
> pull request. So it absolutely will land in 5.10.
> 

Ah ok, I agree holding onto that one that makes sense.  The branch name 
threw me off, so I thought I'd ping.

Thanks,

-- Joe


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2020-10-14 22:15 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-27 11:07 [PATCH] selftests/livepatch: Do not check order when using "comm" for dmesg checking Miroslav Benes
2020-08-27 13:20 ` Joe Lawrence
2020-08-27 13:28   ` Jiri Kosina
2020-10-14 21:48     ` Joe Lawrence
2020-10-14 21:53       ` Jiri Kosina
2020-10-14 22:15         ` Joe Lawrence

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).