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 07440385841C for ; Sun, 6 Feb 2022 14:13:23 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 07440385841C Received: from mail-ed1-f69.google.com (mail-ed1-f69.google.com [209.85.208.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-303-nlnuFHnOM_SpZFWho1gbuw-1; Sun, 06 Feb 2022 09:13:15 -0500 X-MC-Unique: nlnuFHnOM_SpZFWho1gbuw-1 Received: by mail-ed1-f69.google.com with SMTP id en7-20020a056402528700b00404aba0a6ffso6135139edb.5 for ; Sun, 06 Feb 2022 06:13:15 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=G0MzM7Tjy1JYhKoCHVfiK+rfalqCoBcidyLeRf813p4=; b=iDtt6sny/G3QpsdzjmcRlZ+2e9M4rfzfMv+bkRD18MCkbAkdrJtbe2jDqhsUmHQJnw l1RPTiG1glCP1uW9n1LEcm9SNXtBPtxUNX3GwQ6f9HKl5ZYLXi1oftOYd12g9vuc7ixF +6xKgxj8P1AJHebXeBMY48IIGjsMom0fAEQ+NA1lHgaRJXLiQAmjOilQcRVEoBCSpYjr +x3wQah/xcQ/5w+4rkaM9MBhnJZHElsDLjAMgJarleTNeB9eFFsNza4F/quSO8W5p+5K HOC6ky57Pwgcj1D8Sfqj03UWRFpDTlF1XWSpcM801dC5EhuFm4IbSKdwg2dchPH/WKSC kGIA== X-Gm-Message-State: AOAM531hgpEUqm73CA1MNdkozSQcVYBxSs408HgNbBOSB6+BVxNy5akR xtSwGBiEh8JkQa8ncc+Fq74Z6MOpFgV59qrXQHnr3nRv//irIBG+rtmtmtJqkSgfs5dXcvQOM4w VGrrEzLNJWtLbi0tCNhIG8gFVeMsboOpeHD+o+kSdcnOOuvMO/VzjWMpnDfdufS127F32P7nLwQ == X-Received: by 2002:aa7:d3d8:: with SMTP id o24mr3130521edr.127.1644156794212; Sun, 06 Feb 2022 06:13:14 -0800 (PST) X-Google-Smtp-Source: ABdhPJyQnc9pLAcSPSXz/Gm5ZQIdgO6me9KQJHL0JhU4DlLoGjo1p4G1NOixEBbjUTS8t9cAn4m3kw== X-Received: by 2002:aa7:d3d8:: with SMTP id o24mr3130506edr.127.1644156793975; Sun, 06 Feb 2022 06:13:13 -0800 (PST) Received: from localhost (92.40.178.36.threembb.co.uk. [92.40.178.36]) by smtp.gmail.com with ESMTPSA id ec40sm1965177edb.68.2022.02.06.06.13.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 06 Feb 2022 06:13:13 -0800 (PST) From: Andrew Burgess To: gdb-patches@sourceware.org Cc: Andrew Burgess Subject: [PATCHv2 08/15] gdb/tui/testsuite: refactor new-layout.exp test Date: Sun, 6 Feb 2022 14:12:46 +0000 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-Spam-Status: No, score=-10.6 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_SHORT, RCVD_IN_BARRACUDACENTRAL, RCVD_IN_DNSWL_LOW, SPF_HELO_NONE, SPF_NONE, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 06 Feb 2022 14:13:28 -0000 This commit changes the gdb.tui/new-layout.exp test to make use of a list of test descriptions, and a loop to check each description in turn. There's no change to what is actually tested after this commit. In future commits I plan to add additional tests to this file, and this will be easier now that all I have to do is add a new test description to the list. --- gdb/testsuite/gdb.tui/new-layout.exp | 83 +++++++++++++++++++--------- 1 file changed, 56 insertions(+), 27 deletions(-) diff --git a/gdb/testsuite/gdb.tui/new-layout.exp b/gdb/testsuite/gdb.tui/new-layout.exp index 2b5e07db612..d3d34af7439 100644 --- a/gdb/testsuite/gdb.tui/new-layout.exp +++ b/gdb/testsuite/gdb.tui/new-layout.exp @@ -55,20 +55,39 @@ if { [tcl_version_at_least 8 6] } { "Missing '\}' in layout specification" } -gdb_test_no_output "tui new-layout example asm 1 status 0 cmd 1" - -gdb_test "help layout example" \ - "Apply the \"example\" layout.*tui new-layout example asm 1 status 0 cmd 1" - -gdb_test_no_output "tui new-layout example2 {asm 1 status 0} 1 cmd 1" - -gdb_test "help layout example2" \ - "Apply the \"example2\" layout.*tui new-layout example2 {asm 1 status 0} 1 cmd 1" - -gdb_test_no_output "tui new-layout h {-horizontal asm 1 src 1} 1 status 0 cmd 1" +# Each entry of this list describes a layout, and some associated +# tests. The items within each entry are: +# 1. layout name, +# 2. a string used to create the layout, +# 3. a list of boxes to check for once the layout is selected, +# 4. a regexp to match against the whole screen contents, this +# can be empty to skip this check. +set layouts \ + [list \ + [list example "asm 1 status 0 cmd 1" \ + {{0 0 80 15}} "$hex
"] \ + [list example2 "{asm 1 status 0} 1 cmd 1" \ + {{0 0 80 15}} ""] \ + [list h "{-horizontal asm 1 src 1} 1 status 0 cmd 1" \ + {{0 0 40 15} {39 0 41 15}} \ + "$hex
.*21.*return 0"]] + +# Helper function to verify a list of boxes. +proc check_boxes {boxes} { + set boxno 1 + foreach box $boxes { + eval Term::check_box [list "box $boxno"] $box + incr boxno + } +} -gdb_test "help layout h" \ - "Apply the \"h\" layout.*tui new-layout h {-horizontal asm 1 src 1} 1 status 0 cmd 1" +# Now create the layouts. +foreach layout $layouts { + lassign $layout name desc + gdb_test_no_output "tui new-layout $name $desc" + gdb_test "help layout $name" \ + "Apply the \"$name\" layout.*tui new-layout $name $desc" +} if {![Term::enter_tui]} { unsupported "TUI not supported" @@ -79,20 +98,30 @@ set text [Term::get_all_lines] gdb_assert {![string match "No Source Available" $text]} \ "initial source listing" -Term::command "layout example" -Term::check_contents "example layout shows assembly" \ - "$hex
" +foreach_with_prefix layout $layouts { + lassign $layout name desc boxes content_pattern + + # Reset the layout to a known starting configuration. + Term::command "layout src" + Term::command "winheight cmd 8" + + # Apply our test layout. + Term::command "layout $name" + check_boxes $boxes -Term::command "layout h" -Term::check_box "left window box" 0 0 40 15 -Term::check_box "right window box" 39 0 41 15 -Term::check_contents "horizontal display" \ - "$hex
.*21.*return 0" + if {$content_pattern != ""} { + Term::check_contents "contents in layout $name" \ + "${content_pattern}" + } -Term::command "winheight src - 5" -Term::check_box "left window box after shrink" 0 0 40 10 -Term::check_box "right window box after shrink" 39 0 41 10 + # Some additional tests for the 'h' layout. + if {$name == "h"} { + Term::command "winheight src - 5" + Term::check_box "left window box after shrink" 0 0 40 10 + Term::check_box "right window box after shrink" 39 0 41 10 -Term::command "winheight src + 5" -Term::check_box "left window box after grow" 0 0 40 15 -Term::check_box "right window box after grow" 39 0 41 15 + Term::command "winheight src + 5" + Term::check_box "left window box after grow" 0 0 40 15 + Term::check_box "right window box after grow" 39 0 41 15 + } +} -- 2.25.4