From: Iain Buclaw <ibuclaw@gdcproject.org>
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 [thread overview]
Message-ID: <20211130152417.740788-1-ibuclaw@gdcproject.org> (raw)
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
+# <http://www.gnu.org/licenses/>.
+
+# 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
+# <http://www.gnu.org/licenses/>.
+
+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
+# <http://www.gnu.org/licenses/>.
+
+# 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
+# <http://www.gnu.org/licenses/>.
+
+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
+# <http://www.gnu.org/licenses/>.
+
+# 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
+# <http://www.gnu.org/licenses/>.
+
+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)
--
2.30.2
reply other threads:[~2021-11-30 15:24 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20211130152417.740788-1-ibuclaw@gdcproject.org \
--to=ibuclaw@gdcproject.org \
--cc=gcc-patches@gcc.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).