gdb/gdb-testsuite-add-gdb.suse-debranding.exp.patch

69 lines
2.2 KiB
Diff

From b08bf94f170dd39db21cf8f62941f1866b6978c0 Mon Sep 17 00:00:00 2001
From: Tom de Vries <tdevries@suse.de>
Date: Thu, 16 Feb 2023 11:36:47 +0100
Subject: [PATCH 080/155] Add gdb.suse/debranding.exp
---
gdb/testsuite/gdb.suse/debranding.exp | 49 +++++++++++++++++++++++++++
1 file changed, 49 insertions(+)
create mode 100644 gdb/testsuite/gdb.suse/debranding.exp
diff --git a/gdb/testsuite/gdb.suse/debranding.exp b/gdb/testsuite/gdb.suse/debranding.exp
new file mode 100644
index 00000000000..cdee10b75a7
--- /dev/null
+++ b/gdb/testsuite/gdb.suse/debranding.exp
@@ -0,0 +1,49 @@
+# Copyright 2023 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+# There's a problem with dumping the entire output into gdb.log
+# on SLE-11, so redirect to file instead. Also means the gdb.log
+# is smaller.
+set f [standard_output_file "gdb-strings.txt"]
+
+# Not using remote_exec due to using file redirection.
+set cmd "exec strings $GDB > $f"
+set status [catch $cmd msg]
+verbose -log "status: $status"
+verbose -log "msg: $msg"
+gdb_assert { $status == 0 }
+
+set fp [open $f r]
+set output [read $fp]
+close $fp
+
+set re {^.*(?:fedora|red[^a-z]?hat).*$}
+set matches [regexp -line -nocase -all -inline $re $output]
+
+set disallowed_matches 0
+set allowed_re "warning: deprecated Red Hat reloc"
+foreach match $matches {
+ if { [regexp -nocase $allowed_re $match] } {
+ verbose -log "allowed_match: '$match'"
+ continue
+ }
+
+ verbose -log "disallowed_match: '$match'"
+ incr disallowed_matches
+}
+
+gdb_assert { $disallowed_matches == 0 }
+
+remote_file build delete $f
--
2.35.3