From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2205) id 3BCF23954C63; Wed, 16 Nov 2022 10:19:53 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 3BCF23954C63 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1668593993; bh=f7D2ruDExttQFbUwM1xj8xMVCSpyGAGsrtFHrSEIakQ=; h=From:To:Subject:Date:From; b=st1HtBbrBEPZ+l6tmyC7AkTtAIEa2D1FyJ4tpfqK2ONIR0BF379g9gNoyiQJb82hJ Y59K6kljCUJtuseUsXmLZonZ4aGFG2c9xOz57qZPoxCJHNJncZhfSEsHIp5nJScpAT Gn+VKZxNSoEpnNExbwXeye1oebrbW56gxPYhgACk= Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Tom de Vries To: gdb-cvs@sourceware.org Subject: [binutils-gdb] [gdb/testsuite] Fix gdb.arch/ppc64-symtab-cordic.exp without bzip2 X-Act-Checkin: binutils-gdb X-Git-Author: Tom de Vries X-Git-Refname: refs/heads/master X-Git-Oldrev: a715464cd2e25c8bf46190cc8bde9267c9ab6ac0 X-Git-Newrev: 24eb586f5c5ec119424b7bede66ada9cc94cace4 Message-Id: <20221116101953.3BCF23954C63@sourceware.org> Date: Wed, 16 Nov 2022 10:19:53 +0000 (GMT) List-Id: https://sourceware.org/git/gitweb.cgi?p=3Dbinutils-gdb.git;h=3D24eb586f5c5e= c119424b7bede66ada9cc94cace4 commit 24eb586f5c5ec119424b7bede66ada9cc94cace4 Author: Tom de Vries Date: Wed Nov 16 11:19:48 2022 +0100 [gdb/testsuite] Fix gdb.arch/ppc64-symtab-cordic.exp without bzip2 =20 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 ... =20 Fix these by: - using remote_exec instead of catch system, and - using file tail in the untested message. =20 I've tried making output redirection work with remote_exec, but that se= ems 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. =20 Factor out new function decompress_bz2 to make the test-case less verbo= se, and also use it in gdb.arch/i386-biarch-core.exp. =20 Tested on x86_64-linux, without and with bzip2 installed. Diff: --- gdb/testsuite/gdb.arch/i386-biarch-core.exp | 5 +++-- gdb/testsuite/gdb.arch/ppc64-symtab-cordic.exp | 13 +++++++------ gdb/testsuite/lib/gdb.exp | 22 ++++++++++++++++++++++ 3 files changed, 32 insertions(+), 8 deletions(-) diff --git a/gdb/testsuite/gdb.arch/i386-biarch-core.exp b/gdb/testsuite/gd= b.arch/i386-biarch-core.exp index 607a3aaaf85..e1f65900379 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 { } =20 set corebz2file ${srcdir}/${subdir}/${testfile}.core.bz2 -set corefile [standard_output_file ${testfile}.core] # Entry point of the original executable. set address 0x400078 =20 -if {[catch "system \"bzip2 -dc ${corebz2file} >${corefile}\""] !=3D 0} { +set corefile [decompress_bz2 $corebz2file] +if { $corefile =3D=3D "" } { untested "failed bzip2" return -1 } + file stat ${corefile} corestat if {$corestat(size) !=3D 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 5d2e1255d45..4464177b547 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= "] =3D=3D -1 } { standard_testfile =20 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] =20 -if {[catch "system \"bzip2 -dc ${kobz2file} >${kofile}\""] !=3D 0} { - untested "failed bzip2 for ${kobz2file}" +set kofile [decompress_bz2 $kobz2file] +if { $kofile =3D=3D "" } { + untested "failed bzip2 for [file tail $kobz2file]" return -1 } -if {[catch "system \"bzip2 -dc ${kodebugbz2file} >${kodebugfile}\""] !=3D = 0} { - untested "failed bzip2 for ${kodebugbz2file}" + +set kodebugfile [decompress_bz2 $kodebugbz2file] +if { $kodebugfile =3D=3D "" } { + untested "failed bzip2 for [file tail $kodebugbz2file]" return -1 } =20 diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp index 698b3f4bd79..f540770189d 100644 --- a/gdb/testsuite/lib/gdb.exp +++ b/gdb/testsuite/lib/gdb.exp @@ -9291,5 +9291,27 @@ gdb_caching_proc have_epilogue_line_info { } } =20 +# 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 =3D=3D "" } { + return $copy + } + + set res [remote_exec build "bzip2" "-df $copy"] + if { [lindex $res 0] =3D=3D -1 } { + return "" + } + + set copy [regsub {.bz2$} $copy ""] + if { ![remote_file build exists $copy] } { + return "" + } + + return $copy +} + # Always load compatibility stuff. load_lib future.exp