aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom de Vries <tdevries@suse.de>2022-11-16 11:19:48 +0100
committerTom de Vries <tdevries@suse.de>2022-11-16 11:19:48 +0100
commit24eb586f5c5ec119424b7bede66ada9cc94cace4 (patch)
tree616a00bc4d991288bab1b2498e988c802ed71426
parenta715464cd2e25c8bf46190cc8bde9267c9ab6ac0 (diff)
downloadgdb-24eb586f5c5ec119424b7bede66ada9cc94cace4.zip
gdb-24eb586f5c5ec119424b7bede66ada9cc94cace4.tar.gz
gdb-24eb586f5c5ec119424b7bede66ada9cc94cace4.tar.bz2
[gdb/testsuite] Fix gdb.arch/ppc64-symtab-cordic.exp without bzip2
After de-installing bzip2, I run into: ... Running ppc64-symtab-cordic.exp ... sh: bzip2: command not found PATH: gdb.arch/ppc64-symtab-cordic.exp: failed bzip2 for \ src/gdb/testsuite/gdb.arch/cordic.ko.bz2 ... Fix these by: - using remote_exec instead of catch system, and - using file tail in the untested message. I've tried making output redirection work with remote_exec, but that seems to be broken, so we now: - copy the file $f.bz2 into the desired location $dir/$f.bz2, and - decompress the bz2 file using "bzip2 -df $dir/$f.bz2", resulting in a file $dir/$f. Factor out new function decompress_bz2 to make the test-case less verbose, and also use it in gdb.arch/i386-biarch-core.exp. Tested on x86_64-linux, without and with bzip2 installed.
-rw-r--r--gdb/testsuite/gdb.arch/i386-biarch-core.exp5
-rw-r--r--gdb/testsuite/gdb.arch/ppc64-symtab-cordic.exp13
-rw-r--r--gdb/testsuite/lib/gdb.exp22
3 files changed, 32 insertions, 8 deletions
diff --git a/gdb/testsuite/gdb.arch/i386-biarch-core.exp b/gdb/testsuite/gdb.arch/i386-biarch-core.exp
index 607a3aa..e1f6590 100644
--- a/gdb/testsuite/gdb.arch/i386-biarch-core.exp
+++ b/gdb/testsuite/gdb.arch/i386-biarch-core.exp
@@ -45,14 +45,15 @@ gdb_test_multiple "complete set gnutarget " $test {
}
set corebz2file ${srcdir}/${subdir}/${testfile}.core.bz2
-set corefile [standard_output_file ${testfile}.core]
# Entry point of the original executable.
set address 0x400078
-if {[catch "system \"bzip2 -dc ${corebz2file} >${corefile}\""] != 0} {
+set corefile [decompress_bz2 $corebz2file]
+if { $corefile == "" } {
untested "failed bzip2"
return -1
}
+
file stat ${corefile} corestat
if {$corestat(size) != 102400} {
untested "bzip2 produces invalid result"
diff --git a/gdb/testsuite/gdb.arch/ppc64-symtab-cordic.exp b/gdb/testsuite/gdb.arch/ppc64-symtab-cordic.exp
index 5d2e125..4464177 100644
--- a/gdb/testsuite/gdb.arch/ppc64-symtab-cordic.exp
+++ b/gdb/testsuite/gdb.arch/ppc64-symtab-cordic.exp
@@ -24,16 +24,17 @@ if { [lsearch -exact $supported_archs "powerpc:common64"] == -1 } {
standard_testfile
set kobz2file ${srcdir}/${subdir}/cordic.ko.bz2
-set kofile [standard_output_file cordic.ko]
set kodebugbz2file ${srcdir}/${subdir}/cordic.ko.debug.bz2
-set kodebugfile [standard_output_file cordic.ko.debug]
-if {[catch "system \"bzip2 -dc ${kobz2file} >${kofile}\""] != 0} {
- untested "failed bzip2 for ${kobz2file}"
+set kofile [decompress_bz2 $kobz2file]
+if { $kofile == "" } {
+ untested "failed bzip2 for [file tail $kobz2file]"
return -1
}
-if {[catch "system \"bzip2 -dc ${kodebugbz2file} >${kodebugfile}\""] != 0} {
- untested "failed bzip2 for ${kodebugbz2file}"
+
+set kodebugfile [decompress_bz2 $kodebugbz2file]
+if { $kodebugfile == "" } {
+ untested "failed bzip2 for [file tail $kodebugbz2file]"
return -1
}
diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
index 698b3f4..f540770 100644
--- a/gdb/testsuite/lib/gdb.exp
+++ b/gdb/testsuite/lib/gdb.exp
@@ -9291,5 +9291,27 @@ gdb_caching_proc have_epilogue_line_info {
}
}
+# Decompress file BZ2, and return it.
+
+proc decompress_bz2 { bz2 } {
+ set copy [standard_output_file [file tail $bz2]]
+ set copy [remote_download build $bz2 $copy]
+ if { $copy == "" } {
+ return $copy
+ }
+
+ set res [remote_exec build "bzip2" "-df $copy"]
+ if { [lindex $res 0] == -1 } {
+ return ""
+ }
+
+ set copy [regsub {.bz2$} $copy ""]
+ if { ![remote_file build exists $copy] } {
+ return ""
+ }
+
+ return $copy
+}
+
# Always load compatibility stuff.
load_lib future.exp