[1/2] gdb/testsuite: add gcore_cmd_available predicate proc
Checks
Context |
Check |
Description |
linaro-tcwg-bot/tcwg_gdb_build--master-aarch64 |
success
|
Build passed
|
linaro-tcwg-bot/tcwg_gdb_build--master-arm |
success
|
Build passed
|
linaro-tcwg-bot/tcwg_gdb_check--master-arm |
success
|
Test passed
|
linaro-tcwg-bot/tcwg_gdb_check--master-aarch64 |
success
|
Test passed
|
Commit Message
Add a new gcore_cmd_available predicate proc that can be used in a
'requires' line, and make use of it in a few tests.
All of the tests I have modified call gdb_gcore_cmd as one of their
first actions and exit if the gcore command is not available, so it
makes sense (I think) to move the gcore command check into a requires
call.
There should be no change in what is actually run after this commit.
---
gdb/testsuite/gdb.ada/task_switch_in_core.exp | 2 +-
.../gdb.base/coredump-filter-build-id.exp | 2 +-
gdb/testsuite/gdb.base/gcore.exp | 1 +
.../gdb.base/print-symbol-loading.exp | 2 +-
gdb/testsuite/gdb.base/solib-search.exp | 2 +-
gdb/testsuite/gdb.tui/corefile-run.exp | 2 ++
gdb/testsuite/lib/gdb.exp | 18 ++++++++++++++++++
7 files changed, 25 insertions(+), 4 deletions(-)
@@ -15,7 +15,7 @@
load_lib "ada.exp"
-require allow_ada_tests
+require allow_ada_tests gcore_cmd_available
standard_ada_testfile crash
@@ -28,7 +28,7 @@ if { ![istarget *-*-linux*] } {
untested "$testfile.exp"
return -1
}
-require is_x86_64_m64_target
+require is_x86_64_m64_target gcore_cmd_available
if { [prepare_for_testing "failed to prepare" $testfile $srcfile {debug build-id}] } {
return -1
@@ -16,6 +16,7 @@
# This file was written by Michael Snyder (msnyder@redhat.com)
# This is a test for the gdb command "generate-core-file".
+require gcore_cmd_available
standard_testfile
@@ -15,7 +15,7 @@
# Test the "print symbol-loading" option.
-require allow_shlib_tests
+require allow_shlib_tests gcore_cmd_available
standard_testfile print-symbol-loading-main.c
set libfile print-symbol-loading-lib
@@ -16,7 +16,7 @@
# Test solib-search-path, and in the case of solib-svr4.c whether l_addr_p
# is properly reset when the path is changed.
-require allow_shlib_tests
+require allow_shlib_tests gcore_cmd_available
require {!is_remote target}
# Build "wrong" and "right" versions of the libraries in separate directories.
@@ -18,6 +18,8 @@
#
# Ref.: https://bugzilla.redhat.com/show_bug.cgi?id=1765117
+require gcore_cmd_available
+
tuiterm_env
standard_testfile tui-layout.c
@@ -6957,6 +6957,24 @@ proc gdb_load_cmd { args } {
return -1
}
+# Return non-zero if 'gcore' command is available.
+gdb_caching_proc gcore_cmd_available { } {
+ gdb_exit
+ gdb_start
+
+ # Does this gdb support gcore?
+ gdb_test_multiple "help gcore" "" {
+ -re -wrap "Undefined command: .*" {
+ return 0
+ }
+ -re -wrap "Save a core file .*" {
+ return 1
+ }
+ }
+
+ return 0
+}
+
# Invoke "gcore". CORE is the name of the core file to write. TEST
# is the name of the test case. This will return 1 if the core file
# was created, 0 otherwise. If this fails to make a core file because