Harden gdb.base/coredump-filter.exp
authorLuis Machado <lgustavo@codesourcery.com>
Mon, 13 Apr 2015 17:42:48 +0000 (14:42 -0300)
committerLuis Machado <lgustavo@codesourcery.com>
Mon, 13 Apr 2015 17:42:48 +0000 (14:42 -0300)
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.

gdb/testsuite/ChangeLog
gdb/testsuite/gdb.base/coredump-filter.exp

index 55aeeccfc2164d41b679eb2e54e5314bb9596fab..e01fd38137c99e5204d67996be7b59df7398da58 100644 (file)
@@ -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
index 8c94e94932069fc3f3615e1c21996555350684d6..f872de0d1f5a12b0c8b1aa589d2a0f423901ce58 100644 (file)
 
 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.
This page took 0.033304 seconds and 4 git commands to generate.