Re: [PATCH] selftests/mm: Specify requirement for PROC_MEM_ALWAYS_FORCE=y
From: Mark Brown
Date: Fri Apr 17 2026 - 07:24:39 EST
On Thu, Apr 16, 2026 at 10:28:29PM +0300, Mike Rapoport wrote:
> But sure graceful skips are better than failing the entire tests. Would be
> something like this:
> @@ -622,10 +621,17 @@ static void test_prot_none(void)
> + mem_fd = open("/proc/self/mem", O_RDWR);
> + if (mem_fd < 0) {
> + ksft_test_result_skip("opening /proc/self/mem failed\n");
> + return;
> + }
> +
The string reported in ksft_test_result_*() is the name of the test, it
should be the same name as is used for pass or fail. This is used to
correlate test results between runs. The error should be logged with a
separate print, in this case ksft_perror() is probably a good choice.
> {
> - mem_fd = open("/proc/self/mem", O_RDWR);
> - if (mem_fd < 0)
> - ksft_exit_fail_msg("opening /proc/self/mem failed\n");
Yes, this is a preexisting bug in the test which I see there are more
instances of :(
> --- a/tools/testing/selftests/mm/mkdirty.c
> +++ b/tools/testing/selftests/mm/mkdirty.c
> static void test_ptrace_write(void)
> {
> char data = 1;
> + int mem_fd;
> char *mem;
> int ret;
>
> ksft_print_msg("[INFO] PTRACE write access\n");
>
> + mem_fd = open("/proc/self/mem", O_RDWR);
> + if (mem_fd < 0) {
> + ksft_test_result_skip("opening /proc/self/mem failed\n");
> + return;
> + }
Same with mkdirty.
Attachment:
signature.asc
Description: PGP signature