From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm1-x333.google.com (mail-wm1-x333.google.com [IPv6:2a00:1450:4864:20::333]) by sourceware.org (Postfix) with ESMTPS id BEE623858288 for ; Tue, 21 Feb 2023 16:14:50 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org BEE623858288 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=adacore.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=adacore.com Received: by mail-wm1-x333.google.com with SMTP id o38-20020a05600c512600b003e8320d1c11so597723wms.1 for ; Tue, 21 Feb 2023 08:14:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore.com; s=google; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=WlMDj/NzYaaOFYYHLTUY1P+XCd+SNgaeS1x5gFJTR1U=; b=QkVm3w1GMZuZpRcDUf2zC5g7qOKWRydQPf07VTLBh2Ry1vkviVjnRHyPwIpR5i2rEi Lu5ULle4Dxuwdry29RjbwO4nSflU0ulsy75DEHzo/Iow6MLFGp/8q4dmhI9FKDIIkjO1 rGmfjid+c3PIZ4i39xlxmA/8gSBp/7eVe7bSqlqFlhvaneaEUmsmnQymIU21HvW7laN1 9mCbQU0dl8sGgvsmkf/Eg0XER36eshR36yvUjfABhg9bmKFD1AMk3b1+yUmFFi4CqtZ9 19VfJlx4D8rv35lSV1EGSHH1/PtSWSRm6+1QfmvdAAEVjCutK72JGFH9uE5J2byzeL/N NsYw== 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=WlMDj/NzYaaOFYYHLTUY1P+XCd+SNgaeS1x5gFJTR1U=; b=Jt55olUvvg+edRT217RYZPXj2ypF573K4x9toLwoF8cFw8AZIn+w39u6/yZdUXRHVm PMaeyZg059iRGk9OH4CKL144gV1Jwp1WRdEoxDv8u/ck5qzStab/al7I/IyWNYLlzXLx wfOtSHUj4s5H/or7oMUrJVlEqtHdjZCitHrZvnU2AkOg6BmNqLoj9t5arVeoaUkaByhB cixKhu7C9SfYE5jSKXAYE1M7ayC1QIe8qcb9U0aTsYv5RzzYb8StPON3L+oQeR6YtJE/ jWK4VceMBSMsNarD8lUhDnXd5ld/sG25mrXTl0ZS3PyqSOcTjRiE2dORrOFGl1HjPeXi m6kg== X-Gm-Message-State: AO0yUKXniOtX6orMX3RRdVyhfzRefbuB4fr+UbqtbIF8ocTfwZZfMG7l LmSWi0pCkNCc99unjwWoWZKy2aiLFyGzydpu X-Google-Smtp-Source: AK7set9PCy3yx55bItzawgWObnnK/6ZH7FZsIQE8UDhf9qiM1aVNk0uIn0GMNwhaPrv3hFaDahTyZg== X-Received: by 2002:a05:600c:4d25:b0:3cf:7197:e68a with SMTP id u37-20020a05600c4d2500b003cf7197e68amr3767004wmp.18.1676996089253; Tue, 21 Feb 2023 08:14:49 -0800 (PST) Received: from chigot-Dell.home ([2a01:cb15:8123:8100:db41:9133:356d:8c48]) by smtp.gmail.com with ESMTPSA id l8-20020a05600c1d0800b003e6dcd562a6sm4329728wms.28.2023.02.21.08.14.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Feb 2023 08:14:48 -0800 (PST) From: =?UTF-8?q?Cl=C3=A9ment=20Chigot?= To: binutils@sourceware.org Cc: jbeulich@suse.com, amodra@gmail.com, =?UTF-8?q?Cl=C3=A9ment=20Chigot?= Subject: [PATCH] testsuite: prune DOS drive letter in test outputs Date: Tue, 21 Feb 2023 17:14:42 +0100 Message-Id: <20230221161442.1554824-1-chigot@adacore.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 List-Id: 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..89990be845f 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)\[\[:upper:\]\]:" $output "\\1" 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 -- 2.25.1