OpenVZ / Virtuozzo kernel development (devel@openvz.org)
 help / color / mirror / Atom feed
* [Devel] [PATCH vz10 v2 1/2] selftests: pstore: skip when no backend is registered
@ 2026-09-10  3:17 Eva Kurchatova
  2026-09-10  3:17 ` [Devel] [PATCH vz10 v2 2/2] selftests: pstore: skip the frontends the kernel does not have Eva Kurchatova
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Eva Kurchatova @ 2026-09-10  3:17 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.

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       | 15 +++++++++++++--
 .../selftests/pstore/pstore_post_reboot_tests     |  2 --
 2 files changed, 13 insertions(+), 4 deletions(-)

diff --git a/tools/testing/selftests/pstore/common_tests b/tools/testing/selftests/pstore/common_tests
index 4509f0cc9c91..71cd4473f45a 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,8 +76,17 @@ 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 $?
+# A tristate pstore leaves no parameter file at all when it is not built
+# or not loaded, and an unregistered backend reads back as "(null)".
+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
+show_result 0
 prlog -e "\tbackend=${backend}"
 prlog -e "\tcmdline=`cat /proc/cmdline`"
 if [ $rc -ne 0 ]; then
diff --git a/tools/testing/selftests/pstore/pstore_post_reboot_tests b/tools/testing/selftests/pstore/pstore_post_reboot_tests
index d6da5e86efbf..a5464407f5b2 100755
--- a/tools/testing/selftests/pstore/pstore_post_reboot_tests
+++ b/tools/testing/selftests/pstore/pstore_post_reboot_tests
@@ -7,8 +7,6 @@
 #  Written by Hiraku Toyooka <hiraku.toyooka.gu@hitachi.com>
 #
 
-# Kselftest framework requirement - SKIP code is 4.
-ksft_skip=4
 
 . ./common_tests
 
-- 
2.55.0

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

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

* [Devel] [PATCH vz10 v2 2/2] selftests: pstore: skip the frontends the kernel does not have
  2026-09-10  3:17 [Devel] [PATCH vz10 v2 1/2] selftests: pstore: skip when no backend is registered Eva Kurchatova
@ 2026-09-10  3:17 ` Eva Kurchatova
  2026-09-23 18:37   ` Konstantin Khorenko
  2026-09-23 18:03 ` [Devel] [PATCH vz10 v2 1/2] selftests: pstore: skip when no backend is registered Konstantin Khorenko
  2026-09-23 18:37 ` Konstantin Khorenko
  2 siblings, 1 reply; 5+ messages in thread
From: Eva Kurchatova @ 2026-09-10  3:17 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>
---
 tools/testing/selftests/pstore/pstore_tests | 20 ++++++++++++++------
 1 file changed, 14 insertions(+), 6 deletions(-)

diff --git a/tools/testing/selftests/pstore/pstore_tests b/tools/testing/selftests/pstore/pstore_tests
index 2aa9a3852a84..9674bcace942 100755
--- a/tools/testing/selftests/pstore/pstore_tests
+++ b/tools/testing/selftests/pstore/pstore_tests
@@ -9,13 +9,22 @@
 
 . ./common_tests
 
+# The console and pmsg frontends are separate options from the backend, so
+# a kernel can register a backend and still have neither.  Report what is
+# missing instead of failing over it.
 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 +32,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] 5+ messages in thread

* Re: [Devel] [PATCH vz10 v2 1/2] selftests: pstore: skip when no backend is registered
  2026-09-10  3:17 [Devel] [PATCH vz10 v2 1/2] selftests: pstore: skip when no backend is registered Eva Kurchatova
  2026-09-10  3:17 ` [Devel] [PATCH vz10 v2 2/2] selftests: pstore: skip the frontends the kernel does not have Eva Kurchatova
@ 2026-09-23 18:03 ` Konstantin Khorenko
  2026-09-23 18:37 ` Konstantin Khorenko
  2 siblings, 0 replies; 5+ messages in thread
From: Konstantin Khorenko @ 2026-09-23 18:03 UTC (permalink / raw)
  To: Eva Kurchatova; +Cc: devel

changelog?

--
Best regards,

Konstantin Khorenko,
Virtuozzo Linux Kernel Team

On 9/10/26 05:17, Eva Kurchatova wrote:
> An unregistered pstore backend reads back "(null)", and every latter
> check fails. This also contradicts the pstore_crash_test documentation.
> 
> 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       | 15 +++++++++++++--
>  .../selftests/pstore/pstore_post_reboot_tests     |  2 --
>  2 files changed, 13 insertions(+), 4 deletions(-)
> 
> diff --git a/tools/testing/selftests/pstore/common_tests b/tools/testing/selftests/pstore/common_tests
> index 4509f0cc9c91..71cd4473f45a 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,8 +76,17 @@ 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 $?
> +# A tristate pstore leaves no parameter file at all when it is not built
> +# or not loaded, and an unregistered backend reads back as "(null)".
> +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
> +show_result 0
>  prlog -e "\tbackend=${backend}"
>  prlog -e "\tcmdline=`cat /proc/cmdline`"
>  if [ $rc -ne 0 ]; then
> diff --git a/tools/testing/selftests/pstore/pstore_post_reboot_tests b/tools/testing/selftests/pstore/pstore_post_reboot_tests
> index d6da5e86efbf..a5464407f5b2 100755
> --- a/tools/testing/selftests/pstore/pstore_post_reboot_tests
> +++ b/tools/testing/selftests/pstore/pstore_post_reboot_tests
> @@ -7,8 +7,6 @@
>  #  Written by Hiraku Toyooka <hiraku.toyooka.gu@hitachi.com>
>  #
>  
> -# Kselftest framework requirement - SKIP code is 4.
> -ksft_skip=4
>  
>  . ./common_tests
>  

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

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

* Re: [Devel] [PATCH vz10 v2 2/2] selftests: pstore: skip the frontends the kernel does not have
  2026-09-10  3:17 ` [Devel] [PATCH vz10 v2 2/2] selftests: pstore: skip the frontends the kernel does not have Eva Kurchatova
@ 2026-09-23 18:37   ` Konstantin Khorenko
  0 siblings, 0 replies; 5+ messages in thread
From: Konstantin Khorenko @ 2026-09-23 18:37 UTC (permalink / raw)
  To: Eva Kurchatova; +Cc: devel

On Thu, 10 Sep 2026 06:17:53 +0300, Eva Kurchatova <eva.kurchatova@virtuozzo.com> wrote:
> 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.
> 
> [...]

Reviewed-by: Konstantin Khorenko <khorenko@virtuozzo.com>

-- 
Konstantin Khorenko <khorenko@virtuozzo.com>
_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel

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

* Re: [Devel] [PATCH vz10 v2 1/2] selftests: pstore: skip when no backend is registered
  2026-09-10  3:17 [Devel] [PATCH vz10 v2 1/2] selftests: pstore: skip when no backend is registered Eva Kurchatova
  2026-09-10  3:17 ` [Devel] [PATCH vz10 v2 2/2] selftests: pstore: skip the frontends the kernel does not have Eva Kurchatova
  2026-09-23 18:03 ` [Devel] [PATCH vz10 v2 1/2] selftests: pstore: skip when no backend is registered Konstantin Khorenko
@ 2026-09-23 18:37 ` Konstantin Khorenko
  2 siblings, 0 replies; 5+ messages in thread
From: Konstantin Khorenko @ 2026-09-23 18:37 UTC (permalink / raw)
  To: Eva Kurchatova; +Cc: devel

> An unregistered pstore backend reads back "(null)", and every latter

latter -> later

> check fails. This also contradicts the pstore_crash_test documentation.
> 
> 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>
>
> diff --git a/tools/testing/selftests/pstore/common_tests b/tools/testing/selftests/pstore/common_tests
> index 4509f0cc9c918..71cd4473f45a5 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,8 +76,17 @@ 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 $?
> +# A tristate pstore leaves no parameter file at all when it is not built
> +# or not loaded, and an unregistered backend reads back as "(null)".
> +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
> +show_result 0
>  prlog -e "\tbackend=${backend}"
>  prlog -e "\tcmdline=`cat /proc/cmdline`"
>  if [ $rc -ne 0 ]; then

After the patch and "show_result 0" $rc here cannot become 0.

  -show_result 0
  +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 d6da5e86efbf8..a5464407f5b21 100755
> --- a/tools/testing/selftests/pstore/pstore_post_reboot_tests
> +++ b/tools/testing/selftests/pstore/pstore_post_reboot_tests
> @@ -7,8 +7,6 @@
>  #  Written by Hiraku Toyooka <hiraku.toyooka.gu@hitachi.com>
>  #
>  
> -# Kselftest framework requirement - SKIP code is 4.
> -ksft_skip=4
>  

After remove, we have 2 empty lines here, drop one.

-- 
Konstantin Khorenko <khorenko@virtuozzo.com>
_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel

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

end of thread, other threads:[~2026-09-23 18:39 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-10  3:17 [Devel] [PATCH vz10 v2 1/2] selftests: pstore: skip when no backend is registered Eva Kurchatova
2026-09-10  3:17 ` [Devel] [PATCH vz10 v2 2/2] selftests: pstore: skip the frontends the kernel does not have Eva Kurchatova
2026-09-23 18:37   ` Konstantin Khorenko
2026-09-23 18:03 ` [Devel] [PATCH vz10 v2 1/2] selftests: pstore: skip when no backend is registered Konstantin Khorenko
2026-09-23 18:37 ` Konstantin Khorenko

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