[Devel] [PATCH vz10 v2 1/2] selftests: pstore: skip when no backend is registered
Konstantin Khorenko
khorenko at virtuozzo.com
Wed Sep 23 21:37:57 MSK 2026
> 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 at 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 at 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 at virtuozzo.com>
More information about the Devel
mailing list