Fix mi-file.exp fails on remote host
Commit Message
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.
Comments
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!
On 05/14/2014 04:48 PM, Pedro Alves wrote:
>> Here is the new one.
> This one's OK.
Thanks for the quick review. Patch is pushed in.
@@ -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."
}