aboutsummaryrefslogtreecommitdiff
path: root/binutils
diff options
context:
space:
mode:
authorClément Chigot <chigot@adacore.com>2023-02-21 15:07:58 +0100
committerClément Chigot <chigot@adacore.com>2023-02-24 14:35:10 +0100
commit2b69325792f7aed5416aa4489dabd197e4c17254 (patch)
tree81d5ad7d48ccfca395a5efc73c5d767158e4faed /binutils
parentae9a0a51e851eac3cdcd2a6791bf05480211c169 (diff)
downloadgdb-2b69325792f7aed5416aa4489dabd197e4c17254.zip
gdb-2b69325792f7aed5416aa4489dabd197e4c17254.tar.gz
gdb-2b69325792f7aed5416aa4489dabd197e4c17254.tar.bz2
testsuite: prune DOS drive letter in test outputs
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.
Diffstat (limited to 'binutils')
-rw-r--r--binutils/testsuite/lib/binutils-common.exp18
1 files changed, 17 insertions, 1 deletions
diff --git a/binutils/testsuite/lib/binutils-common.exp b/binutils/testsuite/lib/binutils-common.exp
index ab75241..530316e 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" }