From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS3215 2.6.0.0/16 X-Spam-Status: No, score=-4.2 required=3.0 tests=AWL,BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED,SPF_HELO_PASS,SPF_PASS shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by dcvr.yhbt.net (Postfix) with ESMTPS id B3A551F8C6 for ; Fri, 25 Jun 2021 08:16:23 +0000 (UTC) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id EE55D39C0517 for ; Fri, 25 Jun 2021 08:16:22 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org EE55D39C0517 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1624608983; bh=UvF8nGdqSn4dQJJFpdR8rkf91XYKCqnWQd+7pdlhGtE=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=wtB2OOa308Ugib1flOaQ6jPnk7ZJRhahiILGlsuEY4i9aZUuSeRlsdJCeM8MViEhP PPlHewRhd/VzZfur6OzJ9xXQ42Fkm7POdO2ZGoMuJunB4p41bdm/DBwhsJB+YU43VO 17+nvDlhUq3tmIwSzMBClWy8j3DUaChazFuuIGdA= Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by sourceware.org (Postfix) with ESMTPS id 55AED39BF486 for ; Fri, 25 Jun 2021 08:11:30 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 55AED39BF486 To: libc-alpha@sourceware.org Subject: [PATCH v1 5/6] nptl: mutex-test5: Include CLOCK_MONOTONIC for PI Date: Fri, 25 Jun 2021 10:11:03 +0200 Message-Id: <20210625081104.1134598-6-kurt@linutronix.de> In-Reply-To: <20210625081104.1134598-1-kurt@linutronix.de> References: <20210625081104.1134598-1-kurt@linutronix.de> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Kurt Kanzenbach via Libc-alpha Reply-To: Kurt Kanzenbach Cc: Florian Weimer , Sebastian Andrzej Siewior , Kurt Kanzenbach , Peter Zijlstra , Thomas Gleixner , Joseph Myers Errors-To: libc-alpha-bounces+e=80x24.org@sourceware.org Sender: "Libc-alpha" pthread_mutex_clocklock(MONOTONIC)/PI is now supported. Adjust the test accordingly. Signed-off-by: Kurt Kanzenbach --- 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