summaryrefslogtreecommitdiff
path: root/gdb/testsuite/lib
diff options
context:
space:
mode:
authorNathan Sidwell <nathan@codesourcery.com>2007-01-11 11:42:45 +0000
committerNathan Sidwell <nathan@codesourcery.com>2007-01-11 11:42:45 +0000
commit147d6f8fa084b39dbf3e08ebd9f18e415be6c1ea (patch)
tree2b6413cbe97e222733b22fb32b2407817f21f659 /gdb/testsuite/lib
parent4b900473782ef959bcc04522b8d1ac66e0acd479 (diff)
downloadbinutils-gdb-147d6f8fa084b39dbf3e08ebd9f18e415be6c1ea.tar.gz
* lib/gdb.exp (gdb_compile_test): New.
(skip_ada_tests, skip_java_tests): New. (gdb_compile): Use gdb_compile_test for f77. * lib/ada.exp (gdb_compile_ada): Use gdb_compile_test to record result. * lib/java.exp (compile_java_from_source): Remove runtests check, use gdb_compile_test to record result. * gdb.ada/packed_array.exp, gdb.ada/fixed_points.exp, gdb.ada/exec_changed.exp, gdb.ada/start.exp, gdb.ada/watch_arg.exp, gdb.ada/null_record.exp, gdb.ada/array_return.exp, gdb.ada/arrayidx.exp, gdb.mi/mi-var-child-f.exp, gdb.fortran/types.exp, gdb.fortran/array-element.exp, gdb.fortran/subarray.exp, gdb.fortran/derived-type.exp, gdb.fortran/exprs.exp, gdb.java/jmisc.exp, gdb.java/jprint.exp, gdb.java/jv-print.exp, gdb.java/jmain.exp: Add language skip, adjust gdb_compile invocations.
Diffstat (limited to 'gdb/testsuite/lib')
-rw-r--r--gdb/testsuite/lib/ada.exp7
-rw-r--r--gdb/testsuite/lib/gdb.exp40
-rw-r--r--gdb/testsuite/lib/java.exp18
3 files changed, 43 insertions, 22 deletions
diff --git a/gdb/testsuite/lib/ada.exp b/gdb/testsuite/lib/ada.exp
index bf9c41238b1..44d38a74e63 100644
--- a/gdb/testsuite/lib/ada.exp
+++ b/gdb/testsuite/lib/ada.exp
@@ -425,9 +425,8 @@ proc gdb_compile_ada {source dest type options} {
# gdb_compile to determine whether the build has succeeded or not.
# We therefore simply check whether the dest file has been created
# or not. Unless not present, the build has succeeded.
- if ![file exists $dest] {
- unsupported "Ada compilation failed: $result"
- return "Ada compilation failed."
- }
+ if [file exists $dest] { set result "" }
+ gdb_compile_test $source $result
+ return $result
}
diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
index 4c440248040..9c87cc75d88 100644
--- a/gdb/testsuite/lib/gdb.exp
+++ b/gdb/testsuite/lib/gdb.exp
@@ -1142,6 +1142,22 @@ proc default_gdb_start { } {
return 0;
}
+# Examine the output of compilation to determine whether compilation
+# failed or not. If it failed determine whether it is due to missing
+# compiler or due to compiler error. Report pass, fail or unsupported
+# as appropriate
+
+proc gdb_compile_test {src output} {
+ if { $output == "" } {
+ pass "compilation [file tail $src]"
+ } elseif { [regexp {^[a-zA-Z_0-9]+: Can't find [^ ]+\.$} $output] } {
+ unsupported "compilation [file tail $src]"
+ } else {
+ verbose -log "compilation failed: $output" 2
+ fail "compilation [file tail $src]"
+ }
+}
+
# Return a 1 for configurations for which we don't even want to try to
# test C++.
@@ -1152,7 +1168,6 @@ proc skip_cplus_tests {} {
if { [istarget "h8300-*-*"] } {
return 1
}
-
# The C++ IO streams are too large for HC11/HC12 and are thus not
# available. The gdb C++ tests use them and don't compile.
if { [istarget "m6811-*-*"] } {
@@ -1170,6 +1185,18 @@ proc skip_fortran_tests {} {
return 0
}
+# Return a 1 if I don't even want to try to test ada.
+
+proc skip_ada_tests {} {
+ return 0
+}
+
+# Return a 1 if I don't even want to try to test java.
+
+proc skip_java_tests {} {
+ return 0
+}
+
# Run a test on the target to see if it supports vmx hardware. Return 0 if so,
# 1 if it does not. Based on 'check_vmx_hw_available' from the GCC testsuite.
@@ -1520,8 +1547,15 @@ proc gdb_compile {source dest type options} {
set result [target_compile $source $dest $type $options];
regsub "\[\r\n\]*$" "$result" "" result;
regsub "^\[\r\n\]*" "$result" "" result;
- if { $result != "" && [lsearch $options quiet] == -1} {
- clone_output "gdb compile failed, $result"
+
+ if {[lsearch $options quiet] < 0} {
+ # We shall update this on a per language basis, to avoid
+ # changing the entire testsuite in one go.
+ if {[lsearch $options f77] >= 0} {
+ gdb_compile_test $source $result
+ } elseif { $result != "" } {
+ clone_output "gdb compile failed, $result"
+ }
}
return $result;
}
diff --git a/gdb/testsuite/lib/java.exp b/gdb/testsuite/lib/java.exp
index 7916772e0be..c445f9824ef 100644
--- a/gdb/testsuite/lib/java.exp
+++ b/gdb/testsuite/lib/java.exp
@@ -91,31 +91,19 @@ proc java_init { args } {
#
proc compile_java_from_source { srcfile binfile compile_args } {
global GCJ_UNDER_TEST
- global runtests
global java_initialized
if { $java_initialized != 1 } { java_init }
- set errname [file rootname [file tail $srcfile]]
- if {! [runtest_file_p $runtests $errname]} {
- return
- }
-
set args "compiler=$GCJ_UNDER_TEST"
lappend args "additional_flags=--main=[file rootname [file tail $srcfile]]"
if { $compile_args != "" } {
lappend args "additional_flags=$compile_args"
}
- if { $compile_args != "" } {
- set errname "$errname $compile_args"
- }
-
- set x [target_compile $srcfile ${binfile} executable $args]
- if { $x != "" } {
- verbose "target_compile failed: $x" 2
- return "$errname compilation from source";
- }
+ set result [target_compile $srcfile ${binfile} ${binfile} executable $args]
+ gdb_compile_test $srcfile $result
+ return $result
}
# Local Variables: