public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH 2/3] Fix file name matching on remote host.
  2014-09-17 12:21 [PATCH 0/3] Fix gdb.python tests fails on remote host Yao Qi
  2014-09-17 12:21 ` [PATCH 3/3] Fix py-parameter.exp for " Yao Qi
@ 2014-09-17 12:21 ` Yao Qi
  2014-10-15  7:35   ` Yao Qi
  2014-09-17 12:21 ` [PATCH 1/3] Clean up gdb.python/ tests Yao Qi
  2014-09-24 13:11 ` [PATCH 0/3] Fix gdb.python tests fails on remote host Yao Qi
  3 siblings, 1 reply; 8+ messages in thread
From: Yao Qi @ 2014-09-17 12:21 UTC (permalink / raw)
  To: gdb-patches

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

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH 1/3] Clean up gdb.python/ tests
  2014-09-17 12:21 [PATCH 0/3] Fix gdb.python tests fails on remote host Yao Qi
  2014-09-17 12:21 ` [PATCH 3/3] Fix py-parameter.exp for " Yao Qi
  2014-09-17 12:21 ` [PATCH 2/3] Fix file name matching on " Yao Qi
@ 2014-09-17 12:21 ` Yao Qi
  2014-09-17 17:33   ` Sergio Durigan Junior
  2014-09-24 13:11 ` [PATCH 0/3] Fix gdb.python tests fails on remote host Yao Qi
  3 siblings, 1 reply; 8+ messages in thread
From: Yao Qi @ 2014-09-17 12:21 UTC (permalink / raw)
  To: gdb-patches

This patch is to clean up various gdb.python/*.exp tests, such as
removing trailing ".*" from the pattern and fix one typo I find during
reading the code.

gdb/testsuite:

2014-09-17  Yao Qi  <yao@codesourcery.com>

	* gdb.python/python.exp: Remove trailing ".*".  Fix typo
	locationn.
	* gdb.python/py-symbol.exp: Remove trailing ".*" in the
	pattern.
	* gdb.python/py-symtab.exp: Likewise.
---
 gdb/testsuite/gdb.python/py-symbol.exp | 2 +-
 gdb/testsuite/gdb.python/py-symtab.exp | 6 +++---
 gdb/testsuite/gdb.python/python.exp    | 6 +++---
 3 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/gdb/testsuite/gdb.python/py-symbol.exp b/gdb/testsuite/gdb.python/py-symbol.exp
index 9b6ba2e..eadbcad 100644
--- a/gdb/testsuite/gdb.python/py-symbol.exp
+++ b/gdb/testsuite/gdb.python/py-symbol.exp
@@ -117,7 +117,7 @@ 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"
+gdb_test "python print (t\[0\].symtab)" "gdb.python/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 e6ac9c3..d8f7d48 100644
--- a/gdb/testsuite/gdb.python/py-symtab.exp
+++ b/gdb/testsuite/gdb.python/py-symtab.exp
@@ -50,16 +50,16 @@ 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"
+gdb_test "python print (sal.symtab)" ".*gdb.python/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)" ".*gdb.python/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())" "testsuite/gdb.python/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 49f6e88..748700b 100644
--- a/gdb/testsuite/gdb.python/python.exp
+++ b/gdb/testsuite/gdb.python/python.exp
@@ -189,14 +189,14 @@ 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 locationn filename"
+gdb_test "python print (symtab\[1\]\[0\].symtab)" ".*gdb.python/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)" ".*gdb.python/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 +204,7 @@ 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"
+gdb_test "python print (symtab\[1\]\[0\].symtab)" ".*gdb.python/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

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH 0/3] Fix gdb.python tests fails on remote host
@ 2014-09-17 12:21 Yao Qi
  2014-09-17 12:21 ` [PATCH 3/3] Fix py-parameter.exp for " Yao Qi
                   ` (3 more replies)
  0 siblings, 4 replies; 8+ messages in thread
From: Yao Qi @ 2014-09-17 12:21 UTC (permalink / raw)
  To: gdb-patches

This patch set fixes part of gdb.python test fails on remote host
we've seen.  Patch 1 is a simple clean up.  Patch 2 is to adjust
tests on file name matching because the directory name may not
exist on host.  Patch 3 is to adjust the test not match $srcdir/$subdir
as it doesn't exist on remote host at all.

There are still some other test fails on remote host, and I am
looking into them.  I post these three first for review.


*** BLURB HERE ***

Yao Qi (3):
  Clean up gdb.python/ tests
  Fix file name matching on remote host.
  Fix py-parameter.exp for remote host

 gdb/testsuite/gdb.python/py-parameter.exp |  8 +++++++-
 gdb/testsuite/gdb.python/py-symbol.exp    |  7 ++++++-
 gdb/testsuite/gdb.python/py-symtab.exp    | 12 +++++++++---
 gdb/testsuite/gdb.python/python.exp       | 18 +++++++++++++++---
 4 files changed, 37 insertions(+), 8 deletions(-)

-- 
1.9.3

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH 3/3] Fix py-parameter.exp for remote host
  2014-09-17 12:21 [PATCH 0/3] Fix gdb.python tests fails on remote host Yao Qi
@ 2014-09-17 12:21 ` Yao Qi
  2014-09-17 12:21 ` [PATCH 2/3] Fix file name matching on " Yao Qi
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 8+ messages in thread
From: Yao Qi @ 2014-09-17 12:21 UTC (permalink / raw)
  To: gdb-patches

Test gdb.python/py-parameter.exp expects output "$srcdir/$subdir:\$cdir:\$cwd",
but proc gdb_reinitialize_dir doesn't set $srcdir/$subdir in search
directories on remote host because it doesn't exist on remote host.

proc gdb_reinitialize_dir { subdir } {
    global gdb_prompt

    if [is_remote host] {
	return ""
    }

It causes the fail below:

(gdb) python print (gdb.parameter ('directories'))^M
/tmp/gdb:$cdir:$cwd^M
(gdb) FAIL: gdb.python/py-parameter.exp: python print (gdb.parameter ('directories'))

This patch is to fix this fail by not matching $srcdir/$subdir on remote host.

gdb/testsuite:

2014-09-17  Yao Qi  <yao@codesourcery.com>

	* gdb.python/py-parameter.exp: Don't match $srcdir/$subdir on
	remote host.
---
 gdb/testsuite/gdb.python/py-parameter.exp | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/gdb/testsuite/gdb.python/py-parameter.exp b/gdb/testsuite/gdb.python/py-parameter.exp
index 8bc122f..36c109d 100644
--- a/gdb/testsuite/gdb.python/py-parameter.exp
+++ b/gdb/testsuite/gdb.python/py-parameter.exp
@@ -27,7 +27,14 @@ gdb_reinitialize_dir $srcdir/$subdir
 if { [skip_python_tests] } { continue }
 
 # We use "." here instead of ":" so that this works on win32 too.
-gdb_test "python print (gdb.parameter ('directories'))" "$srcdir/$subdir.\\\$cdir.\\\$cwd"
+if { [is_remote host] } {
+    # Don't match $srcdir/$subdir because proc gdb_reinitialize_dir
+    # doesn't set search directories on remote host.
+    set directories ".*\\\$cdir.\\\$cwd"
+} else {
+    set directories "$srcdir/$subdir.\\\$cdir.\\\$cwd"
+}
+gdb_test "python print (gdb.parameter ('directories'))" $directories
 
 # Test a simple boolean parameter.
 gdb_py_test_multiple "Simple gdb booleanparameter" \
-- 
1.9.3

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 1/3] Clean up gdb.python/ tests
  2014-09-17 12:21 ` [PATCH 1/3] Clean up gdb.python/ tests Yao Qi
@ 2014-09-17 17:33   ` Sergio Durigan Junior
  0 siblings, 0 replies; 8+ messages in thread
From: Sergio Durigan Junior @ 2014-09-17 17:33 UTC (permalink / raw)
  To: Yao Qi; +Cc: gdb-patches

On Wednesday, September 17 2014, Yao Qi wrote:

> This patch is to clean up various gdb.python/*.exp tests, such as
> removing trailing ".*" from the pattern and fix one typo I find during
> reading the code.
>
> gdb/testsuite:
>
> 2014-09-17  Yao Qi  <yao@codesourcery.com>
>
> 	* gdb.python/python.exp: Remove trailing ".*".  Fix typo
> 	locationn.
> 	* gdb.python/py-symbol.exp: Remove trailing ".*" in the
> 	pattern.
> 	* gdb.python/py-symtab.exp: Likewise.

Thanks for the cleanup, Yao.

This patch seems pretty much OK to me, although I like it when the files
in the ChangeLog entry are mentioned in the same order as they appear on
the diff :-).

Cheers,

> ---
>  gdb/testsuite/gdb.python/py-symbol.exp | 2 +-
>  gdb/testsuite/gdb.python/py-symtab.exp | 6 +++---
>  gdb/testsuite/gdb.python/python.exp    | 6 +++---
>  3 files changed, 7 insertions(+), 7 deletions(-)
>
> diff --git a/gdb/testsuite/gdb.python/py-symbol.exp b/gdb/testsuite/gdb.python/py-symbol.exp
> index 9b6ba2e..eadbcad 100644
> --- a/gdb/testsuite/gdb.python/py-symbol.exp
> +++ b/gdb/testsuite/gdb.python/py-symbol.exp
> @@ -117,7 +117,7 @@ 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"
> +gdb_test "python print (t\[0\].symtab)" "gdb.python/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 e6ac9c3..d8f7d48 100644
> --- a/gdb/testsuite/gdb.python/py-symtab.exp
> +++ b/gdb/testsuite/gdb.python/py-symtab.exp
> @@ -50,16 +50,16 @@ 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"
> +gdb_test "python print (sal.symtab)" ".*gdb.python/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)" ".*gdb.python/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())" "testsuite/gdb.python/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 49f6e88..748700b 100644
> --- a/gdb/testsuite/gdb.python/python.exp
> +++ b/gdb/testsuite/gdb.python/python.exp
> @@ -189,14 +189,14 @@ 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 locationn filename"
> +gdb_test "python print (symtab\[1\]\[0\].symtab)" ".*gdb.python/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)" ".*gdb.python/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 +204,7 @@ 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"
> +gdb_test "python print (symtab\[1\]\[0\].symtab)" ".*gdb.python/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

-- 
Sergio
GPG key ID: 0x65FC5E36
Please send encrypted e-mail if possible
http://sergiodj.net/

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 0/3] Fix gdb.python tests fails on remote host
  2014-09-17 12:21 [PATCH 0/3] Fix gdb.python tests fails on remote host Yao Qi
                   ` (2 preceding siblings ...)
  2014-09-17 12:21 ` [PATCH 1/3] Clean up gdb.python/ tests Yao Qi
@ 2014-09-24 13:11 ` Yao Qi
  2014-10-07 13:58   ` Yao Qi
  3 siblings, 1 reply; 8+ messages in thread
From: Yao Qi @ 2014-09-24 13:11 UTC (permalink / raw)
  To: gdb-patches

On 09/17/2014 08:17 PM, Yao Qi wrote:
> This patch set fixes part of gdb.python test fails on remote host
> we've seen.  Patch 1 is a simple clean up.  Patch 2 is to adjust
> tests on file name matching because the directory name may not
> exist on host.  Patch 3 is to adjust the test not match $srcdir/$subdir
> as it doesn't exist on remote host at all.
> 
> There are still some other test fails on remote host, and I am
> looking into them.  I post these three first for review.

Ping.  I'll adjust the files order in changelog in the commit, as
Sergio pointed out.  Any other comments on this patch set?

-- 
Yao (齐尧)

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 0/3] Fix gdb.python tests fails on remote host
  2014-09-24 13:11 ` [PATCH 0/3] Fix gdb.python tests fails on remote host Yao Qi
@ 2014-10-07 13:58   ` Yao Qi
  0 siblings, 0 replies; 8+ messages in thread
From: Yao Qi @ 2014-10-07 13:58 UTC (permalink / raw)
  To: gdb-patches

Yao Qi <yao@codesourcery.com> writes:

> On 09/17/2014 08:17 PM, Yao Qi wrote:
>> This patch set fixes part of gdb.python test fails on remote host
>> we've seen.  Patch 1 is a simple clean up.  Patch 2 is to adjust
>> tests on file name matching because the directory name may not
>> exist on host.  Patch 3 is to adjust the test not match $srcdir/$subdir
>> as it doesn't exist on remote host at all.
>> 
>> There are still some other test fails on remote host, and I am
>> looking into them.  I post these three first for review.
>
> Ping.  I'll adjust the files order in changelog in the commit, as
> Sergio pointed out.  Any other comments on this patch set?

Ping.

-- 
Yao (齐尧)

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 2/3] Fix file name matching on remote host.
  2014-09-17 12:21 ` [PATCH 2/3] Fix file name matching on " Yao Qi
@ 2014-10-15  7:35   ` Yao Qi
  0 siblings, 0 replies; 8+ messages in thread
From: Yao Qi @ 2014-10-15  7:35 UTC (permalink / raw)
  To: gdb-patches

Yao Qi <yao@codesourcery.com> writes:

> -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"

I updated the patch here to match "testsuite" in the pattern for
non-remote-host case.

I re-tested test cases affected by this patch series on x86-linux and
arm-linux-gnueabi on mingw32 host.  These three patches are pushed in.

-- 
Yao (齐尧)

Subject: [PATCH] Fix file name matching on remote host.

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.

diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index 79fc861..fd8898c 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,5 +1,12 @@
 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
 	pattern.
 	* gdb.python/py-symtab.exp: Likewise.
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..8b4bcb5 100644
--- a/gdb/testsuite/gdb.python/py-symtab.exp
+++ b/gdb/testsuite/gdb.python/py-symtab.exp
@@ -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"
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

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2014-10-15  7:35 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-09-17 12:21 [PATCH 0/3] Fix gdb.python tests fails on remote host Yao Qi
2014-09-17 12:21 ` [PATCH 3/3] Fix py-parameter.exp for " Yao Qi
2014-09-17 12:21 ` [PATCH 2/3] Fix file name matching on " Yao Qi
2014-10-15  7:35   ` 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-24 13:11 ` [PATCH 0/3] Fix gdb.python tests fails on remote host Yao Qi
2014-10-07 13:58   ` Yao Qi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).