From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 10921 invoked by alias); 29 Oct 2014 16:01:57 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 10906 invoked by uid 89); 29 Oct 2014 16:01:55 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.6 required=5.0 tests=AWL,BAYES_00,RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: e06smtp12.uk.ibm.com Received: from e06smtp12.uk.ibm.com (HELO e06smtp12.uk.ibm.com) (195.75.94.108) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-SHA encrypted) ESMTPS; Wed, 29 Oct 2014 16:01:53 +0000 Received: from /spool/local by e06smtp12.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 29 Oct 2014 16:01:50 -0000 Received: from d06dlp03.portsmouth.uk.ibm.com (9.149.20.15) by e06smtp12.uk.ibm.com (192.168.101.142) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Wed, 29 Oct 2014 16:01:49 -0000 Received: from b06cxnps3075.portsmouth.uk.ibm.com (d06relay10.portsmouth.uk.ibm.com [9.149.109.195]) by d06dlp03.portsmouth.uk.ibm.com (Postfix) with ESMTP id BFEC91B08023 for ; Wed, 29 Oct 2014 16:01:51 +0000 (GMT) Received: from d06av05.portsmouth.uk.ibm.com (d06av05.portsmouth.uk.ibm.com [9.149.37.229]) by b06cxnps3075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id s9TG1mrN19661098 for ; Wed, 29 Oct 2014 16:01:48 GMT Received: from d06av05.portsmouth.uk.ibm.com (localhost [127.0.0.1]) by d06av05.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id s9TG1msh002317 for ; Wed, 29 Oct 2014 10:01:48 -0600 Received: from br87z6lw.boeblingen.de.ibm.com (dyn-9-152-212-196.boeblingen.de.ibm.com [9.152.212.196]) by d06av05.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id s9TG0lWO032270 for ; Wed, 29 Oct 2014 10:01:48 -0600 From: Andreas Arnez 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 Message-Id: <1414598446-13831-5-git-send-email-arnez@linux.vnet.ibm.com> In-Reply-To: <1414597859-12523-1-git-send-email-arnez@linux.vnet.ibm.com> References: <1414597859-12523-1-git-send-email-arnez@linux.vnet.ibm.com> X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 14102916-0009-0000-0000-000001BCEA3C X-IsSubscribed: yes X-SW-Source: 2014-10/txt/msg00807.txt.bz2 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