* [PATCH] Fix mi-file.exp fails on remote host
@ 2014-05-13 7:37 Yao Qi
2014-05-13 18:51 ` Pedro Alves
0 siblings, 1 reply; 5+ messages in thread
From: Yao Qi @ 2014-05-13 7:37 UTC (permalink / raw)
To: gdb-patches
This patch fixes mi-file.exp fails on remote host. First, we can't
assume ${srcdir}/${subdir}/${srcfile} directory exists on remote host,
so this patch changes it to match ${srcfile} only on remote host.
Second, regexp pattern ".*/${srcfile}" isn't friendly to Windows path,
and the file name is "basics.c" in my test env, so use string_to_regexp
instead.
gdb/testsuite:
2014-05-13 Yao Qi <yao@codesourcery.com>
* gdb.mi/mi-file.exp (test_file_list_exec_source_file): Don't
match absolute path on remote host.
(test_file_list_exec_source_files): Use string_to_regexp.
---
gdb/testsuite/gdb.mi/mi-file.exp | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/gdb/testsuite/gdb.mi/mi-file.exp b/gdb/testsuite/gdb.mi/mi-file.exp
index 85998a2..109dcce 100644
--- a/gdb/testsuite/gdb.mi/mi-file.exp
+++ b/gdb/testsuite/gdb.mi/mi-file.exp
@@ -39,7 +39,11 @@ proc test_file_list_exec_source_file {} {
global srcdir
global subdir
global fullname_syntax
- set srcfilepath [string_to_regexp ${srcdir}/${subdir}/${srcfile}]
+ if { [is_remote host] } {
+ set srcfilepath [string_to_regexp ${srcfile}]
+ } else {
+ set srcfilepath [string_to_regexp ${srcdir}/${subdir}/${srcfile}]
+ }
# get the path and absolute path to the current executable
#
@@ -64,7 +68,7 @@ proc test_file_list_exec_source_files {} {
# get the path and absolute path to the current executable
mi_gdb_test "222-file-list-exec-source-files" \
- "222\\\^done,files=\\\[\{file=\".*/${srcfile}\",fullname=\"$fullname_syntax${srcfile}\"\}.*]" \
+ "222\\\^done,files=\\\[\{file=\"[string_to_regexp ${srcfile}]\",fullname=\"$fullname_syntax${srcfile}\"\}.*]" \
"Getting a list of source files."
}
--
1.9.0
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] Fix mi-file.exp fails on remote host
2014-05-13 7:37 [PATCH] Fix mi-file.exp fails on remote host Yao Qi
@ 2014-05-13 18:51 ` Pedro Alves
2014-05-14 2:22 ` Yao Qi
0 siblings, 1 reply; 5+ messages in thread
From: Pedro Alves @ 2014-05-13 18:51 UTC (permalink / raw)
To: Yao Qi, gdb-patches
On 05/13/14 08:34, Yao Qi wrote:
> and the file name is "basics.c" in my test env, so use string_to_regexp
> instead.
I don't get this rationale. I mean, I get that . is special in regexps, but
although not strictly correct, it's usually harmless. I believe we have a
ton of cases of just passing a filename with a dot as a regexp, as evidenced
by ...
> # get the path and absolute path to the current executable
> mi_gdb_test "222-file-list-exec-source-files" \
> - "222\\\^done,files=\\\[\{file=\".*/${srcfile}\",fullname=\"$fullname_syntax${srcfile}\"\}.*]" \
> + "222\\\^done,files=\\\[\{file=\"[string_to_regexp ${srcfile}]\",fullname=\"$fullname_syntax${srcfile}\"\}.*]" \
> "Getting a list of source files."
... the second ${srcfile} in the exact same line your changing. So it
looks odd to have to change one, but not the other.
What am I missing?
--
Pedro Alves
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] Fix mi-file.exp fails on remote host
2014-05-13 18:51 ` Pedro Alves
@ 2014-05-14 2:22 ` Yao Qi
2014-05-14 8:48 ` Pedro Alves
0 siblings, 1 reply; 5+ messages in thread
From: Yao Qi @ 2014-05-14 2:22 UTC (permalink / raw)
To: Pedro Alves, gdb-patches
On 05/14/2014 02:30 AM, Pedro Alves wrote:
> I don't get this rationale. I mean, I get that . is special in regexps, but
> although not strictly correct, it's usually harmless. I believe we have a
> ton of cases of just passing a filename with a dot as a regexp, as evidenced
> by ...
>
>> > # get the path and absolute path to the current executable
>> > mi_gdb_test "222-file-list-exec-source-files" \
>> > - "222\\\^done,files=\\\[\{file=\".*/${srcfile}\",fullname=\"$fullname_syntax${srcfile}\"\}.*]" \
>> > + "222\\\^done,files=\\\[\{file=\"[string_to_regexp ${srcfile}]\",fullname=\"$fullname_syntax${srcfile}\"\}.*]" \
>> > "Getting a list of source files."
> ... the second ${srcfile} in the exact same line your changing. So it
> looks odd to have to change one, but not the other.
Sorry for being unclear. It is not about ".", the culprit is "/" in
".*/${srcfile}". The test fails in my env because the file name is
"basics.c". At first, I remove "/" from the pattern and think better
to convert it to "string_to_regexp ${srcfile}". During the cleanup,
I remove the ".*" prefix by mistake, sorry :(
Here is the new one.
--
Yao (é½å°§)
Subject: [PATCH] Fix mi-file.exp fails on remote host
This patch fixes mi-file.exp fails on remote host. First, we can't
assume ${srcdir}/${subdir}/${srcfile} directory exists on remote host,
so this patch changes it to match ${srcfile} only on remote host.
Second, regexp pattern ".*/${srcfile}" isn't friendly to Windows path.
The file name is "basics.c" in my test env and can't match the pattern
due to "/" in it. Remove "/" from the pattern.
gdb/testsuite:
2014-05-14 Yao Qi <yao@codesourcery.com>
* gdb.mi/mi-file.exp (test_file_list_exec_source_file): Don't
match absolute path on remote host.
(test_file_list_exec_source_files): Remove "/" from the
pattern.
---
gdb/testsuite/gdb.mi/mi-file.exp | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/gdb/testsuite/gdb.mi/mi-file.exp b/gdb/testsuite/gdb.mi/mi-file.exp
index 85998a2..eeedc4d 100644
--- a/gdb/testsuite/gdb.mi/mi-file.exp
+++ b/gdb/testsuite/gdb.mi/mi-file.exp
@@ -39,7 +39,11 @@ proc test_file_list_exec_source_file {} {
global srcdir
global subdir
global fullname_syntax
- set srcfilepath [string_to_regexp ${srcdir}/${subdir}/${srcfile}]
+ if { [is_remote host] } {
+ set srcfilepath ".*${srcfile}"
+ } else {
+ set srcfilepath [string_to_regexp ${srcdir}/${subdir}/${srcfile}]
+ }
# get the path and absolute path to the current executable
#
@@ -64,7 +68,7 @@ proc test_file_list_exec_source_files {} {
# get the path and absolute path to the current executable
mi_gdb_test "222-file-list-exec-source-files" \
- "222\\\^done,files=\\\[\{file=\".*/${srcfile}\",fullname=\"$fullname_syntax${srcfile}\"\}.*]" \
+ "222\\\^done,files=\\\[\{file=\".*${srcfile}\",fullname=\"$fullname_syntax${srcfile}\"\}.*]" \
"Getting a list of source files."
}
--
1.9.0
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] Fix mi-file.exp fails on remote host
2014-05-14 2:22 ` Yao Qi
@ 2014-05-14 8:48 ` Pedro Alves
2014-05-14 12:25 ` Yao Qi
0 siblings, 1 reply; 5+ messages in thread
From: Pedro Alves @ 2014-05-14 8:48 UTC (permalink / raw)
To: Yao Qi, gdb-patches
On 05/14/14 03:20, Yao Qi wrote:
> On 05/14/2014 02:30 AM, Pedro Alves wrote:
> Sorry for being unclear. It is not about ".", the culprit is "/" in
> ".*/${srcfile}". The test fails in my env because the file name is
> "basics.c". At first, I remove "/" from the pattern and think better
> to convert it to "string_to_regexp ${srcfile}". During the cleanup,
> I remove the ".*" prefix by mistake, sorry :(
No worries.
> Here is the new one.
This one's OK.
Thanks!
--
Pedro Alves
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2014-05-14 12:25 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-05-13 7:37 [PATCH] Fix mi-file.exp fails on remote host Yao Qi
2014-05-13 18:51 ` Pedro Alves
2014-05-14 2:22 ` Yao Qi
2014-05-14 8:48 ` Pedro Alves
2014-05-14 12:25 ` Yao Qi
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).