public inbox for glibc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Stefan Liebler <stli@sourceware.org>
To: glibc-cvs@sourceware.org
Subject: [glibc] tst-process_madvise: Check process_madvise-syscall support.
Date: Thu, 11 Aug 2022 10:23:17 +0000 (GMT)	[thread overview]
Message-ID: <20220811102317.8F5AC3858429@sourceware.org> (raw)

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=11f09947f3066f5ff84fd15ef22b72b46eea97a8

commit 11f09947f3066f5ff84fd15ef22b72b46eea97a8
Author: Stefan Liebler <stli@linux.ibm.com>
Date:   Thu Aug 11 09:47:46 2022 +0200

    tst-process_madvise: Check process_madvise-syscall support.
    
    So far this test checks if pidfd_open-syscall is supported,
    which was introduced with linux 5.3.
    
    The process_madvise-syscall was introduced with linux 5.10.
    Thus you'll get FAILs if you are running a kernel in between.
    
    This patch adds a check if the first process_madvise-syscall
    returns ENOSYS and in this case will fail with UNSUPPORTED.
    Reviewed-by: Florian Weimer <fweimer@redhat.com>

Diff:
---
 sysdeps/unix/sysv/linux/tst-process_madvise.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/sysdeps/unix/sysv/linux/tst-process_madvise.c b/sysdeps/unix/sysv/linux/tst-process_madvise.c
index a674e80b76..3b032ddefc 100644
--- a/sysdeps/unix/sysv/linux/tst-process_madvise.c
+++ b/sysdeps/unix/sysv/linux/tst-process_madvise.c
@@ -101,8 +101,11 @@ do_test (void)
 
     /* We expect this to succeed in the target process because the mapping
        is valid.  */
-    TEST_COMPARE (process_madvise (pidfd, &iv, 1, MADV_COLD, 0),
-		  2 * page_size);
+    ssize_t ret = process_madvise (pidfd, &iv, 1, MADV_COLD, 0);
+    if (ret == -1 && errno == ENOSYS)
+      FAIL_UNSUPPORTED ("kernel does not support process_madvise, skipping"
+			"test");
+    TEST_COMPARE (ret, 2 * page_size);
   }
 
   {


                 reply	other threads:[~2022-08-11 10:23 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20220811102317.8F5AC3858429@sourceware.org \
    --to=stli@sourceware.org \
    --cc=glibc-cvs@sourceware.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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).