public inbox for gdb-cvs@sourceware.org
help / color / mirror / Atom feed
* [binutils-gdb] [gdb/testsuite] Factor out dump_info in gdb.testsuite/dump-system-info.exp
@ 2021-09-24 14:56 Tom de Vries
0 siblings, 0 replies; only message in thread
From: Tom de Vries @ 2021-09-24 14:56 UTC (permalink / raw)
To: gdb-cvs
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=85a0bae983fc3d4fee7f1e64ec002dcfc873f966
commit 85a0bae983fc3d4fee7f1e64ec002dcfc873f966
Author: Tom de Vries <tdevries@suse.de>
Date: Fri Sep 24 16:56:50 2021 +0200
[gdb/testsuite] Factor out dump_info in gdb.testsuite/dump-system-info.exp
Factor out new proc dump_info in test-case gdb.testsuite/dump-system-info.exp,
and in the process:
- fix a few typos
- remove unnecessary "test -r /proc/cpuinfo"
Tested on x86_64-linux.
Co-Authored-By: Pedro Alves <pedro@palves.net>
Diff:
---
gdb/testsuite/gdb.testsuite/dump-system-info.exp | 42 +++++++++---------------
1 file changed, 16 insertions(+), 26 deletions(-)
diff --git a/gdb/testsuite/gdb.testsuite/dump-system-info.exp b/gdb/testsuite/gdb.testsuite/dump-system-info.exp
index bf181469bd5..1831479265c 100644
--- a/gdb/testsuite/gdb.testsuite/dump-system-info.exp
+++ b/gdb/testsuite/gdb.testsuite/dump-system-info.exp
@@ -15,34 +15,24 @@
# The purpose of this test-case is to dump /proc/cpuinfo and similar system
# info into gdb.log.
-# Check if /proc/cpuinfo is available.
-set res [remote_exec target "test -r /proc/cpuinfo"]
-set status [lindex $res 0]
-set output [lindex $res 1]
-if { $status == 0 && $output == "" } {
- verbose -log "Cpuinfo available, dumping:"
- remote_exec target "cat /proc/cpuinfo"
-} else {
- verbose -log "Cpuinfo not available"
-}
-
-set res [remote_exec target "lsb_release -a"]
-set status [lindex $res 0]
-set output [lindex $res 1]
+proc dump_info {cmd {what ""}} {
-if { $status == 0 } {
- verbose -log "lsb_release -a availabe, dumping:\n$output"
-} else {
- verbose -log "lsb_release -a not available"
-}
+ if {$what == ""} {
+ set what $cmd
+ }
-set res [remote_exec target "uname -a"]
-set status [lindex $res 0]
-set output [lindex $res 1]
+ set res [remote_exec target $cmd]
+ set status [lindex $res 0]
+ set output [lindex $res 1]
-if { $status == 0 } {
- verbose -log "uname -a availabe, dumping:\n$output"
-} else {
- verbose -log "uname -a not available"
+ if { $status == 0 } {
+ verbose -log "$what available, dumping:\n$output"
+ } else {
+ verbose -log "$what not available"
+ }
}
+
+dump_info "cat /proc/cpuinfo" "Cpuinfo"
+dump_info "uname -a"
+dump_info "lsb_release -a"
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2021-09-24 14:56 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-24 14:56 [binutils-gdb] [gdb/testsuite] Factor out dump_info in gdb.testsuite/dump-system-info.exp Tom de Vries
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).