From patchwork Wed Apr 24 14:31:09 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Iain Buclaw X-Patchwork-Id: 1090164 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-499615-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="ONPHM/lS"; 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 44q2nS4rJyz9s5c for ; Thu, 25 Apr 2019 00:31:33 +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=PP055ctMQKiHa0d8AcRVNJoAk+YbXX/u1E8q4+nVe7b3hB X7H441Af7fDnZ6M0uHFr6WBYWb92DTJDFoDpKlibvps86GZ00Mk2QcEKvOIV0XK8 bZ8CeoXgs38wYti/ZZ88pRGMODCaStXZgjLX+GV54h6KvMcCJO3EaeNC8mIyQ= 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=QhJkZbmo/jj0f3JzeY/m8w6nvqo=; b=ONPHM/lSocf1fof6y+5+ UrxAfWXkL9EQeU510/bui3lO54zwkeafjwQ5uwUW+JbiL8SZW1GsNym91VFM63tT +vfm4Bi4AulTi0lBgoRrS6AOkQyJoH/I0ZmDxoIIX6YCSLY2dna30LhwuNJKiu1z aJf6ChdHo+nlS5tgvG0irO4= Received: (qmail 19827 invoked by alias); 24 Apr 2019 14:31:25 -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 19813 invoked by uid 89); 24 Apr 2019 14:31:25 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-20.1 required=5.0 tests=AWL, BAYES_00, FREEMAIL_FROM, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.1 spammy=gccdir, $output_file, output_file X-HELO: mail-qk1-f172.google.com Received: from mail-qk1-f172.google.com (HELO mail-qk1-f172.google.com) (209.85.222.172) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 24 Apr 2019 14:31:23 +0000 Received: by mail-qk1-f172.google.com with SMTP id f125so6116936qke.6 for ; Wed, 24 Apr 2019 07:31:23 -0700 (PDT) MIME-Version: 1.0 From: Iain Buclaw Date: Wed, 24 Apr 2019 16:31:09 +0200 Message-ID: Subject: [PATCH PR d/88654] Committed skip curl tests if libcurl is not installed on the target. To: gcc-patches X-IsSubscribed: yes Hi, This patch adds necessary functionality in the libphobos testsuite to mark druntime and phobos unit-tests to be skipped on matched targets. Added entries to skip curl tests if libcurl is not installed. Regression tested on x86_64-linux-gnu on multilibs -m32, -mx32, and -m64 where curl was not installed. Committed to trunk as r270545. diff --git a/libphobos/testsuite/lib/libphobos.exp b/libphobos/testsuite/lib/libphobos.exp index 6d113bc5172..d47da178b7e 100644 --- a/libphobos/testsuite/lib/libphobos.exp +++ b/libphobos/testsuite/lib/libphobos.exp @@ -47,8 +47,8 @@ proc libphobos-dg-test { prog do_what extra_tool_flags } { set output_file "" global libphobos_test_name + upvar name name if { $libphobos_test_name != "" } { - upvar name name set name $libphobos_test_name } @@ -80,11 +80,19 @@ proc libphobos-dg-test { prog do_what extra_tool_flags } { lappend options "additional_flags=$extra_tool_flags" } - set comp_output [$select_compile "$prog" "$output_file" "$compile_type" $options] + set unsupported_message [libphobos_skipped_test_p $name] + if { $unsupported_message != "" } { + return [list "::unsupported::$unsupported_message" $output_file] + } + set comp_output [$select_compile "$prog" "$output_file" "$compile_type" $options] return [list $comp_output $output_file] } +proc libphobos-dg-prune { system text } { + return $text +} + # # libphobos_init # @@ -120,6 +128,9 @@ proc libphobos_init { args } { global libphobos_test_name set libphobos_test_name "" + global libphobos_skip_tests + set libphobos_skip_tests { } + # Default settings. set blddir [lookfor_file [get_multilibs] libphobos] set flags_file "${blddir}/testsuite/testsuite_flags" @@ -143,7 +154,7 @@ proc libphobos_init { args } { } # Compute what needs to be added to the existing LD_LIBRARY_PATH. - set ld_library_path "" + set ld_library_path "." set gccdir [lookfor_file $tool_root_dir gcc/libgcc.a] if {$gccdir != ""} { @@ -218,3 +229,35 @@ proc filter_libphobos_unittests { list } { } return $res } + +# Skip the unittest (report it as UNSUPPORTED) if the module exists in +# libphobos_skip_tests and its target list is matched by dg-process-target. +# +# The expected format of the libphobos_skip_tests file is: +# { test { targets } } +proc libphobos_skipped_test_p { test } { + global libphobos_skip_tests + + set row [lsearch -inline -index 0 $libphobos_skip_tests $test] + if { $row eq "" } { + return "" + } + + if { [llength $row] != 2 } { + error "syntax error in libphobos_skip_tests: $row" + } + + set selector [list target [lindex $row 1]] + if { [dg-process-target-1 $selector] != "S" } { + return "" + } + + return "skipped test" +} + +# Return true if the curl library is supported on the target. +proc check_effective_target_libcurl_available { } { + return [check_no_compiler_messages libcurl_available executable { + int main (void) { return 0; } + } "-lcurl"] +} diff --git a/libphobos/testsuite/libphobos.phobos/phobos.exp b/libphobos/testsuite/libphobos.phobos/phobos.exp index 8ace023a832..4b731d34cb6 100644 --- a/libphobos/testsuite/libphobos.phobos/phobos.exp +++ b/libphobos/testsuite/libphobos.phobos/phobos.exp @@ -22,6 +22,12 @@ if { ![isnative] || ![is-effective-target static] } { # Gather a list of all tests. set tests [lsort [filter_libphobos_unittests [find $srcdir/../src "*.d"]]] +set libphobos_skip_tests { + # Skip curl tests if library is not available + { libphobos.phobos/etc/c/curl.d { ! libcurl_available } } + { libphobos.phobos/std/net/curl.d { ! libcurl_available } } +} + # Initialize dg. dg-init diff --git a/libphobos/testsuite/libphobos.phobos_shared/phobos_shared.exp b/libphobos/testsuite/libphobos.phobos_shared/phobos_shared.exp index b0510914499..f651abbed78 100644 --- a/libphobos/testsuite/libphobos.phobos_shared/phobos_shared.exp +++ b/libphobos/testsuite/libphobos.phobos_shared/phobos_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/../src "*.d"]]] +set libphobos_skip_tests { + # Skip curl tests if library is not available + { libphobos.phobos_shared/etc/c/curl.d { ! libcurl_available } } + { libphobos.phobos_shared/std/net/curl.d { ! libcurl_available } } +} + # Initialize dg. dg-init