public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [C++] testsuite tweak
@ 2017-04-25 12:55 Nathan Sidwell
  0 siblings, 0 replies; only message in thread
From: Nathan Sidwell @ 2017-04-25 12:55 UTC (permalink / raw)
  To: GCC Patches

[-- Attachment #1: Type: text/plain, Size: 446 bytes --]

The G++ testsuite's main dg.exp file does a recursive glob for .C files 
and then prunes out those in directories known to contain their own .exp 
file.  This is dumb.

This patch adds a recursive directory walker that stops when it 
encounters a .exp file. In addition to not having to specify the same 
thing twice, it keeps things nicely collated, (tcl's prune function can 
scramble ordering).

committed to trunk.

nathan
-- 
Nathan Sidwell

[-- Attachment #2: dg.diff --]
[-- Type: text/x-patch, Size: 2447 bytes --]

2017-04-25  Nathan Sidwell  <nathan@acm.org>

	* g++.dg/dg.exp (find-cxx-tests): New function.
	(main): Use it, remove explicit pruning

Index: testsuite/g++.dg/dg.exp
===================================================================
--- testsuite/g++.dg/dg.exp	(revision 247214)
+++ testsuite/g++.dg/dg.exp	(working copy)
@@ -29,35 +29,19 @@ if ![info exists DEFAULT_CXXFLAGS] then
 # Initialize `dg'.
 dg-init
 
-# Gather a list of all tests, with the exception of those in directories
-# that are handled specially.
-set tests [lsort [find $srcdir/$subdir *.C]]
-set tests [prune $tests $srcdir/$subdir/bprob/*]
-set tests [prune $tests $srcdir/$subdir/charset/*]
-set tests [prune $tests $srcdir/$subdir/cilk-plus/AN/*]
-set tests [prune $tests $srcdir/$subdir/compat/*]
-set tests [prune $tests $srcdir/$subdir/debug/*]
-set tests [prune $tests $srcdir/$subdir/dfp/*]
-set tests [prune $tests $srcdir/$subdir/gcov/*]
-set tests [prune $tests $srcdir/$subdir/lto/*]
-set tests [prune $tests $srcdir/$subdir/pch/*]
-set tests [prune $tests $srcdir/$subdir/plugin/*]
-set tests [prune $tests $srcdir/$subdir/special/*]
-set tests [prune $tests $srcdir/$subdir/tls/*]
-set tests [prune $tests $srcdir/$subdir/vect/*]
-set tests [prune $tests $srcdir/$subdir/goacc/*]
-set tests [prune $tests $srcdir/$subdir/goacc-gomp/*]
-set tests [prune $tests $srcdir/$subdir/gomp/*]
-set tests [prune $tests $srcdir/$subdir/tree-prof/*]
-set tests [prune $tests $srcdir/$subdir/torture/*]
-set tests [prune $tests $srcdir/$subdir/graphite/*]
-set tests [prune $tests $srcdir/$subdir/tm/*]
-set tests [prune $tests $srcdir/$subdir/cilk-plus/*]
-set tests [prune $tests $srcdir/$subdir/guality/*]
-set tests [prune $tests $srcdir/$subdir/simulate-thread/*]
-set tests [prune $tests $srcdir/$subdir/asan/*]
-set tests [prune $tests $srcdir/$subdir/ubsan/*]
-set tests [prune $tests $srcdir/$subdir/tsan/*]
+# Recursively find files in $dir and subdirs, do not walk into subdirs
+# that contain their own .exp file.
+proc find-cxx-tests { dir suffix } {
+    set tests [lsort [glob -nocomplain -directory $dir "*.$suffix" ]]
+    foreach subdir [lsort [glob -nocomplain -type d -directory $dir *]] {
+	if { [glob -nocomplain -directory $subdir *.exp] eq "" } {
+	    lappend tests {*}[find-cxx-tests $subdir $suffix]
+	}
+    }
+    return $tests
+}
+
+set tests [find-cxx-tests $srcdir/$subdir {C}]
 
 # Main loop.
 g++-dg-runtest $tests "" $DEFAULT_CXXFLAGS

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2017-04-25 12:51 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-04-25 12:55 [C++] testsuite tweak Nathan Sidwell

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).