[PATCH v3 9/9] [gdb/testsuite] handle compilation failures in jit-elf-helpers
Mihails Strasuns
mihails.strasuns@intel.com
Tue Mar 31 17:13:56 GMT 2020
Enhances lib/jit-elf-helpers.exp and tests using it to return failure
status code and exit tests early if necessary binaries fail to compile.
gdb/testsuite/ChangeLog:
2020-03-31 Mihails Strasuns <mihails.strasuns@intel.com>
* gdb.base/jit-elf-so.exp: exit early on compilation failures
* gdb.base/jit-elf.exp: exit early on compilation failures
* lib/jit-elf-helpers.exp: report compilation failures
Signed-off-by: Mihails Strasuns <mihails.strasuns@intel.com>
Change-Id: I3c773a4e7d8e23a92b3e7613c6db67254ec33c08
---
gdb/testsuite/gdb.base/jit-elf-so.exp | 15 +++++++++++++--
gdb/testsuite/gdb.base/jit-elf.exp | 9 ++++++++-
gdb/testsuite/lib/jit-elf-helpers.exp | 3 +++
3 files changed, 24 insertions(+), 3 deletions(-)
diff --git a/gdb/testsuite/gdb.base/jit-elf-so.exp b/gdb/testsuite/gdb.base/jit-elf-so.exp
index 55154e9866..206f8aa2b3 100644
--- a/gdb/testsuite/gdb.base/jit-elf-so.exp
+++ b/gdb/testsuite/gdb.base/jit-elf-so.exp
@@ -29,8 +29,15 @@ if {[get_compiler_info]} {
load_lib jit-elf-helpers.exp
global testfile srcfile binfile solib_binfile_targets
-lassign [compile_jit_main_as_so] testfile srcfile binfile
+set jit_main [compile_jit_main_as_so]
+if {![llength $jit_main]} {
+ return -1
+}
+lassign $jit_main testfile srcfile binfile
set solib_binfile_targets [compile_n_jit_so 2]
+if {![llength $solib_binfile_targets]} {
+ return -1
+}
# Compile the test case shared library loader.
proc compile_jit_dlmain {} {
@@ -41,10 +48,14 @@ proc compile_jit_dlmain {} {
if { [gdb_compile "${srcdir}/${subdir}/${srcfile_dlmain}" "${binfile}" \
executable {debug shlib_load}] != "" } {
untested "Failure to compile jit-elf-main"
+ return -1
}
+ return 0
}
-compile_jit_dlmain
+if {[compile_jit_dlmain]} {
+ return -1
+}
proc one_jit_test {count match_str} {
with_test_prefix "one_jit_test-$count" {
diff --git a/gdb/testsuite/gdb.base/jit-elf.exp b/gdb/testsuite/gdb.base/jit-elf.exp
index bf0e253bb9..e731e8be66 100644
--- a/gdb/testsuite/gdb.base/jit-elf.exp
+++ b/gdb/testsuite/gdb.base/jit-elf.exp
@@ -27,6 +27,9 @@ load_lib jit-elf-helpers.exp
global testfile srcfile binfile solib_binfile_targets
set solib_binfile_targets [compile_n_jit_so 2]
+if {![llength $solib_binfile_targets]} {
+ return -1
+}
# Detach, restart GDB, and re-attach to the program.
@@ -117,7 +120,11 @@ proc one_jit_test {count match_str reattach} {
}
}
-lassign [compile_jit_main "" {}] testfile srcfile binfile
+set jit_main [compile_jit_main "" {}]
+if {![llength $jit_main]} {
+ return -1
+}
+lassign $jit_main testfile srcfile binfile
one_jit_test 1 "${hex} jit_function_0001" 0
one_jit_test 2 "${hex} jit_function_0001\[\r\n\]+${hex} jit_function_0002" 0
diff --git a/gdb/testsuite/lib/jit-elf-helpers.exp b/gdb/testsuite/lib/jit-elf-helpers.exp
index 8a7a1796cc..833c0541c6 100644
--- a/gdb/testsuite/lib/jit-elf-helpers.exp
+++ b/gdb/testsuite/lib/jit-elf-helpers.exp
@@ -39,6 +39,7 @@ proc compile_jit_main {binsuffix options} {
if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" \
executable $options] != "" } {
untested "Failure to compile jit-elf-main"
+ return {}
}
return [list $testfile $srcfile $binfile]
}
@@ -58,6 +59,7 @@ proc compile_jit_main_as_so {} {
if { [gdb_compile_shlib "${srcdir}/${subdir}/${srcfile}" "${binfile}" \
$options] != "" } {
untested "Failure to compile jit-elf-main"
+ return {}
}
return [list $testfile $srcfile $binfile]
}
@@ -87,6 +89,7 @@ proc compile_n_jit_so {count} {
additional_flags=-Ttext-segment=$addr]
if { [gdb_compile_shlib $solib_srcfile $solib_binfile $options] != "" } {
untested "Failure to compile $solib_binfile_test_msg"
+ return {}
}
set path [gdb_remote_download target $solib_binfile]
--
2.25.2
Intel Deutschland GmbH
Registered Address: Am Campeon 10-12, 85579 Neubiberg, Germany
Tel: +49 89 99 8853-0, www.intel.de
Managing Directors: Christin Eisenschmid, Gary Kershaw
Chairperson of the Supervisory Board: Nicole Lau
Registered Office: Munich
Commercial Register: Amtsgericht Muenchen HRB 186928
More information about the Gdb-patches
mailing list