From patchwork Fri Oct 19 10:28:23 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alan Hayward X-Patchwork-Id: 29807 Received: (qmail 103667 invoked by alias); 19 Oct 2018 10:28:39 -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 103649 invoked by uid 89); 19 Oct 2018 10:28:38 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-26.9 required=5.0 tests=BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_HELO_PASS, SPF_PASS autolearn=ham version=3.3.2 spammy=pycmdexp, multi-line, UD:py-cmd.exp, multiline X-HELO: EUR02-HE1-obe.outbound.protection.outlook.com Received: from mail-eopbgr10087.outbound.protection.outlook.com (HELO EUR02-HE1-obe.outbound.protection.outlook.com) (40.107.1.87) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 19 Oct 2018 10:28:36 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector1-arm-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=w57+8SlfB6H6SJhu1aqpnl6LujA5SiaMcreDKijq8Cc=; b=INrT1UQdcGCt4fuMGs0hqXE7wtnGgT7JrO4cx7dC7Ggw0o61WC0CgjpOC6SBMNfKGkwYmX2d29PYTg15FJypMV3/lTuJRXp77hY8Daecrq8s4BDgcrVCm0FingXBun8Kuul14CUkQHgRwV3UvF907husr6AT69JsekDnzWbleY4= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Alan.Hayward@arm.com; Received: from C02TF0U7HF1T.manchester.arm.com (217.140.106.32) by AM4PR0802MB2131.eurprd08.prod.outlook.com (2603:10a6:200:5c::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1228.32; Fri, 19 Oct 2018 10:28:32 +0000 From: Alan Hayward To: gdb-patches@sourceware.org Cc: nd@arm.com, Alan Hayward Subject: [PUSHED/OBV][PATCH] Testsuite: Fix racy conditions in py-cmd.exp Date: Fri, 19 Oct 2018 11:28:23 +0100 Message-Id: <20181019102823.31766-1-alan.hayward@arm.com> MIME-Version: 1.0 Return-Path: alan.hayward@arm.com Received-SPF: None (protection.outlook.com: arm.com does not designate permitted sender hosts) X-IsSubscribed: yes The test loop in test_python_inline_or_multiline was not checking for the gdb prompt. readline_is_used then reads in the prompt causing it to fail and the final chunk of tests to be skipped. Spotted this error because sometimes the gdb prompt does get processed correctly and the final tests are run, causing it to show up in the racy tests script output. Fix by ensuring the prompt is always checked for. To do this the list style needs reformatting so that variables get expanded. gdb/testsuite/ChangeLog: 2018-10-19 Alan Hayward * gdb.python/py-cmd.exp: Check for gdb_prompt. --- gdb/testsuite/gdb.python/py-cmd.exp | 71 +++++++++++++++-------------- 1 file changed, 36 insertions(+), 35 deletions(-) diff --git a/gdb/testsuite/gdb.python/py-cmd.exp b/gdb/testsuite/gdb.python/py-cmd.exp index d2d8205446..33a5b39842 100644 --- a/gdb/testsuite/gdb.python/py-cmd.exp +++ b/gdb/testsuite/gdb.python/py-cmd.exp @@ -188,44 +188,45 @@ gdb_test "complete expr_test bar\." \ # the easiest way is just to test with Python. proc test_python_inline_or_multiline { } { global gdb_prompt + set end "\r\n$gdb_prompt $" - set define_cmd_not_inline { - { "if 1" " >$" "multi-line if 1" } - { "python" " >$" "multi-line python command" } - { "print ('hello')" " >$" "multi-line print" } - { "end" " >$" "multi-line first end" } - { "end" "hello\r\n" "multi-line last end" } } + set define_cmd_not_inline [ list \ + [ list "if 1" " >$" "multi-line if 1" ] \ + [ list "python" " >$" "multi-line python command" ] \ + [ list "print ('hello')" " >$" "multi-line print" ] \ + [ list "end" " >$" "multi-line first end" ] \ + [ list "end" "hello$end" "multi-line last end" ] ] # This also tests trailing whitespace on the command. - set define_cmd_alias_not_inline { - { "if 1" " >$" "multi-line if 1 alias" } - { "py " " >$" "multi-line python command alias" } - { "print ('hello')" " >$" "multi-line print alias" } - { "end" " >$" "multi-line first end alias" } - { "end" "hello\r\n" "multi-line last end alias" } } - - set define_cmd_alias_foo_not_inline { - { "alias foo=python" "\r\n" "multi-line alias foo" } - { "if 1" " >$" "multi-line if 1 alias foo" } - { "foo " " >$" "multi-line python command alias foo" } - { "print ('hello')" " >$" "multi-line print alias foo" } - { "end" " >$" "multi-line first end alias foo" } - { "end" "hello\r\n" "multi-line last end alias foo" } } - - set define_cmd_inline { - { "if 1" " >$" "inline if 1" } - { "python print ('hello')" " >$" "inline python command" } - { "end" "hello\r\n" "inline end" } } - - set define_cmd_alias_inline { - { "if 1" " >$" "inline if 1 alias" } - { "py print ('hello')" " >$" "inline python command alias" } - { "end" "hello\r\n" "inline end alias" } } - - set define_cmd_alias_foo_inline { - { "if 1" " >$" "inline if 1 alias foo" } - { "foo print ('hello')" " >$" "inline python command alias foo" } - { "end" "hello\r\n" "inline end alias foo" } } + set define_cmd_alias_not_inline [ list \ + [ list "if 1" " >$" "multi-line if 1 alias" ] \ + [ list "py " " >$" "multi-line python command alias" ] \ + [ list "print ('hello')" " >$" "multi-line print alias" ] \ + [ list "end" " >$" "multi-line first end alias" ] \ + [ list "end" "hello$end" "multi-line last end alias" ] ] + + set define_cmd_alias_foo_not_inline [ list \ + [ list "alias foo=python" "$end" "multi-line alias foo" ] \ + [ list "if 1" " >$" "multi-line if 1 alias foo" ] \ + [ list "foo " " >$" "multi-line python command alias foo" ] \ + [ list "print ('hello')" " >$" "multi-line print alias foo" ] \ + [ list "end" " >$" "multi-line first end alias foo" ] \ + [ list "end" "hello$end" "multi-line last end alias foo" ] ] + + set define_cmd_inline [ list \ + [ list "if 1" " >$" "inline if 1" ] \ + [ list "python print ('hello')" " >$" "inline python command" ] \ + [ list "end" "hello$end" "inline end" ] ] + + set define_cmd_alias_inline [ list \ + [ list "if 1" " >$" "inline if 1 alias" ] \ + [ list "py print ('hello')" " >$" "inline python command alias" ] \ + [ list "end" "hello$end" "inline end alias" ] ] + + set define_cmd_alias_foo_inline [ list \ + [ list "if 1" " >$" "inline if 1 alias foo" ] \ + [ list "foo print ('hello')" " >$" "inline python command alias foo" ] \ + [ list "end" "hello$end" "inline end alias foo" ] ] foreach t [list $define_cmd_not_inline \ $define_cmd_alias_not_inline \