From: Marcos Paulo de Souza <mpdesouza@suse.com>
To: Josh Poimboeuf <jpoimboe@kernel.org>,
Jiri Kosina <jikos@kernel.org>, Miroslav Benes <mbenes@suse.cz>,
Petr Mladek <pmladek@suse.com>,
Joe Lawrence <joe.lawrence@redhat.com>,
Shuah Khan <shuah@kernel.org>
Cc: live-patching@vger.kernel.org, linux-kselftest@vger.kernel.org,
linux-kernel@vger.kernel.org,
Marcos Paulo de Souza <mpdesouza@suse.com>,
marcos@mpdesouza.com
Subject: [PATCH v5 3/6] selftests: livepatch: Introduce does_sysfs_exist function
Date: Mon, 04 May 2026 15:34:44 -0300 [thread overview]
Message-ID: <20260504-lp-tests-old-fixes-v5-3-0be26d94ab9a@suse.com> (raw)
In-Reply-To: <20260504-lp-tests-old-fixes-v5-0-0be26d94ab9a@suse.com>
Returns true if the livepatch sysfs attribute exists, and false otherwise.
This new function will be used in the next patches.
Signed-off-by: Marcos Paulo de Souza <mpdesouza@suse.com>
---
tools/testing/selftests/livepatch/functions.sh | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/tools/testing/selftests/livepatch/functions.sh b/tools/testing/selftests/livepatch/functions.sh
index 8ec0cb64ad94..2bc50271729c 100644
--- a/tools/testing/selftests/livepatch/functions.sh
+++ b/tools/testing/selftests/livepatch/functions.sh
@@ -339,6 +339,16 @@ function check_result {
fi
}
+# does_sysfs_exist(modname, attr) - check sysfs attribute existence
+# modname - livepatch module creating the sysfs interface
+# attr - attribute name to be checked
+function does_sysfs_exist() {
+ local mod="$1"; shift
+ local attr="$1"; shift
+
+ [[ -f "$SYSFS_KLP_DIR/$mod/$attr" ]]
+}
+
# check_sysfs_rights(modname, rel_path, expected_rights) - check sysfs
# path permissions
# modname - livepatch module creating the sysfs interface
--
2.54.0
next prev parent reply other threads:[~2026-05-04 18:35 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-04 18:34 [PATCH v5 0/6] kselftests: livepatch: Adapt tests to be executed on 4.12 kernels Marcos Paulo de Souza
2026-05-04 18:34 ` [PATCH v5 1/6] selftests: livepatch: Check for ARCH_HAS_SYSCALL_WRAPPER config Marcos Paulo de Souza
2026-05-04 18:34 ` [PATCH v5 2/6] selftests: livepatch: Replace true/false module parameter by y/n Marcos Paulo de Souza
2026-05-04 18:34 ` Marcos Paulo de Souza [this message]
2026-05-04 18:34 ` [PATCH v5 4/6] selftests: livepatch: Check if patched sysfs attribute exists Marcos Paulo de Souza
2026-05-04 18:34 ` [PATCH v5 5/6] selftests: livepatch: Check if replace " Marcos Paulo de Souza
2026-05-04 18:34 ` [PATCH v5 6/6] selftests: livepatch: Check if stack_order " Marcos Paulo de Souza
2026-05-04 20:43 ` [PATCH v5 0/6] kselftests: livepatch: Adapt tests to be executed on 4.12 kernels Joe Lawrence
2026-05-06 10:23 ` Petr Mladek
2026-05-06 12:26 ` Petr Mladek
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260504-lp-tests-old-fixes-v5-3-0be26d94ab9a@suse.com \
--to=mpdesouza@suse.com \
--cc=jikos@kernel.org \
--cc=joe.lawrence@redhat.com \
--cc=jpoimboe@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=live-patching@vger.kernel.org \
--cc=marcos@mpdesouza.com \
--cc=mbenes@suse.cz \
--cc=pmladek@suse.com \
--cc=shuah@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox