From patchwork Wed Feb 22 15:16:39 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Cl=C3=A9ment_Chigot?= X-Patchwork-Id: 60572 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp633437wrd; Wed, 22 Feb 2023 07:17:06 -0800 (PST) X-Google-Smtp-Source: AK7set8+e9m6SH/iV+ij/6Oop41go7Z/HkFFBBoq/A00rjf4xF7rTbZs0D5QWG0pd+czS4uRabAv X-Received: by 2002:a17:907:77d1:b0:8b1:3422:ddb6 with SMTP id kz17-20020a17090777d100b008b13422ddb6mr16568091ejc.69.1677079026010; Wed, 22 Feb 2023 07:17:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1677079025; cv=none; d=google.com; s=arc-20160816; b=pDyn+QsWJ0v2jckrxz5C8XzAfY7stsdQN4rTwe2ZluZ4eg44rJPzRY+DLfL8D0RtIi HThxCOumu00bdpFkp8FYHGWwePg9O4QKQvd+oUuSCbi+TmK63eoFBBqNEzjdP53Gf4rb 8dTNeUQEGlPHDHUR5tpgQk7ukGRAHfKHQ0UJZvncot/HaKPRnHyChNvHmF9dxONlhSdD zdcmBx3Y4SHFSwt+FbZWPJhQ+4Z9ldKSOf3Z1P3ImIQIR8H4uMjBN4Q+l/zA2gg4GU/c 7FnQ2cOBt1+/w212e0Di369YTj37lY4u0wD8AT1RoYzYJCeLHl2ZNxim62h2uSD4V7jb PyLw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:reply-to:from:list-subscribe:list-help:list-post :list-archive:list-unsubscribe:list-id:precedence :content-transfer-encoding:mime-version:message-id:date:subject:cc :to:dmarc-filter:delivered-to:dkim-signature:dkim-filter; bh=z4gMb+LW8bxiZ99VA1aevWRbliHjFySOPjuMBkJW9bA=; b=UFwAZuWAa6uIjGPxokbPLLHyBX7CC/w7AvVlgEKuES48QP6tGZ8ZQaJry1jhFP++Xu 0ZkoI4/d5CchtRiB+UoDcMKXB0/L7HXSW5QjtZrTRFj8p2m3GgT0CGPlgbgECKwypV7e KlSJg5oGki//7iFP5RC6142GH71Os+uc8FtOAuF5ztXR3vfgUuAroDTx0veBn0MLonEY HoAPDJ7uoo4OCHTNoqjJE8jmUrl7XtaFzNNDCoyBdyGo/IPLUDuZL2+jJmvPUfQ6VrbR 5LtVvCzQ4ghscOwbt7MaXMtcrvXrfHbFjcYBvabCu5NWiQ7RcKx/ADU2fdxEoGE1sX8G sRPw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=UcODHasg; spf=pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="binutils-bounces+ouuuleilei=gmail.com@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=sourceware.org Received: from sourceware.org (ip-8-43-85-97.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id 29-20020a170906005d00b008b175a492e7si24411366ejg.584.2023.02.22.07.17.05 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Feb 2023 07:17:05 -0800 (PST) Received-SPF: pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@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=@sourceware.org header.s=default header.b=UcODHasg; spf=pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="binutils-bounces+ouuuleilei=gmail.com@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 021993858020 for ; Wed, 22 Feb 2023 15:17:03 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 021993858020 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1677079023; bh=z4gMb+LW8bxiZ99VA1aevWRbliHjFySOPjuMBkJW9bA=; h=To:Cc:Subject:Date:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From:Reply-To:From; b=UcODHasgz01weNpJcwoNM2FdatF3PI/LV5I0p/B5beH/lNgdBGS035RWqB8iQmiEM 6XWzNPhAHrOo17mejsfZ4fGihWDCYU6o94k7uRkWIzdj1+UbcgyoMTjvTisuKM9QFr bDPBB/huO0MwI3iUM5uzWR3WYZ033f24M/hPnXvs= X-Original-To: binutils@sourceware.org Delivered-To: binutils@sourceware.org Received: from mail-wm1-x334.google.com (mail-wm1-x334.google.com [IPv6:2a00:1450:4864:20::334]) by sourceware.org (Postfix) with ESMTPS id E7D383858D33 for ; Wed, 22 Feb 2023 15:16:52 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org E7D383858D33 Received: by mail-wm1-x334.google.com with SMTP id az11-20020a05600c600b00b003dc4fd6e61dso6640636wmb.5 for ; Wed, 22 Feb 2023 07:16:52 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=z4gMb+LW8bxiZ99VA1aevWRbliHjFySOPjuMBkJW9bA=; b=BgqN0PQgbSMwveJpvGHsCN385FUC77y/XkyvacTfoh9Sjt8Nx4LV9TksD8Q/01/mXp iymRsyS/yfPZovA06pQtHUoxLuPPI+KDYDmL7vvnj4GQ45X85QYGHckwdhUF7B98Ovva W1A2S7EIlgL1p6JtZ+sximPLJeTF0/p8Tc8RjJW7YRSKxdR1/3mx784IbCkKbG/7r5YI 12P4+NToG4we6v8dmtiIF+w66wyVL+gZ2Ire4NJrG6Ejy82lkZdgE6AvjYPnRcRwP29m OsMc4wmDlD1JMl4uS162+O49sn5TN6Runlpe2mfzOD1QSfm5N8FUaDsLOGziCiPql+QK uqFA== X-Gm-Message-State: AO0yUKXmZZa3FvLVYQAbSpB6ZBGnf6+vSmQyNASgtxT6JPNvC8PHoSrg v47x0la9hM8shpB85c5MABTMGX34U7XzuxIz X-Received: by 2002:a05:600c:510f:b0:3e9:c2f4:8ad4 with SMTP id o15-20020a05600c510f00b003e9c2f48ad4mr499528wms.8.1677079011384; Wed, 22 Feb 2023 07:16:51 -0800 (PST) Received: from chigot-Dell.home ([2a01:cb15:8123:8100:1843:13d:9508:e2ed]) by smtp.gmail.com with ESMTPSA id e29-20020a5d595d000000b002c558869934sm12273047wri.81.2023.02.22.07.16.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Feb 2023 07:16:50 -0800 (PST) To: binutils@sourceware.org Cc: jbeulich@suse.com, amodra@gmail.com, =?utf-8?q?Cl=C3=A9ment_Chigot?= Subject: [PATCH v2] testsuite: prune DOS drive letter in test outputs Date: Wed, 22 Feb 2023 16:16:39 +0100 Message-Id: <20230222151639.588269-1-chigot@adacore.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-Spam-Status: No, score=-12.9 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, 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 X-BeenThere: binutils@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Binutils mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: =?utf-8?q?Cl=C3=A9ment_Chigot_via_Binutils?= From: =?utf-8?q?Cl=C3=A9ment_Chigot?= Reply-To: =?utf-8?q?Cl=C3=A9ment_Chigot?= Errors-To: binutils-bounces+ouuuleilei=gmail.com@sourceware.org Sender: "Binutils" X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1758457863532088733?= X-GMAIL-MSGID: =?utf-8?q?1758544816494413799?= On DOS systems, absolute paths start with the drive letter. This can trigger failures in the regexp from dump tests, especially for those checking for warnings or errors. They are usually skipping everything before the first ":" as it has to be the file path. | [^:]*: warning: ... In order to avoid modifying many regexps to allow such drive letters, prune them from all the outputs if they are found at the beginning of a line. binutils/ChangeLog: * testsuite/lib/binutils-common.exp (prune_dump_output): New (run_dump_test): Use it. ld/ChangeLog: * testsuite/ld-elf/noinit-sections-2.l: Remove DOS drive letter handler. --- binutils/testsuite/lib/binutils-common.exp | 18 +++++++++++++++++- ld/testsuite/ld-elf/noinit-sections-2.l | 4 ++-- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/binutils/testsuite/lib/binutils-common.exp b/binutils/testsuite/lib/binutils-common.exp index ab752417295..a52ef7f3b90 100644 --- a/binutils/testsuite/lib/binutils-common.exp +++ b/binutils/testsuite/lib/binutils-common.exp @@ -687,6 +687,22 @@ if ![string length [info proc prune_warnings]] { } } +# prune_dump_output OUTPUT +# +# Clean up the output from system specific or unwanted characters. +# This allows to simplify the regexp inside dump tests. +proc prune_dump_output { output } { + if [ishost "*-*-mingw*"] { + # Prune DOS drive letter from an absolute path if it appears + # at the beginning of a line. + regsub -all "(^|\n)\[\[:alpha:\]\]:(/|\)" $output "\\1\\2" output + } + + # Prune last end of line. + regsub "\n$" $output "" output + return $output +} + # run_dump_test FILE (optional:) EXTRA_OPTIONS # # Assemble a .s file, then run some utility on it and check the output. @@ -1450,7 +1466,7 @@ proc run_dump_test { name {extra_options {}} } { } } - regsub "\n$" $comp_output "" comp_output + set comp_output [prune_dump_output $comp_output] if { $cmdret != 0 || $comp_output != "" || $want_out(source) != "" } { set exitstat "succeeded" if { $cmdret != 0 } { set exitstat "failed" } diff --git a/ld/testsuite/ld-elf/noinit-sections-2.l b/ld/testsuite/ld-elf/noinit-sections-2.l index 8ed2716c549..0784c9e3e12 100644 --- a/ld/testsuite/ld-elf/noinit-sections-2.l +++ b/ld/testsuite/ld-elf/noinit-sections-2.l @@ -1,5 +1,5 @@ #... -(|.:)[^:]*: warning: orphan section `.noinit.var_noinit' from \S+ being placed in section `.noinit.var_noinit' +[^:]*: warning: orphan section `.noinit.var_noinit' from \S+ being placed in section `.noinit.var_noinit' #... -(|.:)[^:]*: warning: orphan section `.gnu.linkonce.n.var_noinit2' from \S+ being placed in section `.gnu.linkonce.n.var_noinit2' +[^:]*: warning: orphan section `.gnu.linkonce.n.var_noinit2' from \S+ being placed in section `.gnu.linkonce.n.var_noinit2' #pass