On 7/2/26 08:23, Hongfu Li wrote:
> Move pkey selftest debugging helpers into shared code so both pkey
> selftests can use the same tracing and abort-hook logic. Also fix
> cat_into_file() to print file, not str, in the open() failure message.
> 
> Signed-off-by: Hongfu Li <[email protected]>
> Acked-by: Mike Rapoport (Microsoft) <[email protected]>
> Acked-by: Liam R. Howlett (Oracle) <[email protected]>
> Reviewed-by: Kevin Brodsky <[email protected]>
> Tested-by: Kevin Brodsky <[email protected]>
> ---
>  tools/testing/selftests/mm/pkey-helpers.h    |  4 +-
>  tools/testing/selftests/mm/pkey_util.c       | 90 ++++++++++++++++++++
>  tools/testing/selftests/mm/protection_keys.c | 87 -------------------
>  3 files changed, 93 insertions(+), 88 deletions(-)
> 
> diff --git a/tools/testing/selftests/mm/pkey-helpers.h 
> b/tools/testing/selftests/mm/pkey-helpers.h
> index 2c377f4e9df1..46a8a1878dc1 100644
> --- a/tools/testing/selftests/mm/pkey-helpers.h
> +++ b/tools/testing/selftests/mm/pkey-helpers.h
> @@ -68,7 +68,9 @@ static inline void sigsafe_printf(const char *format, ...)
>  #define dprintf3(args...) dprintf_level(3, args)
>  #define dprintf4(args...) dprintf_level(4, args)
>  
> -extern void abort_hooks(void);
> +void tracing_on(void);
> +void tracing_off(void);
> +void abort_hooks(void);
>  #define pkey_assert(condition) do {          \
>       if (!(condition)) {                     \
>               dprintf0("# assert() at %s::%d test_nr: %d iteration: %d\n", \
> diff --git a/tools/testing/selftests/mm/pkey_util.c 
> b/tools/testing/selftests/mm/pkey_util.c
> index 255b332f7a08..fbef3cd45447 100644
> --- a/tools/testing/selftests/mm/pkey_util.c
> +++ b/tools/testing/selftests/mm/pkey_util.c
> @@ -2,9 +2,99 @@
>  #define __SANE_USERSPACE_TYPES__
>  #include <sys/syscall.h>
>  #include <unistd.h>
> +#include <fcntl.h>
> +#include <stdio.h>
> +#include <string.h>
>  
>  #include "pkey-helpers.h"
>  
> +int iteration_nr = 1;
> +int test_nr;
> +int dprint_in_signal;
> +
> +#if CONTROL_TRACING > 0

Who sets that CONTROL_TRACING? And if it's nobody, why are we dragging this 
along?

-- 
Cheers,

David

Reply via email to