[binutils-gdb] [gdb/testsuite] Fix gdb.python/py-symbol.exp with -readnow

Tom de Vries vries@sourceware.org
Wed Oct 28 20:04:42 GMT 2020


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

commit 99cc6b2abf5e80a1ecf5c0fada4a77a5fa4d302b
Author: Tom de Vries <tdevries@suse.de>
Date:   Wed Oct 28 21:04:12 2020 +0100

    [gdb/testsuite] Fix gdb.python/py-symbol.exp with -readnow
    
    When running test-case gdb.python/py-symbol.exp with target board readnow, we
    get:
    ...
    FAIL: gdb.python/py-symbol.exp: print line number of rr
    FAIL: gdb.python/py-symbol.exp: print value of rr
    ...
    
    These are FAILs due to PR25857.
    
    Mark these FAILs as KFAILs.
    
    gdb/testsuite/ChangeLog:
    
    2020-10-28  Tom de Vries  <tdevries@suse.de>
    
            * gdb.python/py-symbol.exp: Add KFAILs for -readnow.

Diff:
---
 gdb/testsuite/ChangeLog                |  4 ++++
 gdb/testsuite/gdb.python/py-symbol.exp | 32 ++++++++++++++++++++++++++++----
 2 files changed, 32 insertions(+), 4 deletions(-)

diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index 370a733d9d4..ee8f729cbf4 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,3 +1,7 @@
+2020-10-28  Tom de Vries  <tdevries@suse.de>
+
+	* gdb.python/py-symbol.exp: Add KFAILs for -readnow.
+
 2020-10-28  Tom de Vries  <tdevries@suse.de>
 
 	* gdb.ada/exec_changed.exp: Add KFAILs for -readnow.
diff --git a/gdb/testsuite/gdb.python/py-symbol.exp b/gdb/testsuite/gdb.python/py-symbol.exp
index caa7ddc8007..152a9173d21 100644
--- a/gdb/testsuite/gdb.python/py-symbol.exp
+++ b/gdb/testsuite/gdb.python/py-symbol.exp
@@ -29,6 +29,8 @@ if {[prepare_for_testing "failed to prepare" $testfile \
 # Skip all tests if Python scripting is not enabled.
 if { [skip_python_tests] } { continue }
 
+set readnow_p [readnow]
+
 # Check that we find all static symbols before the inferior has
 # started, at which point some of the symtabs might not have been
 # expanded.
@@ -61,14 +63,36 @@ gdb_test "python print (gdb.lookup_global_symbol('qq').needs_frame)" \
 
 # Similarly, test looking up a static symbol before we runto_main.
 set rr_line [gdb_get_line_number "line of rr"]
+set rr_line_alt [gdb_get_line_number "line of other rr" py-symbol-2.c]
 gdb_test "python print (gdb.lookup_global_symbol ('rr') is None)" "True" \
     "lookup_global_symbol for static var"
 
-gdb_test "python print (gdb.lookup_static_symbol ('rr').line)" "$rr_line" \
-    "print line number of rr"
+set cmd "python print (gdb.lookup_static_symbol ('rr').line)"
+gdb_test_multiple $cmd "print line number of rr" {
+    -re -wrap "$rr_line" {
+	pass $gdb_test_name
+    }
+    -re -wrap "$rr_line_alt" {
+	if { $readnow_p } {
+	    setup_kfail "symtab/25857" *-*-*
+	}
+	fail $gdb_test_name
+    }
+}
 
-gdb_test "python print (gdb.lookup_static_symbol ('rr').value ())" "42" \
-    "print value of rr"
+set cmd "python print (gdb.lookup_static_symbol ('rr').value ())"
+gdb_test_multiple $cmd "print value of rr" {
+    -re -wrap "42" {
+	pass $gdb_test_name
+    }
+    -re -wrap "99" {
+	if { $readnow_p } {
+	    setup_kfail "symtab/25857" *-*-*
+	}
+	fail $gdb_test_name
+    }
+}
+    
 
 gdb_test "python print (gdb.lookup_static_symbol ('rr').needs_frame)" \
     "False" \


More information about the Gdb-cvs mailing list