Match the working directory on remote host

Message ID 87oasus29v.fsf@codesourcery.com
State New, archived
Headers

Commit Message

Yao Qi Oct. 30, 2014, 2:46 a.m. UTC
  Pedro Alves <palves@redhat.com> writes:

> Looks good.
>
>>  gdb_test_multiple "set extended-prompt \\w " \
>>      "set extended prompt working directory" {
>> -    -re "\[\r\n\].*gdb.*testsuite.* $" {
>> +	-re "\[\r\n\]${working_dir} $" {
>
> Please don't change the indentation though.

OK, fixed.

I also update the patch to use string_to_regexp to escape backslash in
windows path, otherwise, we'll get the following error on testing
mingw32 host gdb,

ERROR OCCURED: couldn't compile regular expression pattern: invalid escape \ sequence
    while executing
"expect -nobrace -i exp13 -timeout 10 -re {.*A problem internal to GDB has been
detected} {
	    fail "$message (GDB internal error)"
	    gdb_internal..."
    invoked from within

I'll commit it tomorrow.
  

Patch

diff --git a/gdb/testsuite/gdb.python/python.exp b/gdb/testsuite/gdb.python/python.exp
index 0e77256..787a294 100644
--- a/gdb/testsuite/gdb.python/python.exp
+++ b/gdb/testsuite/gdb.python/python.exp
@@ -314,6 +314,13 @@  gdb_test_multiple "set prompt $gdb_prompt " "set default prompt" {
     }
 }
 
+set working_dir ""
+gdb_test_multiple "pwd" "pwd" {
+    -re "Working directory (.*)\\.\[\r\n\]+$gdb_prompt $" {
+	set working_dir $expect_out(1,string)
+    }
+}
+
 gdb_test_multiple "python gdb.prompt_hook = program_prompt" "set the hook" {
     -re "\[\r\n\]$gdb_prompt $" {
 	pass "set programming hook"
@@ -346,7 +353,7 @@  gdb_test_multiple "set extended-prompt one two three " \
 
 gdb_test_multiple "set extended-prompt \\w " \
     "set extended prompt working directory" {
-    -re "\[\r\n\].*gdb.*testsuite.* $" {
+    -re "\[\r\n\][string_to_regexp $working_dir] $" {
 	pass "set extended prompt working directory"
     }
 }