diff mbox

Match the working directory on remote host

Message ID 1413466760-25886-1-git-send-email-yao@codesourcery.com
State New
Headers show

Commit Message

Yao Qi Oct. 16, 2014, 1:39 p.m. UTC
The test in gdb.python/python.exp tests "extended-prompt" and expects
working directory is printed.  However, working directory on remote
host doesn't have "gdb/testsuite", so the test fails on remote host
like:

set extended-prompt \w ^M
^M
/home/yao FAIL: gdb.python/python.exp: set extended prompt working directory (timeout)

This patch is to get the working directory first, and use it to match
the output of "set extended-prompt \\w ".  It works for remote host
and non remote host.

gdb/testsuite:

2014-10-16  Yao Qi  <yao@codesourcery.com>

	* gdb.python/python.exp: Get working directory and match the
	output of "set extended-prompt \\w " with it.
---
 gdb/testsuite/gdb.python/python.exp | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

Comments

Pedro Alves Oct. 16, 2014, 5:57 p.m. UTC | #1
On 10/16/2014 02:39 PM, Yao Qi wrote:
> The test in gdb.python/python.exp tests "extended-prompt" and expects
> working directory is printed.  However, working directory on remote
> host doesn't have "gdb/testsuite", so the test fails on remote host
> like:
> 
> set extended-prompt \w ^M
> ^M
> /home/yao FAIL: gdb.python/python.exp: set extended prompt working directory (timeout)
> 
> This patch is to get the working directory first, and use it to match
> the output of "set extended-prompt \\w ".  It works for remote host
> and non remote host.
> 

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.

>  	pass "set extended prompt working directory"
>      }
>  }

Thanks,
Pedro Alves
diff mbox

Patch

diff --git a/gdb/testsuite/gdb.python/python.exp b/gdb/testsuite/gdb.python/python.exp
index 3df9347..30785b9 100644
--- a/gdb/testsuite/gdb.python/python.exp
+++ b/gdb/testsuite/gdb.python/python.exp
@@ -298,6 +298,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"
@@ -330,7 +337,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\]${working_dir} $" {
 	pass "set extended prompt working directory"
     }
 }