From patchwork Wed Apr 24 19:23:51 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Iain Buclaw X-Patchwork-Id: 1090397 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-499624-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=quarantine dis=none) header.from=gdcproject.org Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="mL20Pv7l"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 44q9HZ3wXBz9s4Y for ; Thu, 25 Apr 2019 05:24:39 +1000 (AEST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :mime-version:from:date:message-id:subject:to:content-type; q= dns; s=default; b=Z3GaCScnYBWEy1dXIeHx7ALLJ4Rr9Y+zF1ysMoINXZjJ3H uBGGiD6RG0qLvzZ4GaCcCwuty8vtGsatjJk2XKHkFnDsPgVdshCTftyH3ZSsUuHz OZK4b36Jrbj+pgoOORCN0b/iutD3AZLIzOANPzDiMcf1/PtHmRnuIyVZALPq0= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :mime-version:from:date:message-id:subject:to:content-type; s= default; bh=Zy4BIM/xLrj9e4sO15mYVuO0VoU=; b=mL20Pv7l9oOiOB5I23NK DXEQmWFvAyPImCGCQcciPOUAMsTt4aLs+1U1bVIecLG1G6Urp1d7/2RDnunjfwQE SyfBY9UQOL4Nb9k8/v/KzLMM/up9w/Nou31iGj+6c0yepZSFu7CGl36YsjYzW8j0 l3j6gwotiLH4PISAQ11OBVI= Received: (qmail 124362 invoked by alias); 24 Apr 2019 19:24:32 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 124300 invoked by uid 89); 24 Apr 2019 19:24:25 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-19.9 required=5.0 tests=AWL, BAYES_00, FREEMAIL_FROM, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_NUMSUBJECT, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.1 spammy=sk:shared-, sk:shared X-HELO: mail-qk1-f175.google.com Received: from mail-qk1-f175.google.com (HELO mail-qk1-f175.google.com) (209.85.222.175) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 24 Apr 2019 19:24:04 +0000 Received: by mail-qk1-f175.google.com with SMTP id w73so9406094qkb.13 for ; Wed, 24 Apr 2019 12:24:04 -0700 (PDT) MIME-Version: 1.0 From: Iain Buclaw Date: Wed, 24 Apr 2019 21:23:51 +0200 Message-ID: Subject: [PATCH, PR d/89432] Fix FAIL phobos.exp/core.time on CentOS 5.11, Linux 2.6.18 To: gcc-patches X-IsSubscribed: yes Hi, This patch adds -fversion=Linux_Pre_2639 to the druntime testsuite compile flags if the linux OS version is older than 2.6.39. The second part is from upstream druntime e03164b5, fixing PR d/89432. Bootstrapped and regression tested on x86_64-linux-gnu. Committed to trunk as r270554. diff --git a/libphobos/libdruntime/MERGE b/libphobos/libdruntime/MERGE index 9fe51fd5ae9..d815647f969 100644 --- a/libphobos/libdruntime/MERGE +++ b/libphobos/libdruntime/MERGE @@ -1,4 +1,4 @@ -513652173d6f02206be3ddaa2b6ed0b191ea4e3d +e03164b5259a9f116eb91dfa5a18c192fa72e575 The first line of this file holds the git revision number of the last merge done from the dlang/druntime repository. diff --git a/libphobos/libdruntime/core/time.d b/libphobos/libdruntime/core/time.d index 1982122858e..a7640ec1912 100644 --- a/libphobos/libdruntime/core/time.d +++ b/libphobos/libdruntime/core/time.d @@ -2539,8 +2539,11 @@ unittest static bool clockSupported(ClockType c) { - version (Linux_Pre_2639) // skip CLOCK_BOOTTIME on older linux kernels - return c != ClockType.second && c != ClockType.bootTime; + // Skip unsupported clocks on older linux kernels, assume that only + // CLOCK_MONOTONIC and CLOCK_REALTIME exist, as that is the lowest + // common denominator supported by all versions of Linux pre-2.6.12. + version (Linux_Pre_2639) + return c == ClockType.normal || c == ClockType.precise; else return c != ClockType.second; // second doesn't work with MonoTimeImpl diff --git a/libphobos/testsuite/lib/libphobos.exp b/libphobos/testsuite/lib/libphobos.exp index d47da178b7e..d3fe75358c8 100644 --- a/libphobos/testsuite/lib/libphobos.exp +++ b/libphobos/testsuite/lib/libphobos.exp @@ -261,3 +261,20 @@ proc check_effective_target_libcurl_available { } { int main (void) { return 0; } } "-lcurl"] } + +# Return true if the target is linux version < 2.6.39 +proc check_effective_target_linux_pre_2639 { } { + if { ![istarget *-*-linux*] } { + return 0 + } + + if { [check_no_compiler_messages linux_pre_2639 assembly { + #include + #if !defined LINUX_VERSION_CODE || LINUX_VERSION_CODE < KERNEL_VERSION(2.6.39) + #error Yes, it is. + #endif + }] } { + return 0 + } + return 1 +} diff --git a/libphobos/testsuite/libphobos.druntime/druntime.exp b/libphobos/testsuite/libphobos.druntime/druntime.exp index f93562b476b..0f792356500 100644 --- a/libphobos/testsuite/libphobos.druntime/druntime.exp +++ b/libphobos/testsuite/libphobos.druntime/druntime.exp @@ -22,13 +22,19 @@ if { ![isnative] || ![is-effective-target static] } { # Gather a list of all tests. set tests [lsort [filter_libphobos_unittests [find $srcdir/../libdruntime "*.d"]]] +set version_flags "" + +if { [is-effective-target linux_pre_2639] } { + lappend version_flags "-fversion=Linux_Pre_2639" +} + # Initialize dg. dg-init # Main loop. foreach test $tests { set libphobos_test_name "$subdir/[dg-trim-dirname $srcdir/../libdruntime $test]" - dg-runtest $test "" "-fmain -fbuilding-libphobos-tests" + dg-runtest $test "" "-fmain -fbuilding-libphobos-tests $version_flags" set libphobos_test_name "" } diff --git a/libphobos/testsuite/libphobos.druntime_shared/druntime_shared.exp b/libphobos/testsuite/libphobos.druntime_shared/druntime_shared.exp index 77b0402d029..1a067c3177c 100644 --- a/libphobos/testsuite/libphobos.druntime_shared/druntime_shared.exp +++ b/libphobos/testsuite/libphobos.druntime_shared/druntime_shared.exp @@ -22,6 +22,12 @@ if { ![isnative] || ![is-effective-target shared] } { # Gather a list of all tests. set tests [lsort [filter_libphobos_unittests [find $srcdir/../libdruntime "*.d"]]] +set version_flags "" + +if { [is-effective-target linux_pre_2639] } { + lappend version_flags "-fversion=Linux_Pre_2639" +} + # Initialize dg. dg-init @@ -29,7 +35,7 @@ dg-init foreach test $tests { set libphobos_test_name "$subdir/[dg-trim-dirname $srcdir/../libdruntime $test]" dg-runtest $test "-fversion=Shared -shared-libphobos" \ - "-fmain -fbuilding-libphobos-tests -fno-moduleinfo" + "-fmain -fbuilding-libphobos-tests -fno-moduleinfo $version_flags" set libphobos_test_name "" }