From patchwork Thu Jan 11 02:59:21 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thiago Jung Bauermann X-Patchwork-Id: 761775 Delivered-To: patch@linaro.org Received: by 2002:a5d:6e02:0:b0:337:62d3:c6d5 with SMTP id h2csp2194891wrz; Wed, 10 Jan 2024 18:59:47 -0800 (PST) X-Google-Smtp-Source: AGHT+IFVmwry1XP5TJLbrFn3IMMX0sAzEkAhZ/g1FTOv0lV8gDRewffN/GTIvGrTD79GV756aRG4 X-Received: by 2002:a05:620a:221a:b0:783:c57:5958 with SMTP id m26-20020a05620a221a00b007830c575958mr570534qkh.84.1704941987652; Wed, 10 Jan 2024 18:59:47 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1704941987; cv=pass; d=google.com; s=arc-20160816; b=soMSUB70uqVUKaJuXKOCfaHgt7luNzNUFl1TY93fGrlh4hPoB+cYjN4UT1idIoLdCr SJ0i1JyUpdJxqUhn3LEZ4UO+jaI8u5qvCtDLaQny1gu50BI+rIHg4Bz/9dI+Smv93D1Q 9/N8jPud1R7GChvmvrTgUsb0xf/CZE1w0rcXkb96se80voukX+/yvH/RAktPNjdf1C0+ VrR/5XVvmblaZf9+M5RydZKlfzO8SeLjCi1vHref36bTqyafLIe3iUKB0a6bVRZgNXLU B18qonoTuqv7N4SN+VEDDC4MpA+HISkR/oSO0pz+FYFvu+RxJowWs906BJyh9o5vG1EJ XfMQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:message-id:date:subject:to:from:dkim-signature :arc-filter:dmarc-filter:delivered-to; bh=gOUF0Umwzc/IP/MKAKKQzFJym0+LU2SHXJWARo0jbSo=; fh=72kqq0iQhigvR9Vv/oqX5ebs3Yyyw7XhzWxOOEPdupI=; b=dIjkBZ5jfQfmj6eYQieD1g3j8qI/f4W4LIeUp8UPICn2024G4AS7g/HVN7Qa8jGToI I54suylLeI0ikDFqayp4AnSEVtIS5NGvU+oOtLCcmhfRAf0fK0V45cvz6JOYjvRYKD3u FqDxKzqglgIGdWdrI7Jk9WLLA2B0Og4h3Q4kTzA9ZFwHkK58Pc4bgLO3h/ulfHiEcOUe Gf+az18B/Pw4vJkwf1w1Yg+PVSnyqEXGUL3dIB75+gQeNmABRdHHRqqjiMEZs4zUD6ou y4LpdQi/PMbvWkJo5yIyvJOuC2zCgoacxmmJ3XmviuqpLzy/EbBqaJXt0MXB+77+mFB7 pkMg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=phDXZRoA; arc=pass (i=1); spf=pass (google.com: domain of gdb-patches-bounces+patch=linaro.org@sourceware.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gdb-patches-bounces+patch=linaro.org@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from server2.sourceware.org (server2.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id f15-20020a05620a408f00b007832f1ba0f5si120424qko.275.2024.01.10.18.59.47 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Jan 2024 18:59:47 -0800 (PST) Received-SPF: pass (google.com: domain of gdb-patches-bounces+patch=linaro.org@sourceware.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=phDXZRoA; arc=pass (i=1); spf=pass (google.com: domain of gdb-patches-bounces+patch=linaro.org@sourceware.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gdb-patches-bounces+patch=linaro.org@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 4DD67385842F for ; Thu, 11 Jan 2024 02:59:47 +0000 (GMT) X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from mail-pl1-x62f.google.com (mail-pl1-x62f.google.com [IPv6:2607:f8b0:4864:20::62f]) by sourceware.org (Postfix) with ESMTPS id 3806C3858D38 for ; Thu, 11 Jan 2024 02:59:25 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 3806C3858D38 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=linaro.org ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 3806C3858D38 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::62f ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1704941967; cv=none; b=cIfDZPTibCDCtEFp/9hJL2gV0nG6SrnhnLEHCkeaL5MgBE1mzbO24mqvt+055aDYcRHECwLlJJyu36uBBu5d4a8m0JSfg2r7nB1GNca9ZFpibPimfUxPhtmW9hHMxwRAaA4WFpAQ420ppSjfzsHjOT5OUI6SssSeqHEsU7m4SUw= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1704941967; c=relaxed/simple; bh=J64Gy/hBKSq2F9pX2F6ywUy/VRt7W/0gPh6hfs4Dw60=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=gFMlQhG1i5RGQxPN8zRKboR1lGW+/gcrSJhC5pxVutC8bvewfRnS423PQUBC9EXSQRtezAXM32AA44N8aTEVJKGMsfl6uLdXTYf0i0cOzPl3Ao9/v/d2SywMVctRyZPLMLbl9jaaiwQEd2dUjji+ZhNZghow3MZn2lF8Wlaemd8= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-pl1-x62f.google.com with SMTP id d9443c01a7336-1d3e6c86868so41675635ad.1 for ; Wed, 10 Jan 2024 18:59:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1704941964; x=1705546764; darn=sourceware.org; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:from:to:cc:subject:date:message-id:reply-to; bh=gOUF0Umwzc/IP/MKAKKQzFJym0+LU2SHXJWARo0jbSo=; b=phDXZRoArKqUDRl1fka4cZRNfFS7ln0HzJ0a9zxC7OBiC0zzGuPs+iNwkTq4Bl+ndy U47cv3Cg47A5FUszEaiCXb23FFtyu6CDocuAe3LF4bC+Y+3Kg7crIn0MXPu+8c00YUFZ ZIE/tVX8Vl8MUxD5n3+lxNcdx91P4nrpQFy8Ie/ia/DpN/UQr6CPlXQenDZm4rC6VroY 1PmEV5ggCku+OroWUy8pAlRk9+rPrNx5Tpw4xA/6w4ge1X8yyDqPRrwOj98WYv6D8HGJ MGaRX7YxIJywU/u5h0OjCDhjhpEa55VclAUY3Ygr5JYBqNPOdmT0w1WI5tvch7TyXCTh pAqg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704941964; x=1705546764; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=gOUF0Umwzc/IP/MKAKKQzFJym0+LU2SHXJWARo0jbSo=; b=r6M36iic2ACAeQbS6MNzg5iT+aTHLfgb7lVdvfzgNTOkldjQC7UDen8rzqll3rA9dg 90nGwjckZ5eD7tJ0es/kACRkREgALd/7D3ogdvRZGNJWA7DBRWaEdN/Y7VDiPwmisKwX 6K8XUyDmGoC8N53S5plbilnVHf6vH4sheoVPGFieDCHJsfaXMfFobgqdIc7MFoTGut1q WoqyNFxlIjZmHPr8R6n/mTF5fNZdPq/YFDUQktoEQqsejSg+kDFp2zhPEFw2j1OUeosd CQy3c4I6+aU3wtU53QO5va7MGkKsElYsGRhQhqb0AjqqPPqTX60CS+Q/sR51ZUvtL4hM rLCw== X-Gm-Message-State: AOJu0YyJqhy4FPJilnwYbK7lPso7LDFAhmgxhVls18iIkhFzcvOcLdng wK4QFL7eBx8NxqC1G2dVjrt/TJxmxxSD2Ee1BEeZdLqQ6Mw= X-Received: by 2002:a17:902:db0d:b0:1d3:3a82:a836 with SMTP id m13-20020a170902db0d00b001d33a82a836mr600466plx.51.1704941964206; Wed, 10 Jan 2024 18:59:24 -0800 (PST) Received: from localhost ([2804:14d:7e39:8470:323f:3ab3:b08e:7f7b]) by smtp.gmail.com with ESMTPSA id f2-20020a170902ce8200b001d4c6a9ca2dsm52833plg.208.2024.01.10.18.59.23 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Jan 2024 18:59:23 -0800 (PST) From: Thiago Jung Bauermann To: gdb-patches@sourceware.org Subject: [PATCH] gdb/testsuite: Fix testing of "info copying" Date: Wed, 10 Jan 2024 23:59:21 -0300 Message-ID: <20240111025921.781828-1-thiago.bauermann@linaro.org> X-Mailer: git-send-email 2.41.0 MIME-Version: 1.0 X-Spam-Status: No, score=-11.7 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_SHORT, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gdb-patches-bounces+patch=linaro.org@sourceware.org gdb.base/default.exp has an incomplete test for the "info copying" command, as poetically pointed out by the FIXME removed by this patch. The test omits the pattern argument to gdb_test, which causes it to just check for a GDB prompt at the end of the command output. The problem is that the command output is the whole GPLv3 license, which due to its size causes the test to fail sometimes, making the testcase to be out of sync with GDB's output and failing the tests that follow it. E.g., FAIL: gdb.base/default.exp: info copying (timeout) FAIL: gdb.base/default.exp: info display FAIL: gdb.base/default.exp: info frame "f" abbreviation PASS: gdb.base/default.exp: info frame FAIL: gdb.base/default.exp: info files FAIL: gdb.base/default.exp: info float FAIL: gdb.base/default.exp: info functions FAIL: gdb.base/default.exp: info locals FAIL: gdb.base/default.exp: info program FAIL: gdb.base/default.exp: info registers FAIL: gdb.base/default.exp: info stack "s" abbreviation Fix by by checking for a few excerpts at the beginning, middle and end of the license text. This makes the test consume the command's output in smallish chunks. Reviewed-by: Keith Seitz --- gdb/testsuite/gdb.base/default.exp | 94 +++++++++++++++++++++++++++--- 1 file changed, 87 insertions(+), 7 deletions(-) diff --git a/gdb/testsuite/gdb.base/default.exp b/gdb/testsuite/gdb.base/default.exp index 2b5294fcddd7..912b0c881bb0 100644 --- a/gdb/testsuite/gdb.base/default.exp +++ b/gdb/testsuite/gdb.base/default.exp @@ -267,13 +267,93 @@ gdb_test "info bogus-gdb-command" "Undefined info command: \"bogus-gdb-command\" #test info breakpoints gdb_test "info breakpoints" "No breakpoints or watchpoints." #test info copying -# FIXME -- doesn't work worth a shit -#send_gdb "info copying" -# -re "GNU GENERAL PUBLIC LICENSE.*#of preserving the free status of all derivatives of our free software and.*#of promoting the sharing and reuse of software generally."# -gdb_test "info copying" -# } -# -# +# The license text is very big, so it may overwhelm Expect's output buffer +# and cause the test to fail occasionally. To avoid this problem, verify +# the command's output in small chunks. +set saw_header 0 +set saw_terms 0 +set saw_section5 0 +set saw_section7 0 +set saw_section10 0 +set saw_section14 0 +set saw_last_para 0 +# These excerpts were chosen for no particular reason, except that they +# occur at the beginning, middle and end of the license text. +set re_header [multi_line \ + "\\s+GNU GENERAL PUBLIC LICENSE" \ + "\\s+Version 3, 29 June 2007" \ + "" \ + " Copyright \\(C\\) 2007 Free Software Foundation, Inc. " \ + " Everyone is permitted to copy and distribute verbatim copies" \ + " of this license document, but changing it is not allowed." \ + "" \ + "\\s+Preamble" \ + "" \ + " The GNU General Public License is a free, copyleft license for" \ + "software and other kinds of works.\r\n"] +set re_terms [multi_line \ + "\\s+TERMS AND CONDITIONS" \ + "" \ + " 0. Definitions." \ + "" \ + " \"This License\" refers to version 3 of the GNU General Public License.\r\n"] +set re_section5 [multi_line \ + " 5. Conveying Modified Source Versions." \ + "" \ + " You may convey a work based on the Program, or the modifications to\r\n"] +set re_section7 [multi_line \ + " 7. Additional Terms." \ + "" \ + " \"Additional permissions\" are terms that supplement the terms of this\r\n"] +set re_section10 [multi_line \ + " 10. Automatic Licensing of Downstream Recipients." \ + "" \ + " Each time you convey a covered work, the recipient automatically\r\n"] +set re_section14 [multi_line \ + " 14. Revised Versions of this License." \ + "" \ + " The Free Software Foundation may publish revised and/or new versions of\r\n"] +set re_last_para [multi_line \ + " Later license versions may give you additional or different" \ + "permissions. However, no additional obligations are imposed on any" \ + "author or copyright holder as a result of your choosing to follow a" \ + "later version.\r\n"] +set test "info copying" +gdb_test_multiple $test $test { + -re $re_header { + set saw_header 1 + exp_continue + } + -re $re_terms { + set saw_terms 1 + exp_continue + } + -re $re_section5 { + set saw_section5 1 + exp_continue + } + -re $re_section7 { + set saw_section7 1 + exp_continue + } + -re $re_section10 { + set saw_section10 1 + exp_continue + } + -re $re_section14 { + set saw_section14 1 + exp_continue + } + -re $re_last_para { + set saw_last_para 1 + exp_continue + } + -re "$gdb_prompt \$" { + gdb_assert { $saw_header && $saw_terms && $saw_section5 \ + && $saw_section7 && $saw_section10 \ + && $saw_section14 && $saw_last_para } $test + } +} #test info display gdb_test "info display" "There are no auto-display expressions now." #test info frame "f" abbreviation