Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Andreas Arnez <arnez@linux.vnet.ibm.com>
To: gdb-patches@sourceware.org
Subject: [PATCH 05/16] Eliminate literal line numbers in ending-run.exp
Date: Wed, 29 Oct 2014 16:01:00 -0000	[thread overview]
Message-ID: <1414598446-13831-5-git-send-email-arnez@linux.vnet.ibm.com> (raw)
In-Reply-To: <1414597859-12523-1-git-send-email-arnez@linux.vnet.ibm.com>

Remove literal line numbers from the regexps in ending-run.exp.  Add
appropriate eye-catchers to ending-run.c and refer to those instead.

gdb/testsuite/ChangeLog:

	* gdb.base/ending-run.c: Add eye-catchers.
	* gdb.base/ending-run.exp: Refer to eye-catchers instead of
	literal line numbers.
---
 gdb/testsuite/gdb.base/ending-run.c   |  4 ++--
 gdb/testsuite/gdb.base/ending-run.exp | 38 +++++++++++++++++++----------------
 2 files changed, 23 insertions(+), 19 deletions(-)

diff --git a/gdb/testsuite/gdb.base/ending-run.c b/gdb/testsuite/gdb.base/ending-run.c
index 8c67706..d857cf8 100644
--- a/gdb/testsuite/gdb.base/ending-run.c
+++ b/gdb/testsuite/gdb.base/ending-run.c
@@ -11,7 +11,7 @@ int callee( x )
 int x;
 #endif
 {
-    int y = x * x;
+    int y = x * x;		/* -break1- */
     return (y - 2);
 }
 
@@ -28,6 +28,6 @@ int main()
             printf( "%d ", callee( i ));
             fflush (stdout);
         }
-    printf( " Goodbye!\n" ); fflush (stdout);
+    printf( " Goodbye!\n" ); fflush (stdout); /* -break2- */
     return 0;
 }
diff --git a/gdb/testsuite/gdb.base/ending-run.exp b/gdb/testsuite/gdb.base/ending-run.exp
index 173cfd4..dc54d10 100644
--- a/gdb/testsuite/gdb.base/ending-run.exp
+++ b/gdb/testsuite/gdb.base/ending-run.exp
@@ -21,7 +21,9 @@
 
 # ending-run.exp -- Expect script to test ending a test run in gdb
 
-if { [prepare_for_testing ending-run.exp ending-run] } {
+standard_testfile
+
+if { [prepare_for_testing ${testfile}.exp $testfile] } {
     return -1
 }
 remote_exec build "rm -f core"
@@ -35,26 +37,28 @@ remote_exec build "rm -f core"
 gdb_test "b ending-run.c:1" ".*Breakpoint.*ending-run.c, line 1.*" \
 	"bpt at line before routine"
 
-gdb_test "b ending-run.c:14" \
-	".*Note.*also.*Breakpoint 2.*ending-run.c, line 14.*" \
-	"b ending-run.c:14, one"
+set break1_line [gdb_get_line_number "-break1-"]
+gdb_test "b ending-run.c:$break1_line" \
+	".*Note.*also.*Breakpoint 2.*ending-run.c, line $break1_line.*" \
+	"b ending-run.c:$break1_line, one"
 
 # Set up to go to the next-to-last line of the program
 #
-gdb_test "b ending-run.c:31" ".*Breakpoint 3.*ending-run.c, line 31.*"
+set break2_line [gdb_get_line_number "-break2-"]
+gdb_test "b ending-run.c:$break2_line" ".*Breakpoint 3.*ending-run.c, line $break2_line.*"
 
 # Expect to hit the bp at line "1", but symbolize this
 # as line "13".  Then try to clear it--this should work.
 #
 gdb_run_cmd
-gdb_test "" ".*Breakpoint.*1.*callee.*14.*" "run"
+gdb_test "" ".*Breakpoint.*1.*callee.*$break1_line.*" "run"
 
 gdb_test "cle" ".*Deleted breakpoints 1 2.*" "clear worked"
 gdb_test_multiple "i b" "cleared bp at line before routine" {
     -re ".* breakpoint .* breakpoint .*$gdb_prompt $" { 
 	fail "cleared bp at line before routine" 
     }
-    -re ".*3.*main.*31.*$gdb_prompt $" { 
+    -re ".*3.*main.*$break2_line.*$gdb_prompt $" { 
 	pass "cleared bp at line before routine" 
     }
 }
@@ -62,15 +66,15 @@ gdb_test_multiple "i b" "cleared bp at line before routine" {
 # Test some other "clear" combinations
 #
 gdb_test "b ending-run.c:1" ".*Breakpoint.*4.*"
-gdb_test "b ending-run.c:14" ".*Note.*also.*Breakpoint.*5.*" "b ending-run.c:14, two"
-gdb_test "cle ending-run.c:14" \
+gdb_test "b ending-run.c:$break1_line" ".*Note.*also.*Breakpoint.*5.*" "b ending-run.c:$break1_line, two"
+gdb_test "cle ending-run.c:$break1_line" \
 	".*Deleted breakpoint 5.*" "Cleared 2 by line"
 
-gdb_test_multiple "info line ending-run.c:14" "" {
+gdb_test_multiple "info line ending-run.c:$break1_line" "" {
     -re ".*address (0x\[0-9a-fA-F]*).*$gdb_prompt $" {
         set line_nine $expect_out(1,string)
-        gdb_test "b ending-run.c:14" ".*Breakpoint 6.*ending-run.c, line 14.*"
-        gdb_test "b *$line_nine" ".*Note.*also.*Breakpoint 7.*" "Breakpoint 7 at *ending-run.c:14"
+        gdb_test "b ending-run.c:$break1_line" ".*Breakpoint 6.*ending-run.c, line $break1_line.*"
+        gdb_test "b *$line_nine" ".*Note.*also.*Breakpoint 7.*" "Breakpoint 7 at *ending-run.c:$break1_line"
         gdb_test "cle" ".*Deleted breakpoints 4 6 7.*" "Clear 2 by default"
     }
     -re ".*$gdb_prompt $" {
@@ -82,7 +86,7 @@ gdb_test_multiple "i b" "all set to continue" {
     -re ".* breakpoint .* breakpoint .*$gdb_prompt $" {
         fail "all set to continue (didn't clear bps)" 
     }
-    -re ".*3.*main.*31.*$gdb_prompt $" {
+    -re ".*3.*main.*$break2_line.*$gdb_prompt $" {
         pass "all set to continue"
     }
     -re ".*$gdb_prompt $" {
@@ -95,13 +99,13 @@ gdb_test_multiple "i b" "all set to continue" {
 # is output from the program.
 #
 if ![gdb_skip_stdio_test "cont"] {
-    gdb_test "cont" ".*1 2 7 14 23 34 47 62 79.*Breakpoint.*31.*"
+    gdb_test "cont" ".*1 2 7 14 23 34 47 62 79.*Breakpoint.*$break2_line.*"
 } else {
-    gdb_test "cont" ".*Breakpoint.*31.*"
+    gdb_test "cont" ".*Breakpoint.*$break2_line.*"
 }
 
 if ![gdb_skip_stdio_test "Step to return"] {
-    gdb_test "next" ".*Goodbye!.*32.*" \
+    gdb_test "next" ".*Goodbye!.*[expr {$break2_line + 1}].*" \
 	    "Step to return"
 } else {
     gdb_test "next" ".*" ""
@@ -113,7 +117,7 @@ set program_exited 0
 set nexted 0
 
 gdb_test_multiple "next" "step out of main" {
-    -re "33\[ \t\]+\}.*$gdb_prompt $" {
+    -re "[expr {$break2_line + 2}]\[ \t\]+\}.*$gdb_prompt $" {
 	# sometimes we stop at the closing brace, if so, do another next
 	if { $nexted } {
 	    fail "step out of main"
-- 
1.8.4.2


  parent reply	other threads:[~2014-10-29 16:01 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-29 15:51 [PATCH 00/16] GDB testsuite cleanup, fix warnings with -std=gnu11 Andreas Arnez
2014-10-29 16:00 ` [PATCH 01/16] Eliminate literal line numbers in so-impl-ld.exp Andreas Arnez
2014-10-29 16:22   ` Sergio Durigan Junior
2014-10-29 18:26     ` Andreas Arnez
2014-10-29 22:11       ` Sergio Durigan Junior
2014-10-31 20:59         ` Sergio Durigan Junior
2014-11-13 13:15   ` Yao Qi
2014-10-29 16:01 ` Andreas Arnez [this message]
2014-11-13 13:44   ` [PATCH 05/16] Eliminate literal line numbers in ending-run.exp Yao Qi
2014-10-29 16:01 ` [PATCH 02/16] Eliminate literal line numbers in dbx.exp Andreas Arnez
2014-11-13 13:18   ` Yao Qi
2014-11-13 14:16     ` Andreas Arnez
2014-11-14  0:26       ` Yao Qi
2014-10-29 16:01 ` [PATCH 03/16] Eliminate literal line numbers in call-ar-st.exp Andreas Arnez
2014-11-13 13:33   ` Yao Qi
2014-10-29 16:01 ` [PATCH 04/16] Eliminate literal line numbers in call-rt-st.exp Andreas Arnez
2014-11-13 13:36   ` Yao Qi
2014-10-29 16:02 ` [PATCH 08/16] Eliminate literal line numbers in shlib-call.exp Andreas Arnez
2014-10-29 16:02 ` [PATCH 09/16] Eliminate literal line numbers in mi-console.exp Andreas Arnez
2014-10-29 16:02 ` [PATCH 07/16] Eliminate literal line numbers in jump.exp Andreas Arnez
2014-10-29 16:02 ` [PATCH 06/16] Eliminate literal line numbers in foll-exec.exp Andreas Arnez
2014-10-29 16:03 ` [PATCH 10/16] 'callfuncs' test case: Fix typo in prototyped version Andreas Arnez
2014-10-29 16:03 ` [PATCH 11/16] Drop non-prototype C function header variants: solib1.c Andreas Arnez
2014-10-29 16:03 ` [PATCH 12/16] Drop non-prototype C function header variants: 'break' test case Andreas Arnez
2014-10-29 16:04 ` [PATCH 13/16] Drop non-prototype C function header variants: 'list' " Andreas Arnez
2014-11-12 12:33   ` Pedro Alves
2014-11-12 15:05     ` Andreas Arnez
2014-11-12 15:18       ` Pedro Alves
2014-10-29 16:04 ` [PATCH 14/16] Drop non-prototype C function header variants: 'sepdebug' " Andreas Arnez
2014-10-29 16:04 ` [PATCH 16/16] GDB testsuite: Fix warnings with -std=gnu11 Andreas Arnez
2014-10-29 16:04 ` [PATCH 15/16] GDB testsuite: drop non-prototype C function header variants Andreas Arnez
2014-11-13 14:06 ` [PATCH 00/16] GDB testsuite cleanup, fix warnings with -std=gnu11 Yao Qi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1414598446-13831-5-git-send-email-arnez@linux.vnet.ibm.com \
    --to=arnez@linux.vnet.ibm.com \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox