From: Yao Qi <yao@codesourcery.com>
To: <gdb-patches@sourceware.org>
Subject: [PATCH 2/3] Fix file name matching on remote host.
Date: Wed, 17 Sep 2014 12:21:00 -0000 [thread overview]
Message-ID: <1410956225-12592-3-git-send-email-yao@codesourcery.com> (raw)
In-Reply-To: <1410956225-12592-1-git-send-email-yao@codesourcery.com>
I see the following fails in the remote host testing we do for mingw32
hosted GDB,
python print (symtab[1][0].symtab)^M
python.c^M
(gdb) FAIL: gdb.python/python.exp: Test decode_line current locationn filename
python print (symtab[1][0].symtab)^M
python.c^M
(gdb) FAIL: gdb.python/python.exp: Test decode_line python.c:26 filename
The test cases doesn't consider remote host and assumes that directory
on build also exists on host. In this patch, we only match file base
name if host is remote, otherwise, match file with dir name.
gdb/testsuite:
2014-09-17 Yao Qi <yao@codesourcery.com>
* gdb.python/python.exp: Match file base name if host is
* remote, otherwise match file name with dir name.
* gdb.python/py-symbol.exp: Likewise.
* gdb.python/py-symtab.exp: Likewise.
---
gdb/testsuite/gdb.python/py-symbol.exp | 7 ++++++-
gdb/testsuite/gdb.python/py-symtab.exp | 12 +++++++++---
gdb/testsuite/gdb.python/python.exp | 18 +++++++++++++++---
3 files changed, 30 insertions(+), 7 deletions(-)
diff --git a/gdb/testsuite/gdb.python/py-symbol.exp b/gdb/testsuite/gdb.python/py-symbol.exp
index eadbcad..2b06f06 100644
--- a/gdb/testsuite/gdb.python/py-symbol.exp
+++ b/gdb/testsuite/gdb.python/py-symbol.exp
@@ -117,7 +117,12 @@ gdb_test "python print (t\[0\].addr_class == gdb.SYMBOL_LOC_CONST)" "True" "Test
gdb_test "python print (t\[0\].type)" "enum tag" "Get type"
# Test symtab attribute.
-gdb_test "python print (t\[0\].symtab)" "gdb.python/py-symbol.c" "Get symtab"
+if { [is_remote host] } {
+ set py_symbol_c [string_to_regexp $srcfile]
+} else {
+ set py_symbol_c [string_to_regexp ${srcdir}/${subdir}/${srcfile}]
+}
+gdb_test "python print (t\[0\].symtab)" "${py_symbol_c}" "Get symtab"
# C++ tests
# Recompile binary.
diff --git a/gdb/testsuite/gdb.python/py-symtab.exp b/gdb/testsuite/gdb.python/py-symtab.exp
index d8f7d48..07d6224 100644
--- a/gdb/testsuite/gdb.python/py-symtab.exp
+++ b/gdb/testsuite/gdb.python/py-symtab.exp
@@ -50,16 +50,22 @@ gdb_py_test_silent_cmd "step" "Step to the next line" 0
gdb_py_test_silent_cmd "python new_pc = gdb.selected_frame().find_sal().pc" "Get new PC" 0
# Test sal.
-gdb_test "python print (sal.symtab)" ".*gdb.python/py-symbol.c" "Test symtab"
+if { [is_remote host] } {
+ set py_symbol_c [string_to_regexp $srcfile]
+} else {
+ set py_symbol_c [string_to_regexp ${srcdir}/${subdir}/${srcfile}]
+}
+
+gdb_test "python print (sal.symtab)" ".*${py_symbol_c}" "Test symtab"
gdb_test "python print (sal.pc)" "${decimal}" "Test sal.pc"
gdb_test "python print (sal.last == (new_pc - 1))" "True" "Test sal.last"
gdb_test "python print (sal.line)" "$line_no" "Test sal.line"
gdb_test "python print (sal.is_valid())" "True" "Test sal.is_valid"
# Test symbol table.
-gdb_test "python print (symtab.filename)" ".*gdb.python/py-symbol.c" "Test symtab.filename"
+gdb_test "python print (symtab.filename)" ".*${py_symbol_c}" "Test symtab.filename"
gdb_test "python print (symtab.objfile)" "<gdb.Objfile object at ${hex}>" "Test symtab.objfile"
-gdb_test "python print (symtab.fullname())" "testsuite/gdb.python/py-symbol.c" "Test symtab.fullname"
+gdb_test "python print (symtab.fullname())" "${py_symbol_c}" "Test symtab.fullname"
gdb_test "python print (symtab.is_valid())" "True" "Test symtab.is_valid()"
gdb_test "python print (\"qq\" in global_symbols)" "True" "Test qq in global symbols"
gdb_test "python print (\"func\" in global_symbols)" "True" "Test func in global symbols"
diff --git a/gdb/testsuite/gdb.python/python.exp b/gdb/testsuite/gdb.python/python.exp
index 748700b..3df9347 100644
--- a/gdb/testsuite/gdb.python/python.exp
+++ b/gdb/testsuite/gdb.python/python.exp
@@ -189,14 +189,20 @@ gdb_py_test_silent_cmd "python symtab = gdb.decode_line()" "test decode_line cur
gdb_test "python print (len(symtab))" "2" "Test decode_line current location"
gdb_test "python print (symtab\[0\])" "None" "Test decode_line expression parse"
gdb_test "python print (len(symtab\[1\]))" "1" "Test decode_line current location"
-gdb_test "python print (symtab\[1\]\[0\].symtab)" ".*gdb.python/python.c" "Test decode_line current location filename"
+
+if { [is_remote host] } {
+ set python_c [string_to_regexp "python.c"]
+} else {
+ set python_c [string_to_regexp "gdb.python/python.c"]
+}
+gdb_test "python print (symtab\[1\]\[0\].symtab)" ".*${python_c}" "Test decode_line current location filename"
gdb_test "python print (symtab\[1\]\[0\].line)" "$lineno" "Test decode_line current location line number"
gdb_py_test_silent_cmd "python symtab = gdb.decode_line(\"python.c:26 if foo\")" "test decode_line python.c:26" 1
gdb_test "python print (len(symtab))" "2" "Test decode_line python.c:26 length"
gdb_test "python print (symtab\[0\])" "if foo" "Test decode_line expression parse"
gdb_test "python print (len(symtab\[1\]))" "1" "Test decode_line python.c:26 length"
-gdb_test "python print (symtab\[1\]\[0\].symtab)" ".*gdb.python/python.c" "Test decode_line python.c:26 filename"
+gdb_test "python print (symtab\[1\]\[0\].symtab)" ".*${python_c}" "Test decode_line python.c:26 filename"
gdb_test "python print (symtab\[1\]\[0\].line)" "26" "Test decode_line python.c:26 line number"
gdb_test "python gdb.decode_line(\"randomfunc\")" \
@@ -204,7 +210,13 @@ gdb_test "python gdb.decode_line(\"randomfunc\")" \
gdb_py_test_silent_cmd "python symtab = gdb.decode_line(\"func1\")" "test decode_line func1()" 1
gdb_test "python print (len(symtab))" "2" "Test decode_line func1 length"
gdb_test "python print (len(symtab\[1\]))" "1" "Test decode_line func1 length"
-gdb_test "python print (symtab\[1\]\[0\].symtab)" ".*gdb.python/python-1.c" "Test decode_line func1 filename"
+
+if { [is_remote host] } {
+ set python_1_c [string_to_regexp "python-1.c"]
+} else {
+ set python_1_c [string_to_regexp "gdb.python/python-1.c"]
+}
+gdb_test "python print (symtab\[1\]\[0\].symtab)" ".*${python_1_c}" "Test decode_line func1 filename"
gdb_test "python print (symtab\[1\]\[0\].line)" "19" "Test decode_line func1 line number"
gdb_py_test_silent_cmd {python symtab = gdb.decode_line ("func1,func2")} \
"test decode_line func1,func2" 1
--
1.9.3
next prev parent reply other threads:[~2014-09-17 12:21 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-09-17 12:21 [PATCH 0/3] Fix gdb.python tests fails " Yao Qi
2014-09-17 12:21 ` Yao Qi [this message]
2014-10-15 7:35 ` [PATCH 2/3] Fix file name matching " Yao Qi
2014-09-17 12:21 ` [PATCH 1/3] Clean up gdb.python/ tests Yao Qi
2014-09-17 17:33 ` Sergio Durigan Junior
2014-09-17 12:21 ` [PATCH 3/3] Fix py-parameter.exp for remote host Yao Qi
2014-09-24 13:11 ` [PATCH 0/3] Fix gdb.python tests fails on " Yao Qi
2014-10-07 13:58 ` Yao Qi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1410956225-12592-3-git-send-email-yao@codesourcery.com \
--to=yao@codesourcery.com \
--cc=gdb-patches@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox