This is the mail archive of the gdb-cvs@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[binutils-gdb] Fix unstable test names in gdb.python/py-objfile.exp


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=ad9b8f5d022f777f32cceab9856f47a5b6afcce1

commit ad9b8f5d022f777f32cceab9856f47a5b6afcce1
Author: Pedro Alves <palves@redhat.com>
Date:   Tue Oct 24 10:43:34 2017 +0100

    Fix unstable test names in gdb.python/py-objfile.exp
    
    Currently, if you diff testsuite/gdb.sum of different builds you see
    this spurious hunk:
    
      -PASS: gdb.python/py-objfile.exp: get python valueof "sep_objfile.build_id" (6a0bfcab663f9810ccff33c756afdebb940037d4)
      +PASS: gdb.python/py-objfile.exp: get python valueof "sep_objfile.build_id" (1f5531c657c57777b05fc95baa0025fd1d115c3b)
    
    Fix this by syncing get_python_valueof with get_integer_valueof, which
    stopped outputting the value in commit 2f20e312aad6
    ("get_integer_valueof: Don't output value in test name").
    
    After this commit we'll show:
    
      PASS: gdb.python/py-objfile.exp: get python valueof "sep_objfile.build_id"
    
    As the comment explicitly says get_python_valueof is modeled on
    get_integer_valueof, I went ahead and also added the optional 'test'
    parameter while at it.
    
    gdb/testsuite/ChangeLog:
    2017-10-24  Pedro Alves  <palves@redhat.com>
    
    	* lib/gdb-python.exp (get_python_valueof): Add 'test' optional
    	parameter and handle it.  Don't output read value in test name.

Diff:
---
 gdb/testsuite/ChangeLog          |  5 +++++
 gdb/testsuite/lib/gdb-python.exp | 16 ++++++++++------
 2 files changed, 15 insertions(+), 6 deletions(-)

diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index 31a2172..c0a1417 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,5 +1,10 @@
 2017-10-24  Pedro Alves  <palves@redhat.com>
 
+	* lib/gdb-python.exp (get_python_valueof): Add 'test' optional
+	parameter and handle it.  Don't output read value in test name.
+
+2017-10-24  Pedro Alves  <palves@redhat.com>
+
 	* gdb.gdb/unittest.exp ('maintenance check xml-descriptions'): Use
 	custom test name.
 
diff --git a/gdb/testsuite/lib/gdb-python.exp b/gdb/testsuite/lib/gdb-python.exp
index 1fef27e..c0c0d68 100644
--- a/gdb/testsuite/lib/gdb-python.exp
+++ b/gdb/testsuite/lib/gdb-python.exp
@@ -46,19 +46,23 @@ proc gdb_py_test_multiple { name args } {
     return 0
 }
 
-# Return the result of python expression EXPR.
-# DEFAULT is returned if there's an error.
-# This is modelled after get_integer_valueof.
+# Return the result of python expression EXPR.  DEFAULT is returned if
+# there's an error.  TEST is the test message to use.  It can be
+# omitted, in which case a test message is built from EXP.  This is
+# modeled after get_integer_valueof.
 
-proc get_python_valueof { exp default } {
+proc get_python_valueof { exp default {test ""} } {
     global gdb_prompt
 
-    set test "get python valueof \"${exp}\""
+    if {$test == ""} {
+	set test "get python valueof \"${exp}\""
+    }
+
     set val ${default}
     gdb_test_multiple "python print (\"valueof: %s\" % (${exp}))" "$test" {
 	-re "valueof: (\[^\r\n\]*)\[\r\n\]*$gdb_prompt $" {
 	    set val $expect_out(1,string)
-	    pass "$test ($val)"
+	    pass "$test"
 	}
 	timeout {
 	    fail "$test (timeout)"


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]