Patchwork Fix gdb.guile/scm-parameter.exp path matching

login
register
mail settings
Submitter Andy Wingo
Date April 9, 2015, 12:36 p.m.
Message ID <87a8yhh413.fsf@igalia.com>
Download mbox | patch
Permalink /patch/6111/
State New
Headers show

Comments

Andy Wingo - April 9, 2015, 12:36 p.m.
OK to commit?  For me the test was failing for
srcdir=/home/wingo/src/binutils-gdb/+2.0/../gdb/testsuite.

Andy
From 9eed15669df55cc792353e44d041a64af5249177 Mon Sep 17 00:00:00 2001
From: Andy Wingo <wingo@igalia.com>
Date: Thu, 9 Apr 2015 14:32:54 +0200
Subject: [PATCH] Fix gdb.guile/scm-parameter.exp path matching

gdb/testsuite/ChangeLog:

	* gdb.guile/scm-parameter.exp: Escape the path that we are
	matching against, as it might contain characters that are special
	to regular expressions.
---
 gdb/testsuite/ChangeLog                   | 6 ++++++
 gdb/testsuite/gdb.guile/scm-parameter.exp | 3 ++-
 2 files changed, 8 insertions(+), 1 deletion(-)
Doug Evans - April 13, 2015, 4:36 p.m.
Andy Wingo writes:
 > OK to commit?  For me the test was failing for
 > srcdir=/home/wingo/src/binutils-gdb/+2.0/../gdb/testsuite.
 > 
 > Andy
 > 
 > >From 9eed15669df55cc792353e44d041a64af5249177 Mon Sep 17 00:00:00 2001
 > From: Andy Wingo <wingo@igalia.com>
 > Date: Thu, 9 Apr 2015 14:32:54 +0200
 > Subject: [PATCH] Fix gdb.guile/scm-parameter.exp path matching
 > 
 > gdb/testsuite/ChangeLog:
 > 
 > 	* gdb.guile/scm-parameter.exp: Escape the path that we are
 > 	matching against, as it might contain characters that are special
 > 	to regular expressions.

LGTM with one nit.
Can you add a similar fix to gdb.python/py-parameter.exp?

Hmmm, there's also the is_remote_host test that
lives in py-parameter.exp (git show 10c5f0a8), which
isn't in scm-parameter.exp, but no need to do that here.

Thanks!
Andy Wingo - April 28, 2015, 9:17 a.m.
On Mon 13 Apr 2015 18:36, Doug Evans <dje@google.com> writes:

> Andy Wingo writes:
>  > OK to commit?  For me the test was failing for
>  > srcdir=/home/wingo/src/binutils-gdb/+2.0/../gdb/testsuite.
>  > 
>  > Andy
>  > 
>  > >From 9eed15669df55cc792353e44d041a64af5249177 Mon Sep 17 00:00:00 2001
>  > From: Andy Wingo <wingo@igalia.com>
>  > Date: Thu, 9 Apr 2015 14:32:54 +0200
>  > Subject: [PATCH] Fix gdb.guile/scm-parameter.exp path matching
>  > 
>  > gdb/testsuite/ChangeLog:
>  > 
>  > 	* gdb.guile/scm-parameter.exp: Escape the path that we are
>  > 	matching against, as it might contain characters that are special
>  > 	to regular expressions.
>
> LGTM with one nit.
> Can you add a similar fix to gdb.python/py-parameter.exp?
>
> Hmmm, there's also the is_remote_host test that
> lives in py-parameter.exp (git show 10c5f0a8), which
> isn't in scm-parameter.exp, but no need to do that here.

Done and pushed, thanks.

Andy

Patch

diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index 73785d6..edc6b2e 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,5 +1,11 @@ 
 2015-04-09  Andy Wingo  <wingo@igalia.com>
 
+	* gdb.guile/scm-parameter.exp: Escape the path that we are
+	matching against, as it might contain characters that are special
+	to regular expressions.
+
+2015-04-09  Andy Wingo  <wingo@igalia.com>
+
 	* gdb.guile/scm-frame.exp: Add frame-read-register tests, modelled
 	after the Python tests.
 
diff --git a/gdb/testsuite/gdb.guile/scm-parameter.exp b/gdb/testsuite/gdb.guile/scm-parameter.exp
index 42a7011..d3015f6 100644
--- a/gdb/testsuite/gdb.guile/scm-parameter.exp
+++ b/gdb/testsuite/gdb.guile/scm-parameter.exp
@@ -30,7 +30,8 @@  gdb_install_guile_utils
 gdb_install_guile_module
 
 # We use "." here instead of ":" so that this works on win32 too.
-gdb_test "guile (print (parameter-value \"directories\"))" "$srcdir/$subdir.\\\$cdir.\\\$cwd"
+set escaped_directory [string_to_regexp "$srcdir/$subdir"]
+gdb_test "guile (print (parameter-value \"directories\"))" "$escaped_directory.\\\$cdir.\\\$cwd"
 
 # Test a simple boolean parameter, and parameter? while we're at it.