From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr1-x436.google.com (mail-wr1-x436.google.com [IPv6:2a00:1450:4864:20::436]) by sourceware.org (Postfix) with ESMTPS id 7E6683858439 for ; Thu, 23 Feb 2023 11:04:22 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 7E6683858439 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-wr1-x436.google.com with SMTP id 6so9957454wrb.11 for ; Thu, 23 Feb 2023 03:04:22 -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=m24yXh3lQ+xYjluJw/+M/f+ObIG+L9xqsPSKFfEMk9g=; b=AbP8CYmgyeOuj5wP5HmZTQg2HK9C+kEl9ZtCwiYYH1s+PqhT1qeqVx2TNZ6DRBj5Uw 2YzwzY86vu5/v6L8NezR9n2Too6oYgl4JY6BSlPQBtYHJWlyx/94ES3jQrnB+iXNlEHi c5Ep20sV/A65i0VsEkZHGgmGC5iFqM1l8ENUPCG70bxBXfs76eZ5ZHg2c6tWTx1Qn5Rs 8NVSLN9kHVosKmmfM3gzKOtQNg6S2z8h+3jWVtKp62gHL0bw0oyM/pHy/EzXI4g+efpP qLgFIhXt0DVlyMdEweXmXN6X34/MwTDzizhVxboeM9/LJGaVxRi8BTdL6MwogwHO6/cm wvqw== 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=m24yXh3lQ+xYjluJw/+M/f+ObIG+L9xqsPSKFfEMk9g=; b=bMNbDIIgSfq7rAhLrwr//PCCa7mLaFzeZ0/IZBpwS1f6Z0Uo2xigFBmoRiWd6Cc1sX JJLUdZr08aX+TyorgwrR9Q2/mljmivszHVeeXwdu592A72j/mEUNaHml8qQ4RHVRTpTs XwAz5jGy7y6UC8lcmtBrNKro8k18DHuL2nHgO8vznUqtK+Lcyc8Xke4FUKS3RN9Vq8NJ zkwhA0dnQT6qaVX83aEqhXOXy35Oo/kQMasc8Wb5irCKHLjiABf6TTbJN1POJysw+vHj PBF2beMsIIv5QKm/lYpBMFUL847xlGBdq9eCj1jG++aglRhP8xa8ZL+pz4TpHVxAveeV 21EA== X-Gm-Message-State: AO0yUKW4FFiydgQhSMsXqE9016OHWhN98icD4Wd2XbGDNexB7zB2SAuG r7jayP4ECDjoKTI2gwWNp9e/hHkpDFAYyHw3 X-Google-Smtp-Source: AK7set+6IXhsMT+epW9c25jCofY2+TuSCv1B4+oDCuu8VThUBr4SFgx/It69OCoHmqLtYdkdPc+mRA== X-Received: by 2002:adf:ef0d:0:b0:2c5:587e:75ba with SMTP id e13-20020adfef0d000000b002c5587e75bamr9518505wro.55.1677150261029; Thu, 23 Feb 2023 03:04:21 -0800 (PST) Received: from chigot-Dell.home ([2a01:cb15:8123:8100:34f2:8b0c:5cc3:b9ab]) by smtp.gmail.com with ESMTPSA id m17-20020a05600c3b1100b003e896d953a8sm6635349wms.17.2023.02.23.03.04.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Feb 2023 03:04:20 -0800 (PST) From: =?UTF-8?q?Cl=C3=A9ment=20Chigot?= To: binutils@sourceware.org Cc: jbeulich@suse.com, schwab@suse.de, amodra@gmail.com, =?UTF-8?q?Cl=C3=A9ment=20Chigot?= Subject: [PATCH v3] testsuite: prune DOS drive letter in test outputs Date: Thu, 23 Feb 2023 12:04:17 +0100 Message-Id: <20230223110417.63915-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.8 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..530316e54cd 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 -- 2.25.1