Skip to contentSkip to conversation

selftests/livepatch: Do not check order when using "comm" for dmesg checking

PATCH In review Miroslav Benes 3 participants 6 messages Aug 27, 2020 – Oct 14, 2020

Subsystems (2)
lore
Share & tools
lore

Miroslav Benes

author maintainer
#0 lore raw

PATCH 1/1 selftests/livepatch: Do not check order when using "comm" for dmesg checking

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.

---

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(-)
tools/testing/selftests/livepatch/functions.sh +1 -1
index 1aba83c87ad3..846c7ed71556 100644
@@ -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.]*\] //')
Signature · 1 line
2.28.0
maintainer Acked-by on v1 1/1
#1 lore raw
Quoted 7 lines · 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

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

Quoted 4 lines

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

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

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

---

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

Quoted 19 lines
 tools/testing/selftests/livepatch/functions.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/testing/selftests/livepatch/functions.sh +1 -1
index 1aba83c87ad3..846c7ed71556 100644
@@ -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.]*\] //')
Signature · 1 line
2.28.0
#2 lore raw
Quoted 10 lines · Joe Lawrence
Quoted 4 lines

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

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,

Signature · 2 lines
Jiri Kosina
SUSE Labs
maintainer
#3 lore raw
Quoted 7 lines · Jiri Kosina
Quoted 5 lines · Joe Lawrence
Quoted 4 lines

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

Quoted 8 lines
Quoted 5 lines

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

#4 lore raw
Quoted 10 lines · Joe Lawrence
Quoted 9 lines
Quoted 6 lines

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,

Quoted 7 lines

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,

Signature · 2 lines
Jiri Kosina
SUSE Labs
maintainer
#5 lore raw
Quoted 17 lines · Jiri Kosina
Quoted 15 lines · Joe Lawrence
Quoted 9 lines
Quoted 6 lines

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?

Quoted 9 lines
Quoted 2 lines

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