OpenVZ / Virtuozzo kernel development (devel@openvz.org)
 help / color / mirror / Atom feed
* [Devel] [PATCH hci-8.1 v3 0/2] selftests: pstore: fix backend/frontend skip
@ 2026-09-25 13:18 Eva Kurchatova
  2026-09-25 13:18 ` [Devel] [PATCH hci-8.1 v3 1/2] selftests: pstore: skip when no backend is registered Eva Kurchatova
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Eva Kurchatova @ 2026-09-25 13:18 UTC (permalink / raw)
  To: khorenko; +Cc: devel

Patchset for task https://virtuozzo.atlassian.net/browse/VSTOR-142447.

Changes in v3:

1/2:
- Print "ok" with prlog once the backend check has passed.
  This can never set rc, so the "if [ $rc -ne 0 ]" exit below it was
  unreachable; drop it.
- Drop one of the two blank lines left in pstore_post_reboot_tests
  where ksft_skip was defined.
- Rewrite the message: the existing check tests the exit status of
  cat, not the value it reads, which is why it passes on an
  unregistered backend. "latter" -> "later".
- Cut the comment above the check to one line.

2/2:
- Cut the comment to one line, the reason is in the message.
- Carries Konstantin's Reviewed-by from v2.

Link to v2: https://lists.openvz.org/pipermail/devel/2026-September/085069.html

Changes in v2:

1/2:
- Fix the verdict of the existing backend check in place instead of
  appending a second check at the end of common_tests, so the output
  no longer says "ok" and then skips.
- Skip where the parameter file is absent as well: pstore is tristate,
  and a module that is not loaded leaves no file.
- Keep the backend and cmdline diagnostics in the skip case.
- Write the test as [ ] || [ ], -o inside [ ] is obsolete.
- Define ksft_skip in common_tests, with the canonical comment, and
  drop the copy in pstore_post_reboot_tests.

2/2:
- New patch, split out as asked in the review of v1: the console and
  pmsg frontends are separate options from the backend and need skips
  of their own.

Link to v1: https://lists.openvz.org/pipermail/devel/2026-September/084981.html

Eva Kurchatova (2):
  selftests: pstore: skip when no backend is registered
  selftests: pstore: skip the frontends the kernel does not have

 tools/testing/selftests/pstore/common_tests    | 17 ++++++++++++-----
 .../selftests/pstore/pstore_post_reboot_tests  |  3 ---
 tools/testing/selftests/pstore/pstore_tests    | 18 ++++++++++++------
 3 files changed, 24 insertions(+), 14 deletions(-)

-- 
2.55.0

_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel

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

* [Devel] [PATCH hci-8.1 v3 1/2] selftests: pstore: skip when no backend is registered
  2026-09-25 13:18 [Devel] [PATCH hci-8.1 v3 0/2] selftests: pstore: fix backend/frontend skip Eva Kurchatova
@ 2026-09-25 13:18 ` Eva Kurchatova
  2026-09-25 13:18 ` [Devel] [PATCH hci-8.1 v3 2/2] selftests: pstore: skip the frontends the kernel does not have Eva Kurchatova
  2026-09-25 14:57 ` [Devel] [PATCH hci-8.1 v3 0/2] selftests: pstore: fix backend/frontend skip Konstantin Khorenko
  2 siblings, 0 replies; 4+ messages in thread
From: Eva Kurchatova @ 2026-09-25 13:18 UTC (permalink / raw)
  To: khorenko; +Cc: devel

An unregistered pstore backend reads back "(null)", and every latter
check fails. This also contradicts the pstore_crash_test documentation.

pstore_crash_test has carried the comment, but never implemented it:

  # exit if pstore backend is not registered

Fix by skipping an unregistered backend in common_tests.

https://virtuozzo.atlassian.net/browse/VSTOR-142447
Feature: fix selftests

Signed-off-by: Eva Kurchatova <eva.kurchatova@virtuozzo.com>
---
 tools/testing/selftests/pstore/common_tests     | 17 ++++++++++++-----
 .../selftests/pstore/pstore_post_reboot_tests   |  3 ---
 2 files changed, 12 insertions(+), 8 deletions(-)

diff --git a/tools/testing/selftests/pstore/common_tests b/tools/testing/selftests/pstore/common_tests
index 4509f0cc9c91..8f140fa572af 100755
--- a/tools/testing/selftests/pstore/common_tests
+++ b/tools/testing/selftests/pstore/common_tests
@@ -55,6 +55,8 @@ operate_files() { # tested value, files, operation
 
 # Parameters
 TEST_STRING_PATTERN="Testing pstore: uuid="
+# Kselftest framework requirement - SKIP code is 4.
+ksft_skip=4
 UUID=`cat /proc/sys/kernel/random/uuid`
 TOP_DIR=`absdir $0`
 LOG_DIR=$TOP_DIR/logs/`date +%Y%m%d-%H%M%S`_${UUID}/
@@ -74,10 +76,15 @@ prlog "=== Pstore unit tests (`basename $0`) ==="
 prlog "UUID="$UUID
 
 prlog -n "Checking pstore backend is registered ... "
-backend=`cat /sys/module/pstore/parameters/backend`
-show_result $?
+# No file at all where pstore is not loaded, "(null)" where none registered
+backend=`cat /sys/module/pstore/parameters/backend 2>/dev/null`
+if [ -z "$backend" ] || [ "$backend" = "(null)" ]; then
+    prlog "SKIP"
+    prlog -e "\tbackend=${backend:-<none>}"
+    prlog -e "\tcmdline=`cat /proc/cmdline`"
+    prlog "pstore backend is not registered, skipping"
+    exit $ksft_skip
+fi
+prlog "ok"
 prlog -e "\tbackend=${backend}"
 prlog -e "\tcmdline=`cat /proc/cmdline`"
-if [ $rc -ne 0 ]; then
-    exit 1
-fi
diff --git a/tools/testing/selftests/pstore/pstore_post_reboot_tests b/tools/testing/selftests/pstore/pstore_post_reboot_tests
index d6da5e86efbf..2edd48a87dda 100755
--- a/tools/testing/selftests/pstore/pstore_post_reboot_tests
+++ b/tools/testing/selftests/pstore/pstore_post_reboot_tests
@@ -7,9 +7,6 @@
 #  Written by Hiraku Toyooka <hiraku.toyooka.gu@hitachi.com>
 #
 
-# Kselftest framework requirement - SKIP code is 4.
-ksft_skip=4
-
 . ./common_tests
 
 if [ -e $REBOOT_FLAG  ]; then
-- 
2.55.0

_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel

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

* [Devel] [PATCH hci-8.1 v3 2/2] selftests: pstore: skip the frontends the kernel does not have
  2026-09-25 13:18 [Devel] [PATCH hci-8.1 v3 0/2] selftests: pstore: fix backend/frontend skip Eva Kurchatova
  2026-09-25 13:18 ` [Devel] [PATCH hci-8.1 v3 1/2] selftests: pstore: skip when no backend is registered Eva Kurchatova
@ 2026-09-25 13:18 ` Eva Kurchatova
  2026-09-25 14:57 ` [Devel] [PATCH hci-8.1 v3 0/2] selftests: pstore: fix backend/frontend skip Konstantin Khorenko
  2 siblings, 0 replies; 4+ messages in thread
From: Eva Kurchatova @ 2026-09-25 13:18 UTC (permalink / raw)
  To: khorenko; +Cc: devel

The console and pmsg frontends are separate options from the backend:
CONFIG_PSTORE_CONSOLE and CONFIG_PSTORE_PMSG can both be off on a kernel
that registers one. pstore_tests checks for both regardless and fails
where they are absent.

Report them as skips instead.

https://virtuozzo.atlassian.net/browse/VSTOR-142447
Feature: fix selftests

Signed-off-by: Eva Kurchatova <eva.kurchatova@virtuozzo.com>
Reviewed-by: Konstantin Khorenko <khorenko@virtuozzo.com>
---
 tools/testing/selftests/pstore/pstore_tests | 18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)

diff --git a/tools/testing/selftests/pstore/pstore_tests b/tools/testing/selftests/pstore/pstore_tests
index 2aa9a3852a84..ac11988888a6 100755
--- a/tools/testing/selftests/pstore/pstore_tests
+++ b/tools/testing/selftests/pstore/pstore_tests
@@ -9,13 +9,20 @@
 
 . ./common_tests
 
+# The frontends are separate options, a backend does not bring them in
 prlog -n "Checking pstore console is registered ... "
-dmesg | grep -Eq "console \[(pstore|${backend})"
-show_result $?
+if dmesg | grep -Eq "console \[(pstore|${backend})"; then
+    show_result 0
+else
+    prlog "SKIP (no pstore console, needs CONFIG_PSTORE_CONSOLE)"
+fi
 
 prlog -n "Checking /dev/pmsg0 exists ... "
-test -e /dev/pmsg0
-show_result $?
+if [ -e /dev/pmsg0 ]; then
+    show_result 0
+else
+    prlog "SKIP (no /dev/pmsg0, needs CONFIG_PSTORE_PMSG)"
+fi
 
 prlog -n "Writing unique string to /dev/pmsg0 ... "
 if [ -e "/dev/pmsg0" ]; then
@@ -23,8 +30,7 @@ if [ -e "/dev/pmsg0" ]; then
     show_result $?
     echo "$UUID" > $TOP_DIR/uuid
 else
-    prlog "FAIL"
-    rc=1
+    prlog "SKIP (no /dev/pmsg0)"
 fi
 
 exit $rc
-- 
2.55.0

_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel

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

* Re: [Devel] [PATCH hci-8.1 v3 0/2] selftests: pstore: fix backend/frontend skip
  2026-09-25 13:18 [Devel] [PATCH hci-8.1 v3 0/2] selftests: pstore: fix backend/frontend skip Eva Kurchatova
  2026-09-25 13:18 ` [Devel] [PATCH hci-8.1 v3 1/2] selftests: pstore: skip when no backend is registered Eva Kurchatova
  2026-09-25 13:18 ` [Devel] [PATCH hci-8.1 v3 2/2] selftests: pstore: skip the frontends the kernel does not have Eva Kurchatova
@ 2026-09-25 14:57 ` Konstantin Khorenko
  2 siblings, 0 replies; 4+ messages in thread
From: Konstantin Khorenko @ 2026-09-25 14:57 UTC (permalink / raw)
  To: Eva Kurchatova; +Cc: devel

On Fri, 25 Sep 2026 16:18:51 +0300, Eva Kurchatova wrote:
> selftests: pstore: fix backend/frontend skip
> 
> Patchset for task https://virtuozzo.atlassian.net/browse/VSTOR-142447.
> 
> Changes in v3:
> 
> 1/2:
> - Print "ok" with prlog once the backend check has passed.
>   This can never set rc, so the "if [ $rc -ne 0 ]" exit below it was
>   unreachable; drop it.
> - Drop one of the two blank lines left in pstore_post_reboot_tests
>   where ksft_skip was defined.
> - Rewrite the message: the existing check tests the exit status of
>   cat, not the value it reads, which is why it passes on an
>   unregistered backend. "latter" -> "later".
> - Cut the comment above the check to one line.
> 
> [...]

Applied to branch-rh10-6.12.0-211.52.1.22.x.vz10-ovz, will be released in rh10-6.12.0-211.52.1.22.4.vz10, thanks!

[1/2] selftests: pstore: skip when no backend is registered
      https://bitbucket.org/virtuozzocore/vzkernel.vzs/commits/bfcab3ff8e07
[2/2] selftests: pstore: skip the frontends the kernel does not have
      https://bitbucket.org/virtuozzocore/vzkernel.vzs/commits/03a6f36081f7

-- 
Konstantin Khorenko <khorenko@virtuozzo.com>

_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel

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

end of thread, other threads:[~2026-09-25 14:58 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-25 13:18 [Devel] [PATCH hci-8.1 v3 0/2] selftests: pstore: fix backend/frontend skip Eva Kurchatova
2026-09-25 13:18 ` [Devel] [PATCH hci-8.1 v3 1/2] selftests: pstore: skip when no backend is registered Eva Kurchatova
2026-09-25 13:18 ` [Devel] [PATCH hci-8.1 v3 2/2] selftests: pstore: skip the frontends the kernel does not have Eva Kurchatova
2026-09-25 14:57 ` [Devel] [PATCH hci-8.1 v3 0/2] selftests: pstore: fix backend/frontend skip Konstantin Khorenko

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox