[gdb/testsuite] Fix gdb.arch/ppc64-symtab-cordic.exp without bzip2
authorTom de Vries <tdevries@suse.de>
Wed, 16 Nov 2022 10:19:48 +0000 (11:19 +0100)
committerTom de Vries <tdevries@suse.de>
Wed, 16 Nov 2022 10:19:48 +0000 (11:19 +0100)
commit24eb586f5c5ec119424b7bede66ada9cc94cace4
tree616a00bc4d991288bab1b2498e988c802ed71426
parenta715464cd2e25c8bf46190cc8bde9267c9ab6ac0
[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.
gdb/testsuite/gdb.arch/i386-biarch-core.exp
gdb/testsuite/gdb.arch/ppc64-symtab-cordic.exp
gdb/testsuite/lib/gdb.exp