From patchwork Mon Sep 4 19:21:26 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Marchi X-Patchwork-Id: 22614 Received: (qmail 117507 invoked by alias); 4 Sep 2017 19:21:47 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 117495 invoked by uid 89); 4 Sep 2017 19:21:46 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-26.4 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3 autolearn=ham version=3.3.2 spammy= X-HELO: sesbmg22.ericsson.net Received: from sesbmg22.ericsson.net (HELO sesbmg22.ericsson.net) (193.180.251.48) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 04 Sep 2017 19:21:41 +0000 Received: from ESESSHC018.ericsson.se (Unknown_Domain [153.88.183.72]) by sesbmg22.ericsson.net (Symantec Mail Security) with SMTP id 46.B6.22679.2C7ADA95; Mon, 4 Sep 2017 21:21:38 +0200 (CEST) Received: from EUR03-DB5-obe.outbound.protection.outlook.com (153.88.183.145) by oa.msg.ericsson.com (153.88.183.72) with Microsoft SMTP Server (TLS) id 14.3.352.0; Mon, 4 Sep 2017 21:21:37 +0200 Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=simon.marchi@ericsson.com; Received: from elxacz23q12.localdomain (80.216.43.226) by DBXPR07MB317.eurprd07.prod.outlook.com (2a01:111:e400:941d::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.35.3; Mon, 4 Sep 2017 19:21:36 +0000 From: Simon Marchi To: CC: Simon Marchi Subject: [pushed] gdb.base/commands.exp: Test loop_break and loop_continue in nested loops Date: Mon, 4 Sep 2017 21:21:26 +0200 Message-ID: <1504552886-4258-1-git-send-email-simon.marchi@ericsson.com> MIME-Version: 1.0 X-ClientProxiedBy: VI1PR08CA0123.eurprd08.prod.outlook.com (2603:10a6:800:d4::25) To DBXPR07MB317.eurprd07.prod.outlook.com (2a01:111:e400:941d::11) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 56c8b4da-d7d0-4b11-299d-08d4f3ca2965 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(300000500095)(300135000095)(300000501095)(300135300095)(22001)(300000502095)(300135100095)(2017030254152)(300000503095)(300135400095)(201703131423075)(201703031133081)(201702281549075)(300000504095)(300135200095)(300000505095)(300135600095)(300000506095)(300135500095); SRVR:DBXPR07MB317; X-Microsoft-Exchange-Diagnostics: 1; DBXPR07MB317; 3:9HEVa0VA4vERAE8g7iNv+/TdSF9Yh4l4MYcW9djWsAbX3v47E52t8teArvszAlsTVs7BLwECxifUtb8Cphqkn5uZ7TV4TMVr/EU0pqTNJEBX4LhHc1UdgJmpdQp3x9wMqsWvZROQiIPyVLlNW5FmUgaezZzejbYkLAOLZUHXoz3F0lQ/cnK31xzVXGAuCTFRpa/jjBx9I1ypAKCk1djiXTXkQaPZ9aelHkXzh7dTqxQlgdicFdobkrcMColk/fIO; 25:ThTJcurnWOem8T0HbPwBfj0iGOmhDdgd8H80G+WU7NTCGGTp8JaROnlDDgx+nP6kJ50d/zK8Zy+jRaxajS716Fj1zsE6R9e5kGPHBhXwSddOgt1FYWV384d1iAGrFi7jSNiBexceU/uixoRhhF1B0uOhelVeB9vp6MpAIe2yoDHRGHe8zA36HyKM5RDyqo90b2CXy69evDEiHc1bcx7fYwe6WkqlMoYdQckkehfCxnBfb6RMbPRMghipQLmbfnQIKhs5iHd2ohcb946XLAQGv/rAmeywwQetVNHfejdULNV0f1oStv+5do0+l0T58s4ttD5oXlD1YZBXS1J6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3Dj9A9JF6f3AtYR1U0leCZQzMwQ3BT7ehlr+/EJImTlObftyEs= X-Exchange-Antispam-Report-Test: UriScan:(37575265505322); X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(2401047)(8121501046)(5005006)(93006095)(93001095)(100000703101)(100105400095)(10201501046)(3002001)(6041248)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123564025)(20161123562025)(20161123558100)(20161123560025)(20161123555025)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:DBXPR07MB317; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:DBXPR07MB317; X-Forefront-PRVS: 0420213CCD X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4630300001)(7370300001)(6009001)(39860400002)(377424004)(189002)(54534003)(199003)(2361001)(107886003)(110136004)(50226002)(6506006)(66066001)(68736007)(47776003)(4326008)(6512007)(6916009)(6666003)(53936002)(478600001)(86362001)(7350300001)(6116002)(3846002)(8676002)(25786009)(42186005)(81166006)(81156014)(106356001)(101416001)(50466002)(36756003)(5660300001)(2906002)(105586002)(5003940100001)(305945005)(48376002)(33646002)(50986999)(6486002)(189998001)(2351001)(7736002)(97736004); DIR:OUT; SFP:1101; SCL:1; SRVR:DBXPR07MB317; H:elxacz23q12.localdomain; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A:1; LANG:en; Received-SPF: None (protection.outlook.com: ericsson.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; DBXPR07MB317; 23:aYGvTjcoubsy9jKS/c8Ca5i7mxAXrLsoeCnBxxdKTJ?= =?us-ascii?Q?g1ZXUyYg/yHJqXSu7XJDFL8+zld6Ov83mQl7jflVM45guYHcmXab5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vTYjACLOFXkl7s+UuSYW8j4Qd4ifAiTwgrl+QLgug0i1RYMQhY/eKXMRGO5Ryb5duYQ9AyFQ= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Sep 2017 19:21:36.2802 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: DBXPR07MB317 X-OriginatorOrg: ericsson.com X-IsSubscribed: yes This patch improves the loop_break and loop_continue tests to verify that they work as expected when multiple loops are nested (they affect the inner loop). gdb/testsuite/ChangeLog: * gdb.base/commands.exp (loop_break_test, loop_continue_test): Test with nested loops. --- gdb/testsuite/ChangeLog | 5 +++ gdb/testsuite/gdb.base/commands.exp | 65 ++++++++++++++++++++++++------------- 2 files changed, 47 insertions(+), 23 deletions(-) diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index 8a6838b..24ad99b 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,5 +1,10 @@ 2017-09-04 Simon Marchi + * gdb.base/commands.exp (loop_break_test, loop_continue_test): + Test with nested loops. + +2017-09-04 Simon Marchi + * gdb.base/commands.exp: Call the new procedures. (loop_break_test, loop_continue_test): New procedures. diff --git a/gdb/testsuite/gdb.base/commands.exp b/gdb/testsuite/gdb.base/commands.exp index 49a9242..17f113c 100644 --- a/gdb/testsuite/gdb.base/commands.exp +++ b/gdb/testsuite/gdb.base/commands.exp @@ -1030,41 +1030,60 @@ proc define_if_without_arg_test {} { proc_with_prefix loop_break_test {} { gdb_test_no_output "set \$a = 0" "initialize \$a" + gdb_test_no_output "set \$total = 0" "initialize \$total" gdb_test \ - [multi_line_input \ - "while \$a < 5" \ - " if \$a == 3" \ - " loop_break" \ - " end" \ - " set \$a = \$a + 1" \ - "end"] \ - "" \ - "run while loop" - - gdb_test "print \$a" " = 3" "validate \$a" + [multi_line_input \ + "while \$a < 5" \ + " if \$a == 4" \ + " loop_break" \ + " end" \ + " set \$b = 0" \ + " while \$b < 5" \ + " if \$b == 2" \ + " loop_break" \ + " end" \ + " set \$total = \$total + 1" \ + " set \$b = \$b + 1" \ + " end" \ + " set \$a = \$a + 1" \ + "end"] \ + "" \ + "run while loop" + + gdb_test "print \$a" " = 4" "validate \$a" + gdb_test "print \$b" " = 2" "validate \$b" + gdb_test "print \$total" " = 8" "validate \$total" } # Test the loop_continue command. proc_with_prefix loop_continue_test {} { gdb_test_no_output "set \$a = 0" "initialize \$a" - gdb_test_no_output "set \$b = 0" "initialize \$b" + gdb_test_no_output "set \$total = 0" "initialize \$total" gdb_test \ - [multi_line_input \ - "while \$a < 5" \ - " set \$a = \$a + 1" \ - " if \$a % 2 == 0" \ - " loop_continue" \ - " end" \ - " set \$b = \$b + 1" \ - "end"] \ - "" \ - "run while loop" + [multi_line_input \ + "while \$a < 5" \ + " set \$a = \$a + 1" \ + " set \$b = 0" \ + " if \$a == 4" \ + " loop_continue" \ + " end" \ + " while \$b < 5" \ + " set \$b = \$b + 1" \ + " if \$b == 2" \ + " loop_continue" \ + " end" \ + " set \$total = \$total + 1" \ + " end" \ + "end"] \ + "" \ + "run while loop" gdb_test "print \$a" " = 5" "validate \$a" - gdb_test "print \$b" " = 3" "validate \$b" + gdb_test "print \$b" " = 5" "validate \$b" + gdb_test "print \$total" " = 16" "validate \$total" } # Test an input line split with a continuation character (backslash)