From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTPS id B8FE6385800A for ; Fri, 31 Mar 2023 20:21:08 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org B8FE6385800A Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1680294068; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=tBJWbfQmfSEpztAybzNh5OB3uGQzS3PrNsgkcAGu9M8=; b=avtGKFlePQ4hnET47E+zkIdrIyWQa4K3oOT41+7LGQRZnaEvNUltq1DP+6EWpeF8Dv7Fxl MAlAiK00rgLHwXb57DZ6DIq8uokrhDnUxWGlj6kcClb2HLKJO373pRK5XGtlB5WaikrCCt lOdngy3X7tSs4McCwWMJDLqttBDL5Nc= Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com [209.85.128.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-209-F1DsVDoTPXevlYGKvWEhSw-1; Fri, 31 Mar 2023 16:21:07 -0400 X-MC-Unique: F1DsVDoTPXevlYGKvWEhSw-1 Received: by mail-wm1-f71.google.com with SMTP id r11-20020a05600c458b00b003eea8d25f06so11818327wmo.1 for ; Fri, 31 Mar 2023 13:21:06 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680294065; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=tBJWbfQmfSEpztAybzNh5OB3uGQzS3PrNsgkcAGu9M8=; b=lcasXfL5GJC01udxXn2bkki7+TCDrOgn4Fciw/iy2MKOyqoO/etFkqENX5eFSSQAFX L5VoRlWaRSgzx6iPZJQSHxRzzwMpTx8atLN3uYNhsOTCLBWEH1QkKnj5tNQU2eQ1TQ/P e2grJunlBpQ04De+FsLUWWXztUpcBUK9brzHUQiFuEIG+djdd+ssmUQYJ5hf21VLCPq+ fHxo+Qmtcmj1MMKRPYLgpfxXLvBev+ASGaMPM64kgE1Qlt8lbnkMBiEDvkwr0SLN1mCk 14yQNY0VP5CjAeGN+pTAvR9upLAHWT8BN0SH0QWeOEWPXCpYb18+kI8kl25UHf5lh+PW Sbxg== X-Gm-Message-State: AO0yUKU14jigSI6QcCziasL1gbV1ckf3WploCArEQQ57rAxnbO8AV7ww iztqA/51w1CjVlN75C+4gPWTbKwRC8m9Tsv/EGpwuGrVMgeFYfzRukYs2vPvLiPRt2+oechsBFI UodTuNdruDeKGmajWF3YjOfXfYrh4mkJziLc0im/w0vqm4J4wDhOGInR58dGMvcC5U2IyC6HiFW mzbmvPng== X-Received: by 2002:a1c:7c19:0:b0:3ed:a583:192a with SMTP id x25-20020a1c7c19000000b003eda583192amr20858845wmc.9.1680294065618; Fri, 31 Mar 2023 13:21:05 -0700 (PDT) X-Google-Smtp-Source: AK7set+SaOmPphu9ITLGkQrZL6K1lS21EmnUFqnsjz/cvym6iFQ1iAm8iNysWRIuY/gEU0V5QAH4Aw== X-Received: by 2002:a1c:7c19:0:b0:3ed:a583:192a with SMTP id x25-20020a1c7c19000000b003eda583192amr20858831wmc.9.1680294065219; Fri, 31 Mar 2023 13:21:05 -0700 (PDT) Received: from localhost (95.72.115.87.dyn.plus.net. [87.115.72.95]) by smtp.gmail.com with ESMTPSA id iw13-20020a05600c54cd00b003ef6988e54csm10618994wmb.15.2023.03.31.13.21.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 31 Mar 2023 13:21:04 -0700 (PDT) From: Andrew Burgess To: gdb-patches@sourceware.org Cc: Andrew Burgess Subject: [PATCH 3/5] gdb/testsuite: use 'return' in gdb_test_no_output Date: Fri, 31 Mar 2023 21:20:56 +0100 Message-Id: X-Mailer: git-send-email 2.25.4 In-Reply-To: References: MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII"; x-default=true X-Spam-Status: No, score=-11.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: A TCL proc will return the return value of the last command executed within the proc's body if there is no explicit return call, so gdb_test_no_output is already returning the return value of gdb_test_multiple. However, I'm not a fan of this implicit return value behaviour, so in this commit I have extended the comment on gdb_test_no_output to document the possible return values (just as gdb_test does), and explicitly call return. This should make no different to our testing, but I think it's clearer now what the gdb_test_no_output proc is expected to do. The two tests gdb.base/auxv.exp and gdb.base/list.exp both rely on the return value of gdb_test_no_output, and continue to pass after this change. I also spotted that gdb.base/watchpoint.exp could be updated to make use of gdb_test_no_output, so I did that. --- gdb/testsuite/gdb.base/watchpoint.exp | 17 ++++++++++------- gdb/testsuite/lib/gdb.exp | 9 +++++++-- 2 files changed, 17 insertions(+), 9 deletions(-) diff --git a/gdb/testsuite/gdb.base/watchpoint.exp b/gdb/testsuite/gdb.base/watchpoint.exp index 513964ebf86..7f821ee8a11 100644 --- a/gdb/testsuite/gdb.base/watchpoint.exp +++ b/gdb/testsuite/gdb.base/watchpoint.exp @@ -80,7 +80,7 @@ proc initialize {} { # to use it. This allows the test program to run at full speed until # we get to the first marker function. - if [gdb_test "disable 3" "disable 3\[\r\n\]+" "disable watchpoint" ] { + if [gdb_test_no_output "disable 3" "disable watchpoint" ] { return 0 } @@ -99,7 +99,8 @@ proc test_simple_watchpoint {} { # Ensure that the watchpoint is disabled when we startup. - if [gdb_test "disable 3" "^disable 3\[\r\n\]+" "disable watchpoint in test_simple_watchpoint" ] { + if [gdb_test_no_output "disable 3" \ + "disable watchpoint in test_simple_watchpoint" ] { return 0 } @@ -120,7 +121,7 @@ proc test_simple_watchpoint {} { # After reaching the marker function, enable the watchpoint. - if [gdb_test "enable 3" "^enable 3\[\r\n\]+" "enable watchpoint" ] { + if [gdb_test_no_output "enable 3" "enable watchpoint" ] { return } @@ -187,7 +188,7 @@ Continuing.*\[Ww\]atchpoint.*ival3.*Old value = -1.*New value = 0.*ival3 = count # Disable the watchpoint so we run at full speed until we exit. - if [gdb_test "disable 3" "^disable 3\[\r\n\]+" "watchpoint disabled" ] { + if [gdb_test_no_output "disable 3" "watchpoint disabled" ] { return } @@ -212,7 +213,8 @@ proc test_disabling_watchpoints {} { # Ensure that the watchpoint is disabled when we startup. - if [gdb_test "disable 3" "^disable 3\[\r\n\]+" "disable watchpoint in test_disabling_watchpoints" ] { + if [gdb_test_no_output "disable 3" \ + "disable watchpoint in test_disabling_watchpoints" ] { return 0 } @@ -234,7 +236,7 @@ proc test_disabling_watchpoints {} { # After reaching the marker function, enable the watchpoint. - if [gdb_test "enable 3" "^enable 3\[\r\n\]+" "watchpoint enabled" ] { + if [gdb_test_no_output "enable 3" "watchpoint enabled" ] { return } @@ -249,7 +251,8 @@ proc test_disabling_watchpoints {} { # Disable the watchpoint but leave breakpoints - if [gdb_test "disable 3" "^disable 3\[\r\n\]+" "disable watchpoint #2 in test_disabling_watchpoints" ] { + if [gdb_test_no_output "disable 3" \ + "disable watchpoint #2 in test_disabling_watchpoints" ] { return 0 } diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp index 8b85618abcd..626841a4f0a 100644 --- a/gdb/testsuite/lib/gdb.exp +++ b/gdb/testsuite/lib/gdb.exp @@ -1520,6 +1520,11 @@ if { [tcl_version_at_least 8 5] == 0 } { # # See gdb_test for a description of the -prompt, -no-prompt-anchor, -nopass, # COMMAND, and MESSAGE parameters. +# +# Returns: +# 1 if the test failed, +# 0 if the test passes, +# -1 if there was an internal error. proc gdb_test_no_output { args } { global gdb_prompt @@ -1535,13 +1540,13 @@ proc gdb_test_no_output { args } { set prompt [fill_in_default_prompt $prompt [expr !${no-prompt-anchor}]] set command_regex [string_to_regexp $command] - gdb_test_multiple $command $message -prompt $prompt { + return [gdb_test_multiple $command $message -prompt $prompt { -re "^$command_regex\r\n$prompt" { if {!$nopass} { pass $gdb_test_name } } - } + }] } # Send a command and then wait for a sequence of outputs. -- 2.25.4