[python] Consistently use $srcfile in py-breakpoint.exp

Message ID 57bc7a73-cfb0-a2b5-f873-c48875dd66d4@redhat.com
State New, archived
Headers

Commit Message

Phil Muldoon April 30, 2018, 12:04 p.m. UTC
  This patch replaces py-breakpoint.exp's inconsistent use of string
literals for source file name checks and replaces all instances
with checks against $srcfile.

Cheers,

Phil

2018-04-30  Phil Muldoon  <pmuldoon@redhat.com>

	* gdb.python/py-breakpoint.exp (test_bkpt_basic): Use $srcfile
	over hard-coded test inferior source name.
	(test_bkpt_invisible): Ditto.
	(test_bkpt_temporary): Ditto.

--
  

Comments

Pedro Alves May 3, 2018, 5:06 p.m. UTC | #1
On 04/30/2018 01:04 PM, Phil Muldoon wrote:
> This patch replaces py-breakpoint.exp's inconsistent use of string
> literals for source file name checks and replaces all instances
> with checks against $srcfile.

Nit: I think there's one "replaces" too many above.  I think
something like this would be clearer:

 This patch fixes py-breakpoint.exp's inconsistent use of both
 string literals and $srcfile for source file name checks by
 using $srcfile throughout.

OK with that fixed.  Please push.

Thanks,
Pedro Alves
  

Patch

diff --git a/gdb/testsuite/gdb.python/py-breakpoint.exp b/gdb/testsuite/gdb.python/py-breakpoint.exp
index e89b9b8446..1dc8b93313 100644
--- a/gdb/testsuite/gdb.python/py-breakpoint.exp
+++ b/gdb/testsuite/gdb.python/py-breakpoint.exp
@@ -70,7 +70,7 @@  proc_with_prefix test_bkpt_basic { } {
 	"<gdb.Breakpoint object at $hex>" "Check obj exists @mult_line"
 
     gdb_test "python print (blist\[1\].location)" \
-	"py-breakpoint\.c:${mult_line}*" \
+	"$srcfile:${mult_line}*" \
 	"check breakpoint location @mult_line"
 
     # Check hit and ignore counts.
@@ -219,10 +219,10 @@  proc_with_prefix test_bkpt_invisible { } {
     gdb_test "python print (ilist\[0\])" \
 	"<gdb.Breakpoint object at $hex>" "Check invisible bp obj exists 1"
     gdb_test "python print (ilist\[0\].location)" \
-	"py-breakpoint\.c:$ibp_location*" "Check breakpoint location 1"
+	"$srcfile:$ibp_location*" "Check breakpoint location 1"
     gdb_test "python print (ilist\[0\].visible)" \
 	"True" "Check breakpoint visibility 1"
-    gdb_test "info breakpoints" "py-breakpoint\.c:$ibp_location.*" \
+    gdb_test "info breakpoints" "$srcfile:$ibp_location.*" \
 	"Check info breakpoints shows visible breakpoints"
     delete_breakpoints
     gdb_py_test_silent_cmd  "python ibp = gdb.Breakpoint(\"$ibp_location\", internal=True)" \
@@ -232,13 +232,13 @@  proc_with_prefix test_bkpt_invisible { } {
     gdb_test "python print (ilist\[0\])" \
 	"<gdb.Breakpoint object at $hex>" "Check invisible bp obj exists 2"
     gdb_test "python print (ilist\[0\].location)" \
-	"py-breakpoint\.c:$ibp_location*" "Check breakpoint location 2"
+	"$srcfile:$ibp_location*" "Check breakpoint location 2"
     gdb_test "python print (ilist\[0\].visible)" \
 	"False" "Check breakpoint visibility 2"
     gdb_test "info breakpoints" "No breakpoints or watchpoints.*" \
 	"Check info breakpoints does not show invisible breakpoints"
     gdb_test "maint info breakpoints" \
-	"py-breakpoint\.c:$ibp_location.*" \
+	"$srcfile:$ibp_location.*" \
 	"Check maint info breakpoints shows invisible breakpoints"
 }
 
@@ -436,9 +436,9 @@  proc_with_prefix test_bkpt_temporary { } {
     gdb_py_test_silent_cmd "python ibp = temp_bp(\"$ibp_location\", temporary=True)" \
 	"Set temporary breakpoint" 0
     gdb_test "info breakpoints" \
-	"2.*breakpoint.*del.*py-breakpoint\.c:$ibp_location.*" \
+	"2.*breakpoint.*del.*$srcfile:$ibp_location.*" \
 	"Check info breakpoints shows breakpoint with temporary status"
-    gdb_test "python print (ibp.location)" "py-breakpoint\.c:$ibp_location*" \
+    gdb_test "python print (ibp.location)" "$srcfile:$ibp_location*" \
 	"Check temporary breakpoint location"
     gdb_test "python print (ibp.temporary)" "True" \
 	"Check breakpoint temporary status"