From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 58208 invoked by alias); 15 Oct 2019 17:57:48 -0000 Mailing-List: contact libstdc++-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libstdc++-owner@gcc.gnu.org Received: (qmail 58190 invoked by uid 89); 15 Oct 2019 17:57:48 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-23.5 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,KAM_SHORT,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.1 spammy=091, HContent-Transfer-Encoding:8bit X-HELO: avasout04.plus.net Received: from avasout04.plus.net (HELO avasout04.plus.net) (212.159.14.19) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 15 Oct 2019 17:57:45 +0000 Received: from deneb ([80.229.24.9]) by smtp with ESMTP id KR4litK4G37rvKR4miYB1M; Tue, 15 Oct 2019 18:57:43 +0100 X-Clacks-Overhead: "GNU Terry Pratchett" X-CM-Score: 0.00 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mcrowe.com; s=20191005; h=Content-Transfer-Encoding:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=2bezVsELHskAs/McccT+CXuT9vIOvZXsGRtFOkMt2Mg=; b=mE1iN6tmlRMgTFk3FGUOKVQlQ7 WDqlzJLzq2khG/ynwUx6Wh7aEFAeWTijmkD1p3MAy03iTl/bLzRJVrgi8Gr01hh2BSvVvVyMEQdGy TBtAK/xgmfO/TPSxhi3glCk5oJVr0AVoWNA0LaNM3RTI1ewdQbP55pDpSZJg77nF8DK/kNuPFdKog tP+JHsZwcRO6xBMS97a18VLG6uvcXCj5XB7bdp8j7OimREq4ArPHM/q6ehuuhW3DSr0wr+RxwVlzq JLEtqHSivdp6BrB37pxHN8ohEAMR6jveuGzTf0lLiBzLRNHD5UOLiOMerlhQbYRXpaHkfSE66iHUU pj+hyceg==; Received: from mac by deneb with local (Exim 4.92) (envelope-from ) id 1iKR4k-0003qT-92; Tue, 15 Oct 2019 18:57:38 +0100 From: Mike Crowe To: libstdc++@gcc.gnu.org, gcc-patches@gcc.gnu.org Cc: Mike Crowe Subject: [PATCH v2 06/11] libstdc++ testsuite: Move slow_clock to its own header Date: Tue, 15 Oct 2019 17:57:00 -0000 Message-Id: In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-IsSubscribed: yes X-SW-Source: 2019-10/txt/msg00054.txt.bz2 Move slow_clock test class into a header file so that it can be used by other tests in the future. * testsuite/util/slow_clock.h: New file. Move implementation of slow_clock test class. * testsuite/30_threads/condition_variable/members/2.cc: Include slow_clock from header. --- libstdc++-v3/testsuite/30_threads/condition_variable/members/2.cc | 17 +---------------- libstdc++-v3/testsuite/util/slow_clock.h | 38 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 39 insertions(+), 16 deletions(-) create mode 100644 libstdc++-v3/testsuite/util/slow_clock.h diff --git a/libstdc++-v3/testsuite/30_threads/condition_variable/members/2.cc b/libstdc++-v3/testsuite/30_threads/condition_variable/members/2.cc index cbac3fa..f821d3f 100644 --- a/libstdc++-v3/testsuite/30_threads/condition_variable/members/2.cc +++ b/libstdc++-v3/testsuite/30_threads/condition_variable/members/2.cc @@ -25,6 +25,7 @@ #include #include #include +#include template void test01() @@ -52,22 +53,6 @@ void test01() } } -struct slow_clock -{ - using rep = std::chrono::system_clock::rep; - using period = std::chrono::system_clock::period; - using duration = std::chrono::system_clock::duration; - using time_point = std::chrono::time_point; - static constexpr bool is_steady = false; - - static time_point now() - { - auto real = std::chrono::system_clock::now(); - return time_point{real.time_since_epoch() / 3}; - } -}; - - void test01_alternate_clock() { try diff --git a/libstdc++-v3/testsuite/util/slow_clock.h b/libstdc++-v3/testsuite/util/slow_clock.h new file mode 100644 index 0000000..b81754e --- /dev/null +++ b/libstdc++-v3/testsuite/util/slow_clock.h @@ -0,0 +1,38 @@ +// -*- C++ -*- + +// Copyright (C) 2019 Free Software Foundation, Inc. + +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License as +// published by the Free Software Foundation; either version 3, or (at +// your option) any later version. + +// This library is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with this library; see the file COPYING3. If not see +// . + + +// A clock that ticks at a third of the speed of system_clock that can be used +// to ensure that functions with timeouts don't erroneously return early. + +#include + +struct slow_clock +{ + using rep = std::chrono::system_clock::rep; + using period = std::chrono::system_clock::period; + using duration = std::chrono::system_clock::duration; + using time_point = std::chrono::time_point; + static constexpr bool is_steady = false; + + static time_point now() + { + auto real = std::chrono::system_clock::now(); + return time_point{real.time_since_epoch() / 3}; + } +}; -- git-series 0.9.1