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.133.124]) by sourceware.org (Postfix) with ESMTPS id 7BCC7385841D for ; Mon, 7 Mar 2022 22:14:05 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 7BCC7385841D Received: from mail-wr1-f70.google.com (mail-wr1-f70.google.com [209.85.221.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-410-QSwJCJxJNeS1I4zYdLsOYw-1; Mon, 07 Mar 2022 17:14:03 -0500 X-MC-Unique: QSwJCJxJNeS1I4zYdLsOYw-1 Received: by mail-wr1-f70.google.com with SMTP id b9-20020a05600003c900b00203647caa11so180735wrg.5 for ; Mon, 07 Mar 2022 14:14:03 -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=mQMyjveTBAepy4Q90j7VU8RQwtYcsH6v/JqpQmQnl9J9uXyC9tdqz8HhEKTVo53zwE IaPj4jL9KVnEMzsLSrYdpYGr832Y/vAIdD7/P6ckFRN7qOHJYim5DHuUtyl11prYQaW/ 3Af3adTeOv3yx4Tlryxn/JReJl4gPcXFBH1SQV1bplmri88Qhfkse742JQaTu1exsxLl yVaSPIMm+HFn6Q6ehyIJFRxd9k/9AQ9YzwPjBAMphp/INBqsD/6brAF2xfzCvELtPIYM Gi7xERTKvM+PvKRW5eWkBzCDg9882pVMv6sV+rHmowAef2NcofwzVO37VzqNdX8VIFKT nkCg== X-Gm-Message-State: AOAM5316kx4Dx7slhGg/GFxKc65yOn4OATlfPhhO9xZX4tzXByaxGoGF 4z6TinfscMNNQwnCJZkoQ8wReb/3Z80JFk8bgN/uF7dD4Kcf/qnL7zHARATJFkeJR4SYSzHNK9n ziMPH/xKKJPnlbGSqTFedQ6Bdjj7NGuS8KSbGtz1wL6pCCr1p+QrZc2UcrTWkGThHYRUTu4VQzA == X-Received: by 2002:a05:6000:1569:b0:1f0:47eb:eafa with SMTP id 9-20020a056000156900b001f047ebeafamr9825346wrz.194.1646691241748; Mon, 07 Mar 2022 14:14:01 -0800 (PST) X-Google-Smtp-Source: ABdhPJzU9dYkcYGQP4wAYN0Sohg9o8SsTY5G5MbDXl7CcWMABzCs6IyBK+k7JQeF6SpVhZiMcekTVg== X-Received: by 2002:a05:6000:1569:b0:1f0:47eb:eafa with SMTP id 9-20020a056000156900b001f047ebeafamr9825332wrz.194.1646691241365; Mon, 07 Mar 2022 14:14:01 -0800 (PST) Received: from localhost (host86-134-151-205.range86-134.btcentralplus.com. [86.134.151.205]) by smtp.gmail.com with ESMTPSA id v10-20020a05600c214a00b00389bcc75559sm488638wml.27.2022.03.07.14.14.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Mar 2022 14:14:00 -0800 (PST) From: Andrew Burgess To: gdb-patches@sourceware.org Cc: Andrew Burgess Subject: [PATCHv3 08/15] gdb/tui/testsuite: refactor new-layout.exp test Date: Mon, 7 Mar 2022 22:13:40 +0000 Message-Id: <4b08ced4ea3e875b64a20fc766cb893d4912719f.1646691034.git.aburgess@redhat.com> 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=-11.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_DNSWL_NONE, RCVD_IN_MSPIKE_H5, RCVD_IN_MSPIKE_WL, 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: Mon, 07 Mar 2022 22:14:06 -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