[PATCH] Fix --directory handling

Tom Tromey <[email protected]>
Newsgroups gmane.comp.sysutils.dejagnu.general
Message-ID <[email protected]>
I noticed while working on gdb that --directory handling doesn't work.
The problem is that with something like "--directory=gdb.gdb", [string
match] will not return true for the cases it is given.  Instead
matching "*/$directory" is needed when the srcdir is provided.

* runtest.exp: Fix --directory matching.
---
 ChangeLog   | 4 ++++
 runtest.exp | 5 ++++-
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/ChangeLog b/ChangeLog
index 61cbbf5..1d939a9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2017-08-18  Tom Tromey  <[email protected]>
+
+	* runtest.exp: Fix --directory matching.
+
 2017-08-15  Ben Elliston  <[email protected]>
 
 	* lib/framework.exp (xml_tag): New proc.
diff --git a/runtest.exp b/runtest.exp
index 173c9a4..02c10ed 100644
--- a/runtest.exp
+++ b/runtest.exp
@@ -1829,7 +1829,10 @@ foreach current_target $target_list {
 			# list of directories.  Look for match on each item.
 			set found 0
 			foreach directory $cmdline_dir_to_run {
-			    if {[string match $directory $dir]} {
+			    # Look for a directory that ends with the
+			    # provided --directory name.
+			    if {[string match "$directory" $dir]
+				|| [string match "*/$directory" $dir]} {
 				set found 1
 				break
 			    }
-- 
2.9.4
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.