This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH] Match the working directory on remote host
- From: Yao Qi <yao at codesourcery dot com>
- To: Pedro Alves <palves at redhat dot com>
- Cc: <gdb-patches at sourceware dot org>
- Date: Thu, 30 Oct 2014 10:46:20 +0800
- Subject: Re: [PATCH] Match the working directory on remote host
- Authentication-results: sourceware.org; auth=none
- References: <1413466760-25886-1-git-send-email-yao at codesourcery dot com> <5440071B dot 2040801 at redhat dot com>
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.
--
Yao (éå)
Subject: [PATCH] Match the working directory on remote host
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-30 Yao Qi <yao@codesourcery.com>
* gdb.python/python.exp: Get working directory and match the
output of "set extended-prompt \\w " with it.
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"
}
}