}
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"
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
}
}
}
+# 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