aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorIain Buclaw <ibuclaw@gdcproject.org>2020-03-28 18:44:12 +0100
committerIain Buclaw <ibuclaw@gdcproject.org>2020-03-29 17:29:04 +0200
commitc76df72f1a916d0482d15e43656ddff724352705 (patch)
treea4f76e3d7b30d0ac96c6924b794fb5778af7d34c /gcc
parent673bb288e6277e2d21f25ce40f19bcb28cf2a99d (diff)
downloadgcc-c76df72f1a916d0482d15e43656ddff724352705.zip
gcc-c76df72f1a916d0482d15e43656ddff724352705.tar.gz
gcc-c76df72f1a916d0482d15e43656ddff724352705.tar.bz2
testsuite: Split up gdc-test.exp into each subdirectory
Use multiple test scripts, one for each subdirectory containing test files, instead of having one test script to manage them all. This allows removing some workarounds, such as the need to create symlinks in the test run directory. gcc/testsuite/ChangeLog: * gdc.test/compilable/compilable.exp: New file. * gdc.test/fail_compilation/fail_compilation.exp: New file. * gdc.test/gdc-test.exp: Remove. * gdc.test/runnable/runnable.exp: New file. * lib/gdc-utils.exp: ...this. Remove load_lib gdc-dg.exp. (dmd2dg): Rename to... (gdc-convert-test): ...this. (gdc-do-test): Add testcases parameter and remove subdir handling.
Diffstat (limited to 'gcc')
-rw-r--r--gcc/testsuite/ChangeLog11
-rw-r--r--gcc/testsuite/gdc.test/compilable/compilable.exp30
-rw-r--r--gcc/testsuite/gdc.test/fail_compilation/fail_compilation.exp30
-rw-r--r--gcc/testsuite/gdc.test/runnable/runnable.exp35
-rw-r--r--gcc/testsuite/lib/gdc-utils.exp (renamed from gcc/testsuite/gdc.test/gdc-test.exp)41
5 files changed, 117 insertions, 30 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 5a1a2d1..cd57ba6 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,14 @@
+2020-03-29 Iain Buclaw <ibuclaw@gdcproject.org>
+
+ * gdc.test/compilable/compilable.exp: New file.
+ * gdc.test/fail_compilation/fail_compilation.exp: New file.
+ * gdc.test/runnable/runnable.exp: New file.
+ * gdc.test/gdc-test.exp: Move and rename to...
+ * lib/gdc-utils.exp: ...this. Remove load_lib gdc-dg.exp.
+ (dmd2dg): Rename to...
+ (gdc-convert-test): ...this.
+ (gdc-do-test): Add testcases parameter and remove subdir handling.
+
2020-03-28 Roman Zhuykov <zhroma@ispras.ru>
* gcc.dg/torture/pr87197-debug-sms.c: Move to ...
diff --git a/gcc/testsuite/gdc.test/compilable/compilable.exp b/gcc/testsuite/gdc.test/compilable/compilable.exp
new file mode 100644
index 0000000..e2af832
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/compilable.exp
@@ -0,0 +1,30 @@
+# Copyright (C) 2020 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/>.
+
+# Compilable tests for the D2 testsuite.
+
+# Load support procs.
+load_lib gdc-dg.exp
+load_lib gdc-utils.exp
+
+# Initialize `dg'.
+dg-init
+
+# Main loop.
+gdc-do-test [glob -nocomplain $srcdir/$subdir/*.d]
+
+# All done.
+dg-finish
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail_compilation.exp b/gcc/testsuite/gdc.test/fail_compilation/fail_compilation.exp
new file mode 100644
index 0000000..c560308
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail_compilation.exp
@@ -0,0 +1,30 @@
+# Copyright (C) 2020 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/>.
+
+# Fail compilation tests for the D2 testsuite.
+
+# Load support procs.
+load_lib gdc-dg.exp
+load_lib gdc-utils.exp
+
+# Initialize `dg'.
+dg-init
+
+# Main loop.
+gdc-do-test [glob -nocomplain $srcdir/$subdir/*.d]
+
+# All done.
+dg-finish
diff --git a/gcc/testsuite/gdc.test/runnable/runnable.exp b/gcc/testsuite/gdc.test/runnable/runnable.exp
new file mode 100644
index 0000000..af5d749
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/runnable.exp
@@ -0,0 +1,35 @@
+# Copyright (C) 2020 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/>.
+
+# Runnable tests for the D2 testsuite.
+
+# Load support procs.
+load_lib gdc-dg.exp
+load_lib gdc-utils.exp
+
+# If the D runtime library is missing, bail.
+if { ![check_effective_target_d_runtime] } {
+ return
+}
+
+# Initialize `dg'.
+dg-init
+
+# Main loop.
+gdc-do-test [glob -nocomplain $srcdir/$subdir/*.d]
+
+# All done.
+dg-finish
diff --git a/gcc/testsuite/gdc.test/gdc-test.exp b/gcc/testsuite/lib/gdc-utils.exp
index 5554e21..298c6a7 100644
--- a/gcc/testsuite/gdc.test/gdc-test.exp
+++ b/gcc/testsuite/lib/gdc-utils.exp
@@ -15,8 +15,6 @@
# <http://www.gnu.org/licenses/>.
# Test using the DMD testsuite.
-# Load support procs.
-load_lib gdc-dg.exp
#
# Convert DMD arguments to GDC equivalent
@@ -183,7 +181,7 @@ proc gdc-copy-extra { base extra } {
# DISABLED: Not handled.
#
-proc dmd2dg { base test } {
+proc gdc-convert-test { base test } {
global DEFAULT_DFLAGS
global PERMUTE_ARGS
global GDC_EXECUTE_ARGS
@@ -353,9 +351,11 @@ proc gdc-permute-options { options } {
return $result
}
+#
+# Main loop for running all tests for the subdirectory in gdc.test
+#
-proc gdc-do-test { } {
- global srcdir subdir
+proc gdc-do-test { testcases } {
global dg-do-what-default
global verbose
@@ -375,9 +375,6 @@ proc gdc-do-test { } {
# Additional arguments for gdc_load
global GDC_EXECUTE_ARGS
- # Initialize `dg'.
- dg-init
-
# Allow blank linkes in output for all of gdc.test.
global allow_blank_lines
set save_allow_blank_lines $allow_blank_lines
@@ -385,36 +382,25 @@ proc gdc-do-test { } {
set allow_blank_lines 2
}
- # Create gdc.test link so test names include that subdir.
- catch { file link $subdir . }
+ set saved-dg-do-what-default ${dg-do-what-default}
# Main loop.
# set verbose 1
# set dg-final-code ""
# Find all tests and pass to routine.
- foreach test [lsort [find $srcdir/$subdir *]] {
+ foreach test $testcases {
regexp -- "(.*)/(.+)/(.+)\.(.+)$" $test match base dir name ext
- # Skip invalid test directory
- if { [lsearch "runnable compilable fail_compilation" $dir] == -1 } {
- continue
- }
-
- # Skip invalid test extensions
- if { [lsearch "d" $ext] == -1 } {
- continue
- }
-
# Convert to DG test.
set imports [format "-I%s/%s" $base $dir]
set cleanup_extra_files ""
- # Include $subdir prefix so test names follow DejaGnu conventions.
- set filename "$subdir/[dmd2dg $base $dir/$name.$ext]"
+ set filename "[gdc-convert-test $base $dir/$name.$ext]"
if { $dir == "runnable" } {
append PERMUTE_ARGS " $SHARED_OPTION"
}
+
set options [gdc-permute-options [lsort -unique $PERMUTE_ARGS]]
switch $dir {
@@ -454,16 +440,11 @@ proc gdc-do-test { } {
# Cleanup test directory.
foreach srcfile $cleanup_extra_files {
- file delete $subdir/$srcfile
+ file delete $srcfile
}
file delete $filename
}
+ set dg-do-what-default ${saved-dg-do-what-default}
set allow_blank_lines $save_allow_blank_lines
-
- # All done.
- dg-finish
}
-
-gdc-do-test
-