Fix mi-file.exp fails on remote host
authorYao Qi <yao@codesourcery.com>
Tue, 13 May 2014 06:40:22 +0000 (14:40 +0800)
committerYao Qi <yao@codesourcery.com>
Wed, 14 May 2014 12:11:53 +0000 (20:11 +0800)
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/ChangeLog
gdb/testsuite/gdb.mi/mi-file.exp

index e3343ae6191e5a2c5d5aad5761e2668a6a30c5b6..836deb734605fea9647162f09b7b98a379fc051e 100644 (file)
@@ -1,3 +1,10 @@
+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.
+
 2014-05-14  Yao Qi  <yao@codesourcery.com>
 
        * boards/local-remote-host-notty.exp (${board}_file): New
index 85998a2dab9d6193372b7a80c5224f8d4de94482..eeedc4df92fd74493b74147b3bccb121b53c7fed 100644 (file)
@@ -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."
 }