public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] Uniquify test names from gdb.python/{py-objfile.exp,py-pp-registration.exp}
@ 2015-07-24 21:13 Sergio Durigan Junior
  2015-07-28 21:40 ` Sergio Durigan Junior
  2015-07-29 10:36 ` Pedro Alves
  0 siblings, 2 replies; 6+ messages in thread
From: Sergio Durigan Junior @ 2015-07-24 21:13 UTC (permalink / raw)
  To: GDB Patches; +Cc: Sergio Durigan Junior

While running some regression tests, I noticed that the two Python
tests mentioned in the $SUBJECT contain non-unique names.  This is a
violation of our guidelines:

  <https://sourceware.org/gdb/wiki/GDBTestcaseCookbook#Make_sure_test_messages_are_unique>

And also makes things harder for BuildBot.  So I hacked both testcases
and made every test name unique.  I guess this could be considered an
obvious patch, but I decided to post it before pushing because others
may have different opinions about the names.

OK to apply?

gdb/testsuite/ChangeLog:
2015-07-24  Sergio Durigan Junior  <sergiodj@redhat.com>

	* gdb.python/py-objfile.exp: Make some tests have unique names.
	* gdb.python/py-pp-registration.exp: Likewise.
---
 gdb/testsuite/gdb.python/py-objfile.exp         | 15 +++++++++------
 gdb/testsuite/gdb.python/py-pp-registration.exp | 11 ++++++++---
 2 files changed, 17 insertions(+), 9 deletions(-)

diff --git a/gdb/testsuite/gdb.python/py-objfile.exp b/gdb/testsuite/gdb.python/py-objfile.exp
index 4de20c5..7dd094c 100644
--- a/gdb/testsuite/gdb.python/py-objfile.exp
+++ b/gdb/testsuite/gdb.python/py-objfile.exp
@@ -46,7 +46,7 @@ gdb_test "python print (objfile.username)" "${testfile}" \
   "Get objfile user name"
 
 gdb_test "python print (gdb.lookup_objfile (\"${testfile}\").filename)" \
-    "${testfile}"
+    "${testfile}" "print lookup_objfile filename"
 gdb_test "python print (gdb.lookup_objfile (\"junk\"))" \
     "Objfile not found\\.\r\n${python_error_text}"
 
@@ -56,7 +56,7 @@ if [string compare $binfile_build_id ""] {
     gdb_test "python print (objfile.build_id)" "$binfile_build_id" \
     "Get objfile build id"
     gdb_test "python print (gdb.lookup_objfile (\"$binfile_build_id\", by_build_id=True).filename)" \
-	"${testfile}"
+	"${testfile}" "print lookup_objfile filename by build-id"
 } else {
     unsupported "build-id is not supported by the compiler"
 }
@@ -64,9 +64,11 @@ if [string compare $binfile_build_id ""] {
 # Other lookup_objfile_by_build_id tests we can do, even if compiler doesn't
 # support them.
 gdb_test "python print (gdb.lookup_objfile (\"foo\", by_build_id=True))" \
-    "Not a valid build id\\.\r\n${python_error_text}"
+    "Not a valid build id\\.\r\n${python_error_text}" \
+    "print invalid file lookup_objfile by build-id"
 gdb_test "python print (gdb.lookup_objfile (\"1234abcdef\", by_build_id=True))" \
-    "Objfile not found\\.\r\n${python_error_text}"
+    "Objfile not found\\.\r\n${python_error_text}" \
+    "print invalid file lookup_objfile by build-id 2"
 
 gdb_test "python print (objfile.progspace)" "<gdb\.Progspace object at .*>" \
   "Get objfile program space"
@@ -104,7 +106,7 @@ if ![runto_main] {
     return 0
 }
 
-gdb_py_test_silent_cmd "python objfile = gdb.objfiles()\[0\]" \
+gdb_py_test_silent_cmd "python objfile = gdb.s()\[0\]" \
     "Get no-debug objfile file" 1
 
 gdb_test "python print (objfile.owner)" "None" \
@@ -131,7 +133,8 @@ gdb_test "p main" "= {int \\(\\)} $hex <main>" \
 # Separate debug files are not findable.
 if { [get_python_valueof "sep_objfile.build_id" "None"] != "None" } {
     gdb_test "python print (gdb.lookup_objfile (sep_objfile.build_id, by_build_id=True))" \
-	"Objfile not found\\.\r\n${python_error_text}"
+	"Objfile not found\\.\r\n${python_error_text}" \
+	"print lookup_objfile of separate debug file"
 }
 
 # An objfile that was a symlink to a differently named file is still
diff --git a/gdb/testsuite/gdb.python/py-pp-registration.exp b/gdb/testsuite/gdb.python/py-pp-registration.exp
index 2193407..60f3436 100644
--- a/gdb/testsuite/gdb.python/py-pp-registration.exp
+++ b/gdb/testsuite/gdb.python/py-pp-registration.exp
@@ -46,7 +46,8 @@ proc prepare_test { } {
 	return 0
     }
 
-    gdb_test_no_output "python exec (open ('${remote_python_file}').read ())"
+    gdb_test_no_output "python exec (open ('${remote_python_file}').read ())" \
+	"read file"
 
     gdb_test_no_output "py progspace = gdb.current_progspace()"
     gdb_test_no_output "py my_pretty_printer1 = build_pretty_printer1()"
@@ -108,9 +109,13 @@ with_test_prefix "replace" {
     gdb_test "py gdb.printing.register_pretty_printer(progspace, my_pretty_printer2, replace=False)" \
 	"RuntimeError: pretty-printer already registered: pp-test\r\nError while executing Python code."
 
-    test_printers "s1"
+    with_test_prefix "test printers 1" {
+	test_printers "s1"
+    }
 
     gdb_test_no_output "py gdb.printing.register_pretty_printer(progspace, my_pretty_printer2, replace=True)"
 
-    test_printers "s2"
+    with_test_prefix "test printers 2" {
+	test_printers "s2"
+    }
 }
-- 
2.4.3

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

* Re: [PATCH] Uniquify test names from gdb.python/{py-objfile.exp,py-pp-registration.exp}
  2015-07-24 21:13 [PATCH] Uniquify test names from gdb.python/{py-objfile.exp,py-pp-registration.exp} Sergio Durigan Junior
@ 2015-07-28 21:40 ` Sergio Durigan Junior
  2015-07-28 22:25   ` Pedro Alves
  2015-07-29 10:36 ` Pedro Alves
  1 sibling, 1 reply; 6+ messages in thread
From: Sergio Durigan Junior @ 2015-07-28 21:40 UTC (permalink / raw)
  To: GDB Patches

On Friday, July 24 2015, I wrote:

> While running some regression tests, I noticed that the two Python
> tests mentioned in the $SUBJECT contain non-unique names.  This is a
> violation of our guidelines:
>
>   <https://sourceware.org/gdb/wiki/GDBTestcaseCookbook#Make_sure_test_messages_are_unique>

I went ahead and pushed this:

  <https://sourceware.org/ml/gdb-cvs/2015-07/msg00195.html>

Let me know if there is any problem.

> And also makes things harder for BuildBot.  So I hacked both testcases
> and made every test name unique.  I guess this could be considered an
> obvious patch, but I decided to post it before pushing because others
> may have different opinions about the names.
>
> OK to apply?
>
> gdb/testsuite/ChangeLog:
> 2015-07-24  Sergio Durigan Junior  <sergiodj@redhat.com>
>
> 	* gdb.python/py-objfile.exp: Make some tests have unique names.
> 	* gdb.python/py-pp-registration.exp: Likewise.
> ---
>  gdb/testsuite/gdb.python/py-objfile.exp         | 15 +++++++++------
>  gdb/testsuite/gdb.python/py-pp-registration.exp | 11 ++++++++---
>  2 files changed, 17 insertions(+), 9 deletions(-)
>
> diff --git a/gdb/testsuite/gdb.python/py-objfile.exp b/gdb/testsuite/gdb.python/py-objfile.exp
> index 4de20c5..7dd094c 100644
> --- a/gdb/testsuite/gdb.python/py-objfile.exp
> +++ b/gdb/testsuite/gdb.python/py-objfile.exp
> @@ -46,7 +46,7 @@ gdb_test "python print (objfile.username)" "${testfile}" \
>    "Get objfile user name"
>  
>  gdb_test "python print (gdb.lookup_objfile (\"${testfile}\").filename)" \
> -    "${testfile}"
> +    "${testfile}" "print lookup_objfile filename"
>  gdb_test "python print (gdb.lookup_objfile (\"junk\"))" \
>      "Objfile not found\\.\r\n${python_error_text}"
>  
> @@ -56,7 +56,7 @@ if [string compare $binfile_build_id ""] {
>      gdb_test "python print (objfile.build_id)" "$binfile_build_id" \
>      "Get objfile build id"
>      gdb_test "python print (gdb.lookup_objfile (\"$binfile_build_id\", by_build_id=True).filename)" \
> -	"${testfile}"
> +	"${testfile}" "print lookup_objfile filename by build-id"
>  } else {
>      unsupported "build-id is not supported by the compiler"
>  }
> @@ -64,9 +64,11 @@ if [string compare $binfile_build_id ""] {
>  # Other lookup_objfile_by_build_id tests we can do, even if compiler doesn't
>  # support them.
>  gdb_test "python print (gdb.lookup_objfile (\"foo\", by_build_id=True))" \
> -    "Not a valid build id\\.\r\n${python_error_text}"
> +    "Not a valid build id\\.\r\n${python_error_text}" \
> +    "print invalid file lookup_objfile by build-id"
>  gdb_test "python print (gdb.lookup_objfile (\"1234abcdef\", by_build_id=True))" \
> -    "Objfile not found\\.\r\n${python_error_text}"
> +    "Objfile not found\\.\r\n${python_error_text}" \
> +    "print invalid file lookup_objfile by build-id 2"
>  
>  gdb_test "python print (objfile.progspace)" "<gdb\.Progspace object at .*>" \
>    "Get objfile program space"
> @@ -104,7 +106,7 @@ if ![runto_main] {
>      return 0
>  }
>  
> -gdb_py_test_silent_cmd "python objfile = gdb.objfiles()\[0\]" \
> +gdb_py_test_silent_cmd "python objfile = gdb.s()\[0\]" \
>      "Get no-debug objfile file" 1
>  
>  gdb_test "python print (objfile.owner)" "None" \
> @@ -131,7 +133,8 @@ gdb_test "p main" "= {int \\(\\)} $hex <main>" \
>  # Separate debug files are not findable.
>  if { [get_python_valueof "sep_objfile.build_id" "None"] != "None" } {
>      gdb_test "python print (gdb.lookup_objfile (sep_objfile.build_id, by_build_id=True))" \
> -	"Objfile not found\\.\r\n${python_error_text}"
> +	"Objfile not found\\.\r\n${python_error_text}" \
> +	"print lookup_objfile of separate debug file"
>  }
>  
>  # An objfile that was a symlink to a differently named file is still
> diff --git a/gdb/testsuite/gdb.python/py-pp-registration.exp b/gdb/testsuite/gdb.python/py-pp-registration.exp
> index 2193407..60f3436 100644
> --- a/gdb/testsuite/gdb.python/py-pp-registration.exp
> +++ b/gdb/testsuite/gdb.python/py-pp-registration.exp
> @@ -46,7 +46,8 @@ proc prepare_test { } {
>  	return 0
>      }
>  
> -    gdb_test_no_output "python exec (open ('${remote_python_file}').read ())"
> +    gdb_test_no_output "python exec (open ('${remote_python_file}').read ())" \
> +	"read file"
>  
>      gdb_test_no_output "py progspace = gdb.current_progspace()"
>      gdb_test_no_output "py my_pretty_printer1 = build_pretty_printer1()"
> @@ -108,9 +109,13 @@ with_test_prefix "replace" {
>      gdb_test "py gdb.printing.register_pretty_printer(progspace, my_pretty_printer2, replace=False)" \
>  	"RuntimeError: pretty-printer already registered: pp-test\r\nError while executing Python code."
>  
> -    test_printers "s1"
> +    with_test_prefix "test printers 1" {
> +	test_printers "s1"
> +    }
>  
>      gdb_test_no_output "py gdb.printing.register_pretty_printer(progspace, my_pretty_printer2, replace=True)"
>  
> -    test_printers "s2"
> +    with_test_prefix "test printers 2" {
> +	test_printers "s2"
> +    }
>  }
> -- 
> 2.4.3

-- 
Sergio
GPG key ID: 237A 54B1 0287 28BF 00EF  31F4 D0EB 7628 65FC 5E36
Please send encrypted e-mail if possible
http://sergiodj.net/

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

* Re: [PATCH] Uniquify test names from gdb.python/{py-objfile.exp,py-pp-registration.exp}
  2015-07-28 21:40 ` Sergio Durigan Junior
@ 2015-07-28 22:25   ` Pedro Alves
  0 siblings, 0 replies; 6+ messages in thread
From: Pedro Alves @ 2015-07-28 22:25 UTC (permalink / raw)
  To: Sergio Durigan Junior, GDB Patches

On 07/28/2015 10:40 PM, Sergio Durigan Junior wrote:
> On Friday, July 24 2015, I wrote:
> 
>> While running some regression tests, I noticed that the two Python
>> tests mentioned in the $SUBJECT contain non-unique names.  This is a
>> violation of our guidelines:
>>
>>   <https://sourceware.org/gdb/wiki/GDBTestcaseCookbook#Make_sure_test_messages_are_unique>
> 
> I went ahead and pushed this:
> 
>   <https://sourceware.org/ml/gdb-cvs/2015-07/msg00195.html>
> 
> Let me know if there is any problem.

There are a _ton_ of non-unique messages in the testsuite.  We need
to be able to move faster with such fixes if we ever want to
reach the state of full uniqueness.

Off the top of my head, if:

 - the change is done with awareness that with_test_prefix might
   be more appropriate at places than an explicit unique message

 - the new messages conform with usual style: message all in lowercase
   with no period at end

 - the patch follows usual conventions -- ChangeLog, self-contained
   commit log, etc.

then I think people should be able to go ahead and be a
more aggressive in pushing such patches in.

BTW, there's an umbrella bug about it:

  https://sourceware.org/bugzilla/show_bug.cgi?id=13443

Thanks,
Pedro Alves

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

* Re: [PATCH] Uniquify test names from gdb.python/{py-objfile.exp,py-pp-registration.exp}
  2015-07-24 21:13 [PATCH] Uniquify test names from gdb.python/{py-objfile.exp,py-pp-registration.exp} Sergio Durigan Junior
  2015-07-28 21:40 ` Sergio Durigan Junior
@ 2015-07-29 10:36 ` Pedro Alves
  2015-07-29 14:21   ` Sergio Durigan Junior
  1 sibling, 1 reply; 6+ messages in thread
From: Pedro Alves @ 2015-07-29 10:36 UTC (permalink / raw)
  To: Sergio Durigan Junior, GDB Patches

Hi Sergio,

This unfortunately caused regressions in the testsuite:

Running /home/pedro/gdb/mygit/build/../src/gdb/testsuite/gdb.python/py-objfile.exp ...
FAIL: gdb.python/py-objfile.exp: Get no-debug objfile file
FAIL: gdb.python/py-objfile.exp: Test owner of real objfile.
FAIL: gdb.python/py-objfile.exp: Add separate debug file file
FAIL: gdb.python/py-objfile.exp: Test owner of separate debug file
FAIL: gdb.python/py-objfile.exp: Test user-name of owner of separate debug file
FAIL: gdb.python/py-objfile.exp: print main with debug info
FAIL: gdb.python/py-objfile.exp: print lookup_objfile of separate debug file

> -gdb_py_test_silent_cmd "python objfile = gdb.objfiles()\[0\]" \
> +gdb_py_test_silent_cmd "python objfile = gdb.s()\[0\]" \

Looks like a typo snuck in here.

Breakpoint 1, 0x0000000000400594 in main ()
(gdb) python objfile = gdb.s()[0]
Traceback (most recent call last):
  File "<string>", line 1, in <module>
AttributeError: 'module' object has no attribute 's'
Error while executing Python code.
(gdb) FAIL: gdb.python/py-objfile.exp: Get no-debug objfile file

>      "Get no-debug objfile file" 1

Thanks,
Pedro Alves

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

* Re: [PATCH] Uniquify test names from gdb.python/{py-objfile.exp,py-pp-registration.exp}
  2015-07-29 10:36 ` Pedro Alves
@ 2015-07-29 14:21   ` Sergio Durigan Junior
  2015-07-29 14:34     ` Pedro Alves
  0 siblings, 1 reply; 6+ messages in thread
From: Sergio Durigan Junior @ 2015-07-29 14:21 UTC (permalink / raw)
  To: Pedro Alves; +Cc: GDB Patches

On Wednesday, July 29 2015, Pedro Alves wrote:

> Hi Sergio,
>
> This unfortunately caused regressions in the testsuite:
>
> Running /home/pedro/gdb/mygit/build/../src/gdb/testsuite/gdb.python/py-objfile.exp ...
> FAIL: gdb.python/py-objfile.exp: Get no-debug objfile file
> FAIL: gdb.python/py-objfile.exp: Test owner of real objfile.
> FAIL: gdb.python/py-objfile.exp: Add separate debug file file
> FAIL: gdb.python/py-objfile.exp: Test owner of separate debug file
> FAIL: gdb.python/py-objfile.exp: Test user-name of owner of separate debug file
> FAIL: gdb.python/py-objfile.exp: print main with debug info
> FAIL: gdb.python/py-objfile.exp: print lookup_objfile of separate debug file
>
>> -gdb_py_test_silent_cmd "python objfile = gdb.objfiles()\[0\]" \
>> +gdb_py_test_silent_cmd "python objfile = gdb.s()\[0\]" \
>
> Looks like a typo snuck in here.
>
> Breakpoint 1, 0x0000000000400594 in main ()
> (gdb) python objfile = gdb.s()[0]
> Traceback (most recent call last):
>   File "<string>", line 1, in <module>
> AttributeError: 'module' object has no attribute 's'
> Error while executing Python code.
> (gdb) FAIL: gdb.python/py-objfile.exp: Get no-debug objfile file

Ops, thanks for the report.  I confess I have no idea how this happened,
but I pushed a fix.

Sorry about that,

-- 
Sergio
GPG key ID: 237A 54B1 0287 28BF 00EF  31F4 D0EB 7628 65FC 5E36
Please send encrypted e-mail if possible
http://sergiodj.net/

From dac804dfa6389b71f50b5e169ffa4e239958e774 Mon Sep 17 00:00:00 2001
From: Sergio Durigan Junior <sergiodj@redhat.com>
Date: Wed, 29 Jul 2015 10:16:38 -0400
Subject: [PATCH] Fix typo in gdb.python/py-objfile.exp

My last commit d60a92216e5d599fed6b37c58c744debe38a0b24 introduced a
regression caused by a typo.  This fixes it.  Checked in as obvious.
Thanks to Pedro for reporting.

gdb/testsuite/ChangeLog:
2015-07-29  Sergio Durigan Junior  <sergiodj@redhat.com>

	* gdb.python/py-objfile.exp: Fix typo that snuck in from my last
	commit.
---
 gdb/testsuite/ChangeLog                 | 5 +++++
 gdb/testsuite/gdb.python/py-objfile.exp | 2 +-
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index ee0af2a..1f9bf98 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2015-07-29  Sergio Durigan Junior  <sergiodj@redhat.com>
+
+	* gdb.python/py-objfile.exp: Fix typo that snuck in from my last
+	commit.
+
 2015-07-29  Patrick Palka  <patrick@parcs.ath.cx>
 
 	* gdb.base/batch-preserve-term-settings.exp
diff --git a/gdb/testsuite/gdb.python/py-objfile.exp b/gdb/testsuite/gdb.python/py-objfile.exp
index 7dd094c..6e6dfe7 100644
--- a/gdb/testsuite/gdb.python/py-objfile.exp
+++ b/gdb/testsuite/gdb.python/py-objfile.exp
@@ -106,7 +106,7 @@ if ![runto_main] {
     return 0
 }
 
-gdb_py_test_silent_cmd "python objfile = gdb.s()\[0\]" \
+gdb_py_test_silent_cmd "python objfile = gdb.objfiles()\[0\]" \
     "Get no-debug objfile file" 1
 
 gdb_test "python print (objfile.owner)" "None" \
-- 
2.4.3

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

* Re: [PATCH] Uniquify test names from gdb.python/{py-objfile.exp,py-pp-registration.exp}
  2015-07-29 14:21   ` Sergio Durigan Junior
@ 2015-07-29 14:34     ` Pedro Alves
  0 siblings, 0 replies; 6+ messages in thread
From: Pedro Alves @ 2015-07-29 14:34 UTC (permalink / raw)
  To: Sergio Durigan Junior; +Cc: GDB Patches

On 07/29/2015 03:20 PM, Sergio Durigan Junior wrote:

> Ops, thanks for the report.  I confess I have no idea how this happened,
> but I pushed a fix.
> 
> Sorry about that,
> 

It happens, no worries.  Thanks for fixing.

Thanks,
Pedro Alves

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

end of thread, other threads:[~2015-07-29 14:34 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-07-24 21:13 [PATCH] Uniquify test names from gdb.python/{py-objfile.exp,py-pp-registration.exp} Sergio Durigan Junior
2015-07-28 21:40 ` Sergio Durigan Junior
2015-07-28 22:25   ` Pedro Alves
2015-07-29 10:36 ` Pedro Alves
2015-07-29 14:21   ` Sergio Durigan Junior
2015-07-29 14:34     ` Pedro Alves

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).