From patchwork Thu May 20 12:50:41 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Wakely X-Patchwork-Id: 1481608 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=sourceware.org; envelope-from=gcc-patches-bounces@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.a=rsa-sha256 header.s=default header.b=nF7+EAic; dkim-atps=neutral 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 ozlabs.org (Postfix) with ESMTPS id 4Fm8jn5x8Wz9t1C for ; Thu, 20 May 2021 22:50:53 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 72E7A385481F; Thu, 20 May 2021 12:50:51 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 72E7A385481F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1621515051; bh=ikviOCgoF6Lr0vVSYYA5yAm3mypoEDHOjcHHGSa6m/w=; h=Date:To:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:Cc:From; b=nF7+EAicUE+bz6PJD2ruE4Ga/d/rWyCLhPyT3ZrQx2BHC5nar4wZCsMuhte3vsagV wT0M0LWUsrVAjn2U/Vsjm+W8UHaqPS9w4+OuqfyBcAtqM03yS4AfG8IyvMm9B2T8fv RUEqV0UtDDYAsfqcGi2ozBTMn88wrxjc82S7txq4= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by sourceware.org (Postfix) with ESMTP id E458E3951C4C for ; Thu, 20 May 2021 12:50:48 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org E458E3951C4C Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-261-Pe6UgPUSM8acJ8cmiG_nWg-1; Thu, 20 May 2021 08:50:45 -0400 X-MC-Unique: Pe6UgPUSM8acJ8cmiG_nWg-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id E742C107ACC7; Thu, 20 May 2021 12:50:42 +0000 (UTC) Received: from localhost (unknown [10.33.36.7]) by smtp.corp.redhat.com (Postfix) with ESMTP id 928885D761; Thu, 20 May 2021 12:50:42 +0000 (UTC) Date: Thu, 20 May 2021 13:50:41 +0100 To: gcc-patches@gcc.gnu.org Subject: [PATCH] testsuite: Use libstdc++ macro to check for pthread_cond_clockwait [PR 100655] Message-ID: MIME-Version: 1.0 X-Clacks-Overhead: GNU Terry Pratchett X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline X-Spam-Status: No, score=-14.1 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Jonathan Wakely via Gcc-patches From: Jonathan Wakely Reply-To: Jonathan Wakely Cc: Jakub Jelinek Errors-To: gcc-patches-bounces@gcc.gnu.org Sender: "Gcc-patches" Also add dg-shouldfail to ignore failures due to ulimit. gcc/testsuite/ChangeLog: PR testsuite/100655 * g++.dg/tsan/pthread_cond_clockwait.C: Use libstdc++ macro to check for availability of pthread_cond_clockwait. Add dg-shouldfail. Tested x86_64-linux (glibc 2.23) and powerpc64le-linux (glibc 2.17) OK for trunk? commit 86f5ac3b64a98280df6f0ea407eea8cde7c2edbd Author: Jonathan Wakely Date: Thu May 20 12:40:07 2021 testsuite: Use libstdc++ macro to check for pthread_cond_clockwait [PR 100655] Also add dg-shouldfail to ignore failures due to ulimit. gcc/testsuite/ChangeLog: PR testsuite/100655 * g++.dg/tsan/pthread_cond_clockwait.C: Use libstdc++ macro to check for availability of pthread_cond_clockwait. Add dg-shouldfail. diff --git a/gcc/testsuite/g++.dg/tsan/pthread_cond_clockwait.C b/gcc/testsuite/g++.dg/tsan/pthread_cond_clockwait.C index 82d6a5c8329..c6c621bea51 100644 --- a/gcc/testsuite/g++.dg/tsan/pthread_cond_clockwait.C +++ b/gcc/testsuite/g++.dg/tsan/pthread_cond_clockwait.C @@ -1,9 +1,14 @@ // Test pthread_cond_clockwait not generating false positives with tsan +/* { dg-shouldfail "tsan" } */ // { dg-do run { target { { *-*-linux* *-*-gnu* *-*-uclinux* } && pthread } } } // { dg-options "-fsanitize=thread -lpthread" } #include +// Include this to get the libstdc++ _GLIBCXX_USE_PTHREAD_COND_CLOCKWAIT +// macro that indicates pthread_cond_clockwait is available. +#include + pthread_cond_t cv; pthread_mutex_t mtx; @@ -23,7 +28,9 @@ int main() { struct timespec ts; clock_gettime(CLOCK_MONOTONIC, &ts); ts.tv_sec += 10; +#ifdef _GLIBCXX_USE_PTHREAD_COND_CLOCKWAIT pthread_cond_clockwait(&cv, &mtx, CLOCK_MONOTONIC, &ts); +#endif pthread_mutex_unlock(&mtx); pthread_join(tid, NULL);