diff options
author | Luis Machado <lgustavo@codesourcery.com> | 2015-04-13 14:42:48 -0300 |
---|---|---|
committer | Luis Machado <lgustavo@codesourcery.com> | 2015-04-13 14:42:48 -0300 |
commit | 7578d5f72c4abb6b49b0394bc810192b06088705 (patch) | |
tree | 30cf5f85f93fefb77455131ae155bb8769ca19e1 | |
parent | 2efe15c42872987ed5123f3a3952c8b379554840 (diff) | |
download | gdb-7578d5f72c4abb6b49b0394bc810192b06088705.zip gdb-7578d5f72c4abb6b49b0394bc810192b06088705.tar.gz gdb-7578d5f72c4abb6b49b0394bc810192b06088705.tar.bz2 |
Harden gdb.base/coredump-filter.exp
This testcase seems to assume the target is running Linux, so bare metal,
simulators and other debugging stubs running different OS' will have a
hard time executing some of the commands the testcase issues.
Even restricting the testcase to Linux systems (which the patch below does),
there are still problems with, say, QEMU not providing PID information when
"info inferior" is issued. As a consequence, the subsequent tests will either
fail or will not make much sense.
The attached patch checks if PID information is available. If not, it just
bails out and avoids running into a number of failures.
gdb/testsuite/ChangeLog:
2015-04-13 Luis Machado <lgustavo@codesourcery.com>
* gdb.base/coredump-filter.exp: Restrict test to Linux systems only.
Handle the case of targets that do not provide PID information.
-rw-r--r-- | gdb/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gdb/testsuite/gdb.base/coredump-filter.exp | 12 |
2 files changed, 17 insertions, 0 deletions
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index 55aeecc..e01fd38 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2015-04-13 Luis Machado <lgustavo@codesourcery.com> + + * gdb.base/coredump-filter.exp: Restrict test to Linux systems only. + Handle the case of targets that do not provide PID information. + 2015-04-13 Yao Qi <yao.qi@linaro.org> * lib/gdbserver-support.exp (gdb_exit): Catch exception diff --git a/gdb/testsuite/gdb.base/coredump-filter.exp b/gdb/testsuite/gdb.base/coredump-filter.exp index 8c94e94..f872de0 100644 --- a/gdb/testsuite/gdb.base/coredump-filter.exp +++ b/gdb/testsuite/gdb.base/coredump-filter.exp @@ -15,6 +15,12 @@ standard_testfile +# This test is Linux-only. +if ![istarget *-*-linux*] then { + untested "coredump-filter.exp" + return -1 +} + if { [prepare_for_testing "failed to prepare" $testfile $srcfile debug] } { untested "could not compile test program" return -1 @@ -146,6 +152,12 @@ gdb_test_multiple "info inferiors" "getting inferior pid" { -re "process \($decimal\).*\r\n$gdb_prompt $" { set infpid $expect_out(1,string) } + -re "Remote target.*$gdb_prompt $" { + # If the target does not provide PID information (like usermode QEMU), + # just bail out as the rest of the test may rely on it, giving spurious + # failures. + return -1 + } } # Get the main function's address. |