From patchwork Tue Jul 10 21:39:25 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Philippe Waroquiers X-Patchwork-Id: 28303 Received: (qmail 57423 invoked by alias); 10 Jul 2018 21:39:49 -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 57305 invoked by uid 89); 10 Jul 2018 21:39:48 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-27.1 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.2 spammy=gdb_prompt X-HELO: mailsec114.isp.belgacom.be Received: from mailsec114.isp.belgacom.be (HELO mailsec114.isp.belgacom.be) (195.238.20.110) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 10 Jul 2018 21:39:47 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=skynet.be; i=@skynet.be; q=dns/txt; s=securemail; t=1531258787; x=1562794787; h=from:to:cc:subject:date:message-id:in-reply-to: references; bh=FAjlt7MX2T5Dfa/0Z3h8zsrzVvsMw+P7n3bSYmOG+jA=; b=sFRcQgaRoxKbSDWK+ThilneJCE8RcAVS/IpE5DABTUlZAfuaOriMmphA 6a8sM4VaOagp+75pLgCkn7Qq1arIng==; Received: from 160.177-177-91.adsl-dyn.isp.belgacom.be (HELO md.home) ([91.177.177.160]) by relay.skynet.be with ESMTP/TLS/DHE-RSA-AES128-GCM-SHA256; 10 Jul 2018 23:39:32 +0200 From: Philippe Waroquiers To: gdb-patches@sourceware.org Cc: Philippe Waroquiers Subject: [RFA_v4 7/8] Modify gdb.threads/pthreads.exp to test FLAG qcs arguments for thread apply. Also, add prefixes to make some non unique tests unique. Date: Tue, 10 Jul 2018 23:39:25 +0200 Message-Id: <20180710213926.32240-8-philippe.waroquiers@skynet.be> In-Reply-To: <20180710213926.32240-1-philippe.waroquiers@skynet.be> References: <20180710213926.32240-1-philippe.waroquiers@skynet.be> X-IsSubscribed: yes gdb/testsuite/ChangeLog 2018-07-09 Philippe Waroquiers * gdb.threads/pthreads.exp: Test qcs FLAG arguments. Add some test prefixes to make tests unique. --- gdb/testsuite/gdb.threads/pthreads.exp | 83 ++++++++++++++++++++++++-- 1 file changed, 79 insertions(+), 4 deletions(-) diff --git a/gdb/testsuite/gdb.threads/pthreads.exp b/gdb/testsuite/gdb.threads/pthreads.exp index 830432b833..bbda52e92e 100644 --- a/gdb/testsuite/gdb.threads/pthreads.exp +++ b/gdb/testsuite/gdb.threads/pthreads.exp @@ -188,8 +188,10 @@ proc check_control_c {} { global gdb_prompt # Verify that all threads are running. - if [all_threads_running] then { - pass "all threads running after startup" + with_test_prefix "after startup" { + if [all_threads_running] then { + pass "all threads running after startup" + } } # Send a continue followed by ^C to the process to stop it. @@ -216,8 +218,10 @@ proc check_control_c {} { gdb_test "bt" ".*" # Verify that all threads can be run again after a ^C stop. - if [all_threads_running] then { - pass "all threads running after continuing from ^C stop" + with_test_prefix "after continue" { + if [all_threads_running] then { + pass "all threads running after continuing from ^C stop" + } } return 0 } @@ -267,6 +271,76 @@ proc check_backtraces {} { } } +proc check_qcs {} { + set any "\[^\r\n\]*" + set ws "\[ \t\]\+" + set number "\[0-9]\+" + + # Check -c (continue) and -s (silently continue) flags. + gdb_test "thread apply 2-3 p notfound" \ + [multi_line \ + "" \ + "Thread 2 ${any}" \ + "No symbol \\\"notfound\\\" in current context." \ + ] \ + "run a failing command that aborts thread apply" + + gdb_test "thread apply 2-3 -c p notfound" \ + [multi_line \ + "" \ + "Thread 2 ${any}" \ + "No symbol \\\"notfound\\\" in current context." \ + "" \ + "Thread 3 ${any}" \ + "No symbol \\\"notfound\\\" in current context." \ + ] \ + "run a failing command, -c to continue" + + with_test_prefix "silent flag" { + foreach_with_prefix cmd_and_args { + "thread apply all -s frame apply all -s" + "tfaas" + "taas faas"} { + set cmd "$cmd_and_args p i" + gdb_test $cmd \ + [multi_line \ + "" \ + "Thread 3 ${any}" \ + "#${number}${ws}${any} in thread2 ${any}" \ + "\\\$\[0-9]+ = ${number}${any}" \ + "" \ + "Thread 2 ${any}" \ + "#${number}${ws}${any} in thread1 ${any}" \ + "\\\$\[0-9]+ = ${number}${any}" \ + ] \ + "run a failing command except in one frame of thread 2,3, -s to silently continue" + } + } + + # Check quietness. + gdb_test "thread apply all -s -q frame apply all -s p i" \ + [multi_line \ + "#${number}${ws}${any} in thread2 ${any}" \ + "\\\$\[0-9]+ = ${number}${any}" \ + "#${number}${ws}${any} in thread1 ${any}" \ + "\\\$\[0-9]+ = ${number}${any}" \ + ] \ + "run a failing command except in one frame of thread 2,3, -s to silently continue. Do not show thread information" + + gdb_test "thread apply all -s -q frame apply all -s -q p i" \ + [multi_line \ + "\\\$\[0-9]+ = ${number}${any}" \ + "\\\$\[0-9]+ = ${number}${any}" \ + ] \ + "run a failing command except in one frame of thread 2,3, -s to silently continue. Do not show thread and frame info" + + # Check invalid flag combinations. + gdb_test "thread apply all -c -s p 1" \ + "thread apply all: -c and -s are mutually exclusive" \ + "check -c and -s cannot be used simultaneously" + +} + if [runto_main] then { if [test_startup] then { if [check_control_c] then { @@ -274,5 +348,6 @@ if [runto_main] then { return } check_backtraces + check_qcs } }