[PATCH v4 1/3] selftests: livepatch: rename KLP_SYSFS_DIR to SYSFS_KLP_DIR

Michael Vetter posted 3 patches 1 month, 4 weeks ago
There is a newer version of this series
[PATCH v4 1/3] selftests: livepatch: rename KLP_SYSFS_DIR to SYSFS_KLP_DIR
Posted by Michael Vetter 1 month, 4 weeks ago
This naming makes more sense according to the directory structure.
Especially when we later add more paths.

Signed-off-by: Michael Vetter <mvetter@suse.com>
---
 tools/testing/selftests/livepatch/functions.sh | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/tools/testing/selftests/livepatch/functions.sh b/tools/testing/selftests/livepatch/functions.sh
index fc4c6a016d38..50361fceff06 100644
--- a/tools/testing/selftests/livepatch/functions.sh
+++ b/tools/testing/selftests/livepatch/functions.sh
@@ -6,7 +6,7 @@
 
 MAX_RETRIES=600
 RETRY_INTERVAL=".1"	# seconds
-KLP_SYSFS_DIR="/sys/kernel/livepatch"
+SYSFS_KLP_DIR="/sys/kernel/livepatch"
 
 # Kselftest framework requirement - SKIP code is 4
 ksft_skip=4
@@ -322,7 +322,7 @@ function check_sysfs_rights() {
 	local rel_path="$1"; shift
 	local expected_rights="$1"; shift
 
-	local path="$KLP_SYSFS_DIR/$mod/$rel_path"
+	local path="$SYSFS_KLP_DIR/$mod/$rel_path"
 	local rights=$(/bin/stat --format '%A' "$path")
 	if test "$rights" != "$expected_rights" ; then
 		die "Unexpected access rights of $path: $expected_rights vs. $rights"
@@ -338,7 +338,7 @@ function check_sysfs_value() {
 	local rel_path="$1"; shift
 	local expected_value="$1"; shift
 
-	local path="$KLP_SYSFS_DIR/$mod/$rel_path"
+	local path="$SYSFS_KLP_DIR/$mod/$rel_path"
 	local value=`cat $path`
 	if test "$value" != "$expected_value" ; then
 		die "Unexpected value in $path: $expected_value vs. $value"
-- 
2.46.1
Re: [PATCH v4 1/3] selftests: livepatch: rename KLP_SYSFS_DIR to SYSFS_KLP_DIR
Posted by Miroslav Benes 1 month, 3 weeks ago
Hi,

On Mon, 30 Sep 2024, Michael Vetter wrote:

> This naming makes more sense according to the directory structure.
> Especially when we later add more paths.
> 
> Signed-off-by: Michael Vetter <mvetter@suse.com>
> ---
>  tools/testing/selftests/livepatch/functions.sh | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/tools/testing/selftests/livepatch/functions.sh b/tools/testing/selftests/livepatch/functions.sh
> index fc4c6a016d38..50361fceff06 100644
> --- a/tools/testing/selftests/livepatch/functions.sh
> +++ b/tools/testing/selftests/livepatch/functions.sh
> @@ -6,7 +6,7 @@
>  
>  MAX_RETRIES=600
>  RETRY_INTERVAL=".1"	# seconds
> -KLP_SYSFS_DIR="/sys/kernel/livepatch"
> +SYSFS_KLP_DIR="/sys/kernel/livepatch"
>  
>  # Kselftest framework requirement - SKIP code is 4
>  ksft_skip=4
> @@ -322,7 +322,7 @@ function check_sysfs_rights() {
>  	local rel_path="$1"; shift
>  	local expected_rights="$1"; shift
>  
> -	local path="$KLP_SYSFS_DIR/$mod/$rel_path"
> +	local path="$SYSFS_KLP_DIR/$mod/$rel_path"
>  	local rights=$(/bin/stat --format '%A' "$path")
>  	if test "$rights" != "$expected_rights" ; then
>  		die "Unexpected access rights of $path: $expected_rights vs. $rights"
> @@ -338,7 +338,7 @@ function check_sysfs_value() {
>  	local rel_path="$1"; shift
>  	local expected_value="$1"; shift
>  
> -	local path="$KLP_SYSFS_DIR/$mod/$rel_path"
> +	local path="$SYSFS_KLP_DIR/$mod/$rel_path"
>  	local value=`cat $path`
>  	if test "$value" != "$expected_value" ; then
>  		die "Unexpected value in $path: $expected_value vs. $value"

I am sorry I was not explicit enough previously. There are still 
/sys/kernel/livepatch occurrences in tools/testing/selftest/livepatch/ 
which can be replaced with this new variable. They are there for quite 
some time but it would be really nice if you could replace them all to 
make it consistent since you are touching it.

Thank you,
Miroslav