From patchwork Tue Nov 30 15:24:17 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Iain Buclaw X-Patchwork-Id: 48299 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id B9181385BF83 for ; Tue, 30 Nov 2021 15:24:58 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org B9181385BF83 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1638285898; bh=xLZPS6okYryqcM44Gfw/0OiebDkrnNF1Pyn+P1ZhSAQ=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=iseiLXzHVkwQfJ3/FvBlsMqVUYUFgknLPYuclOIUWwvX7fEyjQCAq6p+znm0zSN2+ IKSppIIx3sxPYxLkpLdfb/MmjLv8Rvq560makT/nAynt/oD5W8r/5j7+MrEV3eWZDe faXukjtu/MUGIWSdyNBzvpTE/mIf1OlOlTdoykL4= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mout-p-101.mailbox.org (mout-p-101.mailbox.org [80.241.56.151]) by sourceware.org (Postfix) with ESMTPS id 117BA3858D28 for ; Tue, 30 Nov 2021 15:24:27 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 117BA3858D28 Received: from smtp202.mailbox.org (smtp202.mailbox.org [80.241.60.245]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-384) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-p-101.mailbox.org (Postfix) with ESMTPS id 4J3QxP1NvvzQk4J; Tue, 30 Nov 2021 16:24:25 +0100 (CET) X-Virus-Scanned: amavisd-new at heinlein-support.de To: gcc-patches@gcc.gnu.org Subject: [committed 19/19] libphobos: Update libphobos testsuite to pass on latest version Date: Tue, 30 Nov 2021 16:24:17 +0100 Message-Id: <20211130152417.740788-1-ibuclaw@gdcproject.org> MIME-Version: 1.0 X-Spam-Status: No, score=-13.7 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_SHORT, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) 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: Iain Buclaw via Gcc-patches From: Iain Buclaw Reply-To: Iain Buclaw Errors-To: gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org Sender: "Gcc-patches" This adds new, or updates the dejagu testing scripts for the suite of libphobos tests. Bootstrapped, regression tested, and committed to mainline. Regards, Iain. --- libphobos/ChangeLog: * testsuite/lib/libphobos.exp (libphobos-dg-test): Handle assembly compile types. (dg-test): Override. (additional_prunes): Define. (libphobos-dg-prune): Filter any additional_prunes set by tests. * testsuite/libphobos.druntime/druntime.exp (version_flags): Add -fversion=CoreUnittest. * testsuite/libphobos.druntime_shared/druntime_shared.exp (version_flags): Add -fversion=CoreUnittest -fversion=Shared. * testsuite/libphobos.phobos/phobos.exp (version_flags): Add -fversion=StdUnittest * testsuite/libphobos.phobos_shared/phobos_shared.exp (version_flags): Likewise. * testsuite/testsuite_flags.in: Add -fpreview=dip1000 to --gdcflags. * testsuite/libphobos.betterc/betterc.exp: New test. * testsuite/libphobos.config/config.exp: New test. * testsuite/libphobos.gc/gc.exp: New test. * testsuite/libphobos.imports/imports.exp: New test. * testsuite/libphobos.lifetime/lifetime.exp: New test. * testsuite/libphobos.unittest/unittest.exp: New test. --- libphobos/testsuite/lib/libphobos.exp | 60 +++++++++++++++++++ .../testsuite/libphobos.betterc/betterc.exp | 27 +++++++++ .../testsuite/libphobos.config/config.exp | 46 ++++++++++++++ .../testsuite/libphobos.druntime/druntime.exp | 2 +- .../druntime_shared.exp | 2 +- libphobos/testsuite/libphobos.gc/gc.exp | 27 +++++++++ .../testsuite/libphobos.imports/imports.exp | 29 +++++++++ .../testsuite/libphobos.lifetime/lifetime.exp | 27 +++++++++ .../testsuite/libphobos.phobos/phobos.exp | 2 +- .../libphobos.phobos_shared/phobos_shared.exp | 2 +- .../testsuite/libphobos.unittest/unittest.exp | 53 ++++++++++++++++ libphobos/testsuite/testsuite_flags.in | 2 +- 12 files changed, 274 insertions(+), 5 deletions(-) create mode 100644 libphobos/testsuite/libphobos.betterc/betterc.exp create mode 100644 libphobos/testsuite/libphobos.config/config.exp create mode 100644 libphobos/testsuite/libphobos.gc/gc.exp create mode 100644 libphobos/testsuite/libphobos.imports/imports.exp create mode 100644 libphobos/testsuite/libphobos.lifetime/lifetime.exp create mode 100644 libphobos/testsuite/libphobos.unittest/unittest.exp diff --git a/libphobos/testsuite/lib/libphobos.exp b/libphobos/testsuite/lib/libphobos.exp index 2af430a0e45..66e3e80105f 100644 --- a/libphobos/testsuite/lib/libphobos.exp +++ b/libphobos/testsuite/lib/libphobos.exp @@ -54,6 +54,10 @@ proc libphobos-dg-test { prog do_what extra_tool_flags } { # Set up the compiler flags, based on what we're going to do. switch $do_what { + "compile" { + set compile_type "assembly" + set output_file "[file rootname [file tail $prog]].s" + } "run" { set compile_type "executable" # FIXME: "./" is to cope with "." not being in $PATH. @@ -89,8 +93,52 @@ proc libphobos-dg-test { prog do_what extra_tool_flags } { return [list $comp_output $output_file] } +# Override the DejaGnu dg-test in order to clear flags after a test, as +# is done for compiler tests in gcc-dg.exp. + +if { [info procs saved-dg-test] == [list] } { + rename dg-test saved-dg-test + + proc dg-test { args } { + global additional_prunes + global errorInfo + global testname_with_flags + global shouldfail + + if { [ catch { eval saved-dg-test $args } errmsg ] } { + set saved_info $errorInfo + set additional_prunes "" + set shouldfail 0 + if [info exists testname_with_flags] { + unset testname_with_flags + } + unset_timeout_vars + error $errmsg $saved_info + } + set additional_prunes "" + set shouldfail 0 + unset_timeout_vars + if [info exists testname_with_flags] { + unset testname_with_flags + } + } +} + +# Prune messages from gdc that aren't useful. + +set additional_prunes "" + proc libphobos-dg-prune { system text } { + global additional_prunes + + foreach p $additional_prunes { + if { [string length $p] > 0 } { + # Following regexp matches a complete line containing $p. + regsub -all "(^|\n)\[^\n\]*$p\[^\n\]*" $text "" text + } + } + # Ignore harmless warnings from Xcode. regsub -all "(^|\n)\[^\n\]*ld: warning: could not create compact unwind for\[^\n\]*" $text "" text @@ -281,6 +329,18 @@ proc libphobos_skipped_test_p { test } { return "skipped test" } +# Prune any messages matching ARGS[1] (a regexp) from test output. +proc dg-prune-output { args } { + global additional_prunes + + if { [llength $args] != 2 } { + error "[lindex $args 1]: need one argument" + return + } + + lappend additional_prunes [lindex $args 1] +} + # 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 { diff --git a/libphobos/testsuite/libphobos.betterc/betterc.exp b/libphobos/testsuite/libphobos.betterc/betterc.exp new file mode 100644 index 00000000000..e5e9b84829d --- /dev/null +++ b/libphobos/testsuite/libphobos.betterc/betterc.exp @@ -0,0 +1,27 @@ +# Copyright (C) 2021 Free Software Foundation, Inc. +# +# This program 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 of the License, or +# (at your option) any later version. +# +# This program 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 GCC; see the file COPYING3. If not see +# . + +# Initialize dg. +dg-init + +# Gather a list of all tests. +set tests [lsort [find $srcdir/$subdir *.d]] + +# Main loop. +dg-runtest $tests "-fno-druntime" $DEFAULT_DFLAGS + +# All done. +dg-finish diff --git a/libphobos/testsuite/libphobos.config/config.exp b/libphobos/testsuite/libphobos.config/config.exp new file mode 100644 index 00000000000..e8f4d943ff3 --- /dev/null +++ b/libphobos/testsuite/libphobos.config/config.exp @@ -0,0 +1,46 @@ +# Copyright (C) 2021 Free Software Foundation, Inc. +# +# This program 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 of the License, or +# (at your option) any later version. +# +# This program 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 GCC; see the file COPYING3. If not see +# . + +load_lib libphobos-dg.exp + +set dg-output-text [list] + +# Test, arguments to pass to the test program, and return code. +set config_test_list [list \ + { test19433 "--DRT-dont-eat-me" 0 } \ + { test20459 "foo bar -- --DRT-gcopts=profile:1" 0 } \ +] + +# Initialize dg. +dg-init + +# Main loop. +foreach config_test $config_test_list { + set test "$srcdir/$subdir/[lindex $config_test 0].d" + + set libphobos_run_args "[lindex $config_test 1]" + set shouldfail [lindex $config_test 2] + set libphobos_test_name "[dg-trim-dirname $srcdir $test] $libphobos_run_args" + + dg-runtest $test "" $DEFAULT_DFLAGS + + set libphobos_test_name "" + set shouldfail 0 + set libphobos_run_args "" +} + +# All done. +dg-finish diff --git a/libphobos/testsuite/libphobos.druntime/druntime.exp b/libphobos/testsuite/libphobos.druntime/druntime.exp index daedfd71ebb..5342d45386f 100644 --- a/libphobos/testsuite/libphobos.druntime/druntime.exp +++ b/libphobos/testsuite/libphobos.druntime/druntime.exp @@ -22,7 +22,7 @@ if { ![isnative] } { # Gather a list of all tests. set tests [lsort [filter_libphobos_unittests [find $srcdir/../libdruntime "*.d"]]] -set version_flags "" +set version_flags "-fversion=CoreUnittest" if { [is-effective-target linux_pre_2639] } { lappend version_flags "-fversion=Linux_Pre_2639" diff --git a/libphobos/testsuite/libphobos.druntime_shared/druntime_shared.exp b/libphobos/testsuite/libphobos.druntime_shared/druntime_shared.exp index 51f9c2cf1d6..67edab95cff 100644 --- a/libphobos/testsuite/libphobos.druntime_shared/druntime_shared.exp +++ b/libphobos/testsuite/libphobos.druntime_shared/druntime_shared.exp @@ -22,7 +22,7 @@ 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 "" +set version_flags "-fversion=CoreUnittest -fversion=Shared" if { [is-effective-target linux_pre_2639] } { lappend version_flags "-fversion=Linux_Pre_2639" diff --git a/libphobos/testsuite/libphobos.gc/gc.exp b/libphobos/testsuite/libphobos.gc/gc.exp new file mode 100644 index 00000000000..cb785382f51 --- /dev/null +++ b/libphobos/testsuite/libphobos.gc/gc.exp @@ -0,0 +1,27 @@ +# Copyright (C) 2021 Free Software Foundation, Inc. +# +# This program 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 of the License, or +# (at your option) any later version. +# +# This program 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 GCC; see the file COPYING3. If not see +# . + +# Initialize dg. +dg-init + +# Gather a list of all tests. +set tests [lsort [find $srcdir/$subdir *.d]] + +# Main loop. +dg-runtest $tests "" $DEFAULT_DFLAGS + +# All done. +dg-finish diff --git a/libphobos/testsuite/libphobos.imports/imports.exp b/libphobos/testsuite/libphobos.imports/imports.exp new file mode 100644 index 00000000000..344e415fa53 --- /dev/null +++ b/libphobos/testsuite/libphobos.imports/imports.exp @@ -0,0 +1,29 @@ +# Copyright (C) 2021 Free Software Foundation, Inc. +# +# This program 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 of the License, or +# (at your option) any later version. +# +# This program 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 GCC; see the file COPYING3. If not see +# . + +load_lib libphobos-dg.exp + +# Initialize dg. +dg-init + +# Gather a list of all tests. +set tests [lsort [find $srcdir/$subdir *.d]] + +# Main loop. +dg-runtest $tests "" $DEFAULT_DFLAGS + +# All done. +dg-finish diff --git a/libphobos/testsuite/libphobos.lifetime/lifetime.exp b/libphobos/testsuite/libphobos.lifetime/lifetime.exp new file mode 100644 index 00000000000..cb785382f51 --- /dev/null +++ b/libphobos/testsuite/libphobos.lifetime/lifetime.exp @@ -0,0 +1,27 @@ +# Copyright (C) 2021 Free Software Foundation, Inc. +# +# This program 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 of the License, or +# (at your option) any later version. +# +# This program 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 GCC; see the file COPYING3. If not see +# . + +# Initialize dg. +dg-init + +# Gather a list of all tests. +set tests [lsort [find $srcdir/$subdir *.d]] + +# Main loop. +dg-runtest $tests "" $DEFAULT_DFLAGS + +# All done. +dg-finish diff --git a/libphobos/testsuite/libphobos.phobos/phobos.exp b/libphobos/testsuite/libphobos.phobos/phobos.exp index 937849eebd7..84e989837fe 100644 --- a/libphobos/testsuite/libphobos.phobos/phobos.exp +++ b/libphobos/testsuite/libphobos.phobos/phobos.exp @@ -27,7 +27,7 @@ if { ![is-effective-target d_runtime_has_std_library] } { # Gather a list of all tests. set tests [lsort [filter_libphobos_unittests [find $srcdir/../src "*.d"]]] -set version_flags "" +set version_flags "-fversion=StdUnittest" if { [is-effective-target linux_pre_2639] } { lappend version_flags "-fversion=Linux_Pre_2639" diff --git a/libphobos/testsuite/libphobos.phobos_shared/phobos_shared.exp b/libphobos/testsuite/libphobos.phobos_shared/phobos_shared.exp index 8498522d4d4..b8f8e42f612 100644 --- a/libphobos/testsuite/libphobos.phobos_shared/phobos_shared.exp +++ b/libphobos/testsuite/libphobos.phobos_shared/phobos_shared.exp @@ -27,7 +27,7 @@ if { ![is-effective-target d_runtime_has_std_library] } { # Gather a list of all tests. set tests [lsort [filter_libphobos_unittests [find $srcdir/../src "*.d"]]] -set version_flags "" +set version_flags "-fversion=StdUnittest" if { [is-effective-target linux_pre_2639] } { lappend version_flags "-fversion=Linux_Pre_2639" diff --git a/libphobos/testsuite/libphobos.unittest/unittest.exp b/libphobos/testsuite/libphobos.unittest/unittest.exp new file mode 100644 index 00000000000..ba2fc6e32af --- /dev/null +++ b/libphobos/testsuite/libphobos.unittest/unittest.exp @@ -0,0 +1,53 @@ +# Copyright (C) 2021 Free Software Foundation, Inc. +# +# This program 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 of the License, or +# (at your option) any later version. +# +# This program 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 GCC; see the file COPYING3. If not see +# . + +load_lib libphobos-dg.exp + +set dg-output-text [list] + +# Arguments to pass to the compiler, expected output, and return code. +set unit_test_list [list \ + { "-fversion=PassNoPrintout" 0 } \ + { "-fversion=GoodTests" 0 } \ + { "-fversion=FailNoPrintout" 1 } \ + { "-fversion=FailedTests" 1 } \ + { "-fversion=NoTests" 0 } \ +] + +# Initialize dg. +dg-init + +# Gather a list of all tests. +set tests [lsort [find $srcdir/$subdir *.d]] + +# Main loop. +foreach unit_test $unit_test_list { + # The version flags to build the program with. + set test_flags [lindex $unit_test 0] + + # Whether the program is expected to fail. + set expected_fail [lindex $unit_test 1] + + foreach test $tests { + set shouldfail $expected_fail + dg-test $test "" $test_flags + } + + set shouldfail 0 +} + +# All done. +dg-finish diff --git a/libphobos/testsuite/testsuite_flags.in b/libphobos/testsuite/testsuite_flags.in index bafd5ad4502..93bf7cbfba2 100755 --- a/libphobos/testsuite/testsuite_flags.in +++ b/libphobos/testsuite/testsuite_flags.in @@ -29,7 +29,7 @@ case ${query} in --gdcflags) GDCFLAGS_default="-fmessage-length=0 -fno-show-column" GDCFLAGS_config="@WARN_DFLAGS@ @GDCFLAGS@ @CET_DFLAGS@ - @phobos_compiler_shared_flag@ -fno-release -funittest" + @phobos_compiler_shared_flag@ -fpreview=dip1000 -fno-release -funittest" echo ${GDCFLAGS_default} ${GDCFLAGS_config} ;; --gdcpaths)