unofficial mirror of libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Kurt Kanzenbach via Libc-alpha <libc-alpha@sourceware.org>
To: libc-alpha@sourceware.org
Cc: Florian Weimer <fweimer@redhat.com>,
	Sebastian Andrzej Siewior <bigeasy@linutronix.de>,
	Kurt Kanzenbach <kurt@linutronix.de>,
	Peter Zijlstra <peterz@infradead.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	Joseph Myers <joseph@codesourcery.com>
Subject: [PATCH v1 5/6] nptl: mutex-test5: Include CLOCK_MONOTONIC for PI
Date: Fri, 25 Jun 2021 10:11:03 +0200	[thread overview]
Message-ID: <20210625081104.1134598-6-kurt@linutronix.de> (raw)
In-Reply-To: <20210625081104.1134598-1-kurt@linutronix.de>

pthread_mutex_clocklock(MONOTONIC)/PI is now supported.

Adjust the test accordingly.

Signed-off-by: Kurt Kanzenbach <kurt@linutronix.de>
---
 sysdeps/pthread/tst-mutex5.c | 20 ++++++++++++++------
 1 file changed, 14 insertions(+), 6 deletions(-)

diff --git a/sysdeps/pthread/tst-mutex5.c b/sysdeps/pthread/tst-mutex5.c
index 7dc5331cfc08..6ad50f845601 100644
--- a/sysdeps/pthread/tst-mutex5.c
+++ b/sysdeps/pthread/tst-mutex5.c
@@ -77,11 +77,21 @@ do_test_clock (clockid_t clockid, const char *fnname)
                                              make_timespec (2, 0));
 
   if (clockid == CLOCK_USE_TIMEDLOCK)
-    TEST_COMPARE (pthread_mutex_timedlock (&m, &ts_timeout), ETIMEDOUT);
+    {
+      err = pthread_mutex_timedlock (&m, &ts_timeout);
+      TEST_COMPARE (err, ETIMEDOUT);
+    }
   else
-    TEST_COMPARE (pthread_mutex_clocklock (&m, clockid, &ts_timeout),
-		  ETIMEDOUT);
-  TEST_TIMESPEC_BEFORE_NOW (ts_timeout, clockid_for_get);
+    {
+      err = pthread_mutex_clocklock (&m, clockid, &ts_timeout);
+
+      /* In case of CLOCK_MONOTONIC the error might be EINVAL if CLOCK_MONOTONIC
+         is not supported. */
+      TEST_VERIFY (err == ETIMEDOUT ||
+		   (clockid == CLOCK_MONOTONIC && err == EINVAL));
+    }
+  if (err == ETIMEDOUT)
+    TEST_TIMESPEC_BEFORE_NOW (ts_timeout, clockid_for_get);
 
   /* The following makes the ts value invalid.  */
   ts_timeout.tv_nsec += 1000000000;
@@ -122,9 +132,7 @@ static int do_test (void)
 
   do_test_clock (CLOCK_USE_TIMEDLOCK, "timedlock");
   do_test_clock (CLOCK_REALTIME, "clocklock(realtime)");
-#ifndef ENABLE_PI
   do_test_clock (CLOCK_MONOTONIC, "clocklock(monotonic)");
-#endif
   return 0;
 }
 
-- 
2.30.2


  parent reply	other threads:[~2021-06-25  8:16 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-25  8:10 [PATCH v1 0/6] nptl: Introduce and use FUTEX_LOCK_PI2 Kurt Kanzenbach via Libc-alpha
2021-06-25  8:10 ` [PATCH v1 1/6] Linux: Add FUTEX_LOCK_PI2 Kurt Kanzenbach via Libc-alpha
2021-07-09 13:32   ` Adhemerval Zanella via Libc-alpha
2021-06-25  8:11 ` [PATCH v1 2/6] nptl: Introduce futex_lock_pi2() Kurt Kanzenbach via Libc-alpha
2021-07-09 14:13   ` Adhemerval Zanella via Libc-alpha
2021-06-25  8:11 ` [PATCH v1 3/6] nptl: Use futex_lock_pi2() Kurt Kanzenbach via Libc-alpha
2021-07-09 14:21   ` Adhemerval Zanella via Libc-alpha
2021-06-25  8:11 ` [PATCH v1 4/6] nptl: Remove mutex test 10 Kurt Kanzenbach via Libc-alpha
2021-07-09 14:23   ` Adhemerval Zanella via Libc-alpha
2021-06-25  8:11 ` Kurt Kanzenbach via Libc-alpha [this message]
2021-06-25  8:11 ` [PATCH v1 6/6] nptl: mutex-test9: Include CLOCK_MONOTONIC for PI Kurt Kanzenbach via Libc-alpha
2021-07-09  6:57 ` [PATCH v1 0/6] nptl: Introduce and use FUTEX_LOCK_PI2 Kurt Kanzenbach via Libc-alpha
2021-07-09 13:30 ` Adhemerval Zanella via Libc-alpha
2021-07-09 14:20   ` Kurt Kanzenbach via Libc-alpha

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

  List information: https://www.gnu.org/software/libc/involved.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210625081104.1134598-6-kurt@linutronix.de \
    --to=libc-alpha@sourceware.org \
    --cc=bigeasy@linutronix.de \
    --cc=fweimer@redhat.com \
    --cc=joseph@codesourcery.com \
    --cc=kurt@linutronix.de \
    --cc=peterz@infradead.org \
    --cc=tglx@linutronix.de \
    /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).