selftests: arm64: Fix redundancy of a testcase
PATCH 1/1 selftests: arm64: Fix redundancy of a testcase
Currently, we are writing the same value as we read, into the TLS register; hence, we cannot confirm updation of the register, making the testcase "verify_tpidr_one" redundant. Fix this; while at it, do a style change.
--- tools/testing/selftests/arm64/abi/ptrace.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
tools/testing/selftests/arm64/abi/ptrace.c +2 -2
@@ -47,7 +47,7 @@ static void test_tpidr(pid_t child)/* ...write a new value.. */ write_iov.iov_len =sizeof (uint64_t ); - write_val[0 ] = read_val[0 ]++; + write_val[0 ] = read_val[0 ] +1 ; ret =ptrace (PTRACE_SETREGSET , child,NT_ARM_TLS , &write_iov);ksft_test_result (ret ==0 ,"write_tpidr_one\n" );
@@ -108,7 +108,7 @@ static void test_tpidr(pid_t child)/* Writing only TPIDR... */ write_iov.iov_len =sizeof (uint64_t );memcpy (write_val, read_val,sizeof (read_val)); - write_val[0 ] +=1 ; + ++write_val[0 ]; ret =ptrace (PTRACE_SETREGSET , child,NT_ARM_TLS , &write_iov);if (ret ==0 ) {
Signature · 1 line
2.39.2
Quoted 4 lines · Dev Jain
Currently, we are writing the same value as we read, into the TLS register; hence, we cannot confirm updation of the register, making the testcase "
verify_tpidr_one" redundant. Fix this; while at it, do a style change.
Please don't combine unrelated changes into a single patch.
tools/testing/selftests/arm64/abi/ptrace.c static void test_tpidr(pid_t child) · line 52
Quoted 6 lines
tools/testing/selftests/arm64/abi/ptrace.c +1
-1/* ...write a new value.. */ write_iov.iov_len =sizeof (uint64_t ); - write_val[0 ] = read_val[0 ]++; + write_val[0 ] = read_val[0 ] +1 ; ret =ptrace (PTRACE_SETREGSET , child,NT_ARM_TLS , &write_iov);ksft_test_result (ret ==0 ,"write_tpidr_one\n" );
This is a good fix:
tools/testing/selftests/arm64/abi/ptrace.c static void test_tpidr(pid_t child) · line 111
Quoted 6 lines
tools/testing/selftests/arm64/abi/ptrace.c +1
-1@@ -108,7 +108,7 @@ static void test_tpidr(pid_t child)/* Writing only TPIDR... */ write_iov.iov_len =sizeof (uint64_t );memcpy (write_val, read_val,sizeof (read_val)); - write_val[0 ] +=1 ; + ++write_val[0 ];
I'm less convinced that this is a good style change.
Quoted 6 lines · Mark Brown
Quoted 4 lines · Dev Jain
Currently, we are writing the same value as we read, into the TLS register; hence, we cannot confirm updation of the register, making the testcase "
verify_tpidr_one" redundant. Fix this; while at it, do a style change.Please don't combine unrelated changes into a single patch.
I shall take care of that in the future.
Quoted 10 lines
tools/testing/selftests/arm64/abi/ptrace.c static void test_tpidr(pid_t child) · line 52
Quoted 7 lines
/* ...write a new value.. */ write_iov.iov_len = sizeof(uint64_t);tools/testing/selftests/arm64/abi/ptrace.c +1
-1- write_val[0 ] = read_val[0 ]++; + write_val[0 ] = read_val[0 ] +1 ; ret =ptrace (PTRACE_SETREGSET , child,NT_ARM_TLS , &write_iov);ksft_test_result (ret ==0 ,"write_tpidr_one\n" );This is a good fix:
Reviewed-by Mark Brown <[email protected]>
Thanks!
Quoted 8 lines
tools/testing/selftests/arm64/abi/ptrace.c static void test_tpidr(pid_t child) · line 111
Quoted 7 lines
tools/testing/selftests/arm64/abi/ptrace.c +1
-1@@ -108,7 +108,7 @@ static void test_tpidr(pid_t child)/* Writing only TPIDR... */ write_iov.iov_len =sizeof (uint64_t );memcpy (write_val, read_val,sizeof (read_val)); - write_val[0 ] +=1 ; + ++write_val[0 ];I'm less convinced that this is a good style change.
Well, what I have seen usually is, when we add 1, we
use prefix/postfix increment, and do a "+=" when it
is not 1. But, I get your point: such style may confuse
people into thinking that we are doing an index/pointer
increment, since that is the usual usecase for this.
Catalin Marinas
maintainerQuoted 6 lines · Dev Jain
Currently, we are writing the same value as we read, into the TLS register; hence, we cannot confirm updation of the register, making the testcase "
verify_tpidr_one" redundant. Fix this; while at it, do a style change.
Applied to arm64 (for-next/kselftest), thanks! I removed the increment style change.
[1/1] selftests: arm64: Fix redundancy of a testcase
https://git.kernel.org/arm64/c/031d1f20d5db
Signature · 1 line
Catalin