Fix file name matching on remote host.
authorYao Qi <yao@codesourcery.com>
Mon, 15 Sep 2014 09:40:54 +0000 (17:40 +0800)
committerYao Qi <yao@codesourcery.com>
Wed, 15 Oct 2014 07:33:24 +0000 (15:33 +0800)
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-10-15  Yao Qi  <yao@codesourcery.com>

* gdb.python/py-symbol.exp: Match file base name if host is
remote, otherwise match file name with dir name.
* gdb.python/py-symtab.exp: Likewise.
* gdb.python/python.exp: Likewise.

gdb/testsuite/ChangeLog
gdb/testsuite/gdb.python/py-symbol.exp
gdb/testsuite/gdb.python/py-symtab.exp
gdb/testsuite/gdb.python/python.exp

index 79fc861f02f2114a559e15d0018f5f553c373689..fd8898c7ba4da59c6c3dc3bfb36f4e81a10a9c36 100644 (file)
@@ -1,3 +1,10 @@
+2014-10-15  Yao Qi  <yao@codesourcery.com>
+
+       * gdb.python/py-symbol.exp: Match file base name if host is
+       remote, otherwise match file name with dir name.
+       * gdb.python/py-symtab.exp: Likewise.
+       * gdb.python/python.exp: Likewise.
+
 2014-10-15  Yao Qi  <yao@codesourcery.com>
 
        * gdb.python/py-symbol.exp: Remove trailing ".*" in the
index eadbcad50871d7605694e09a3f3512d154ab5d3f..2b06f063d5c480c54dcc7a8677a7f8a978666c95 100644 (file)
@@ -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.
index d8f7d484e3e9a67f7da2555a1aeeb9af35d7d0a2..8b4bcb5f56dfe3974222758362128e4a08e98593 100644 (file)
@@ -50,16 +50,24 @@ 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]
+    set full_py_symbol_c $py_symbol_c
+} else {
+    set py_symbol_c [string_to_regexp ${srcdir}/${subdir}/${srcfile}]
+    set full_py_symbol_c [string_to_regexp testsuite/${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())" ".*${full_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"
index 748700b42966f9d5be7f35a8871487b69039b589..3df934771c1ecf9544a7089156aedecc174e77e4 100644 (file)
@@ -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
This page took 0.031845 seconds and 4 git commands to generate.