summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Marchi <simon.marchi@ericsson.com>2015-09-30 10:04:17 -0400
committerSimon Marchi <simon.marchi@ericsson.com>2015-09-30 10:04:33 -0400
commite019fd1d143061c703691b862f1e282be57b2983 (patch)
tree816d11dac7036d5dad4e9f7bd8198a69e0b08ce0
parent51c935fa4adebc59d41a7868917c2ba78735f58e (diff)
downloadbinutils-gdb-e019fd1d143061c703691b862f1e282be57b2983.tar.gz
py-type.exp: Do not run tests if binary fails to build
I noticed this while working on the test case. I believe it would make sense to skip running the tests if the binary failed to build. Although I would understand the opposite argument: if the binary does not build for some reason, we probably want to know about it, and some catastrophic failures in the tests might alarm us better than a timid "UNTESTED". gdb/testsuite/ChangeLog: * gdb.python/py-type.exp: Do not run tests if binaries fail to build.
-rw-r--r--gdb/testsuite/ChangeLog5
-rw-r--r--gdb/testsuite/gdb.python/py-type.exp51
2 files changed, 33 insertions, 23 deletions
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index d530c25335e..7e7e8f61b05 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2015-09-30 Simon Marchi <simon.marchi@ericsson.com>
+
+ * gdb.python/py-type.exp: Do not run tests if binaries fail to
+ build.
+
2015-09-30 Markus Metzger <markus.t.metzger@intel.com>
* gdb.btrace/tsx.exp: Consider multiple correct outputs in the record
diff --git a/gdb/testsuite/gdb.python/py-type.exp b/gdb/testsuite/gdb.python/py-type.exp
index 58a2394da70..ce6eddeaffc 100644
--- a/gdb/testsuite/gdb.python/py-type.exp
+++ b/gdb/testsuite/gdb.python/py-type.exp
@@ -32,6 +32,8 @@ proc build_inferior {exefile lang} {
untested "Couldn't compile ${srcfile} in $lang mode"
return -1
}
+
+ return 0
}
# Restart GDB.
@@ -241,35 +243,38 @@ proc test_template {} {
}
# Perform C Tests.
-build_inferior "${binfile}" "c"
-restart_gdb "${binfile}"
+if { [build_inferior "${binfile}" "c"] == 0 } {
+ restart_gdb "${binfile}"
-# Skip all tests if Python scripting is not enabled.
-if { [skip_python_tests] } { continue }
+ # Skip all tests if Python scripting is not enabled.
+ if { [skip_python_tests] } { continue }
-gdb_test "python print(gdb.lookup_type('char').array(1, 0))" \
- "char \\\[0\\\]"
+ gdb_test "python print(gdb.lookup_type('char').array(1, 0))" \
+ "char \\\[0\\\]"
-gdb_test "python print(gdb.lookup_type('char').array(1, -1))" \
- "Array length must not be negative.*"
+ gdb_test "python print(gdb.lookup_type('char').array(1, -1))" \
+ "Array length must not be negative.*"
-gdb_test "python print(gdb.lookup_type('int').optimized_out())" \
- "<optimized out>"
+ gdb_test "python print(gdb.lookup_type('int').optimized_out())" \
+ "<optimized out>"
-with_test_prefix "lang_c" {
- runto_bp "break to inspect struct and array."
- test_fields "c"
- test_enums
+ with_test_prefix "lang_c" {
+ runto_bp "break to inspect struct and array."
+ test_fields "c"
+ test_enums
+ }
}
+
# Perform C++ Tests.
-build_inferior "${binfile}-cxx" "c++"
-restart_gdb "${binfile}-cxx"
-with_test_prefix "lang_cpp" {
- runto_bp "break to inspect struct and array."
- test_fields "c++"
- test_base_class
- test_range
- test_template
- test_enums
+if { [build_inferior "${binfile}-cxx" "c++"] == 0 } {
+ restart_gdb "${binfile}-cxx"
+ with_test_prefix "lang_cpp" {
+ runto_bp "break to inspect struct and array."
+ test_fields "c++"
+ test_base_class
+ test_range
+ test_template
+ test_enums
+ }
}