From: Nathan Sidwell Date: Tue, 10 Nov 2009 10:16:10 +0000 (+0000) Subject: * lib/gdb.exp (gdb_compile_test): New. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=ec3c07fc0ff7ca6defeb89c58727363b6382d2b5;p=binutils-gdb.git * 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/jmisc1.exp, gdb.java/jprint.exp, gdb.java/jv-print.exp, gdb.java/jmain.exp: Add language skip, adjust gdb_compile invocations. --- diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index 195ed42994f..29e213dccdc 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,22 @@ +2009-11-10 Nathan Sidwell + + * 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/jmisc1.exp, gdb.java/jprint.exp, + gdb.java/jv-print.exp, gdb.java/jmain.exp: Add language skip, + adjust gdb_compile invocations. + 2009-11-09 Jan Kratochvil * Makefile.in (abs_builddir): New. diff --git a/gdb/testsuite/gdb.ada/array_return.exp b/gdb/testsuite/gdb.ada/array_return.exp index 688a45faed1..4e9712b8e54 100644 --- a/gdb/testsuite/gdb.ada/array_return.exp +++ b/gdb/testsuite/gdb.ada/array_return.exp @@ -19,14 +19,16 @@ if $tracelevel then { load_lib "ada.exp" +if { [skip_ada_tests] } { return -1 } + set testdir "array_return" set testfile "${testdir}/p" set srcfile ${srcdir}/${subdir}/${testfile}.adb set binfile ${objdir}/${subdir}/${testfile} file mkdir ${objdir}/${subdir}/${testdir} -if {[gdb_compile_ada "${srcfile}" "${binfile}" executable [list debug ]] != "" } { - return -1 +if {[gdb_compile_ada "${srcfile}" "${binfile}" executable {debug}] != ""} { + return -1 } gdb_exit diff --git a/gdb/testsuite/gdb.ada/arrayidx.exp b/gdb/testsuite/gdb.ada/arrayidx.exp index 75aa37f62fc..e038e6ec60e 100644 --- a/gdb/testsuite/gdb.ada/arrayidx.exp +++ b/gdb/testsuite/gdb.ada/arrayidx.exp @@ -19,14 +19,16 @@ if $tracelevel then { load_lib "ada.exp" +if { [skip_ada_tests] } { return -1 } + set testdir "arrayidx" set testfile "${testdir}/p" set srcfile ${srcdir}/${subdir}/${testfile}.adb set binfile ${objdir}/${subdir}/${testfile} file mkdir ${objdir}/${subdir}/${testdir} -if {[gdb_compile_ada "${srcfile}" "${binfile}" executable [list debug ]] != "" } { - return -1 +if {[gdb_compile_ada "${srcfile}" "${binfile}" executable {debug}] != ""} { + return -1 } gdb_exit diff --git a/gdb/testsuite/gdb.ada/exec_changed.exp b/gdb/testsuite/gdb.ada/exec_changed.exp index bbfa9372371..460c9258949 100644 --- a/gdb/testsuite/gdb.ada/exec_changed.exp +++ b/gdb/testsuite/gdb.ada/exec_changed.exp @@ -19,6 +19,8 @@ if $tracelevel then { load_lib "ada.exp" +if { [skip_ada_tests] } { return -1 } + set testdir "exec_changed" file mkdir ${objdir}/${subdir}/${testdir} @@ -27,8 +29,8 @@ set testfile1 "${testdir}/first" set srcfile1 ${srcdir}/${subdir}/${testfile1}.adb set binfile1 ${objdir}/${subdir}/${testfile1}$EXEEXT -if {[gdb_compile_ada "${srcfile1}" "${binfile1}" executable [list debug ]] != "" } { - return -1 +if {[gdb_compile_ada "${srcfile1}" "${binfile1}" executable {debug}] != ""} { + return -1 } # Build the second test program @@ -36,8 +38,8 @@ set testfile2 "${testdir}/second" set srcfile2 ${srcdir}/${subdir}/${testfile2}.adb set binfile2 ${objdir}/${subdir}/${testfile2}$EXEEXT -if {[gdb_compile_ada "${srcfile2}" "${binfile2}" executable [list debug ]] != "" } { - return -1 +if {[gdb_compile_ada "${srcfile2}" "${binfile2}" executable {debug}] != ""} { + return -1 } # Start with a fresh gdb. diff --git a/gdb/testsuite/gdb.ada/fixed_points.exp b/gdb/testsuite/gdb.ada/fixed_points.exp index abc94c85301..801aea83884 100644 --- a/gdb/testsuite/gdb.ada/fixed_points.exp +++ b/gdb/testsuite/gdb.ada/fixed_points.exp @@ -19,14 +19,16 @@ if $tracelevel then { load_lib "ada.exp" +if { [skip_ada_tests] } { return -1 } + set testdir "fixed_points" set testfile "${testdir}/fixed_points" set srcfile ${srcdir}/${subdir}/${testfile}.adb set binfile ${objdir}/${subdir}/${testfile} file mkdir ${objdir}/${subdir}/${testdir} -if {[gdb_compile_ada "${srcfile}" "${binfile}" executable [list debug ]] != "" } { - return -1 +if {[gdb_compile_ada "${srcfile}" "${binfile}" executable {debug}] != ""} { + return -1 } gdb_exit diff --git a/gdb/testsuite/gdb.ada/null_record.exp b/gdb/testsuite/gdb.ada/null_record.exp index e291b492524..dd074962982 100644 --- a/gdb/testsuite/gdb.ada/null_record.exp +++ b/gdb/testsuite/gdb.ada/null_record.exp @@ -19,14 +19,16 @@ if $tracelevel then { load_lib "ada.exp" +if { [skip_ada_tests] } { return -1 } + set testdir "null_record" set testfile "${testdir}/null_record" set srcfile ${srcdir}/${subdir}/${testfile}.adb set binfile ${objdir}/${subdir}/${testfile} file mkdir ${objdir}/${subdir}/${testdir} -if {[gdb_compile_ada "${srcfile}" "${binfile}" executable [list debug ]] != "" } { - return -1 +if {[gdb_compile_ada "${srcfile}" "${binfile}" executable {debug}] != ""} { + return -1 } gdb_exit diff --git a/gdb/testsuite/gdb.ada/packed_array.exp b/gdb/testsuite/gdb.ada/packed_array.exp index 8a5af69bbf9..a7732254c0a 100644 --- a/gdb/testsuite/gdb.ada/packed_array.exp +++ b/gdb/testsuite/gdb.ada/packed_array.exp @@ -19,14 +19,16 @@ if $tracelevel then { load_lib "ada.exp" +if { [skip_ada_tests] } { return -1 } + set testdir "packed_array" set testfile "${testdir}/pa" set srcfile ${srcdir}/${subdir}/${testfile}.adb set binfile ${objdir}/${subdir}/${testfile} file mkdir ${objdir}/${subdir}/${testdir} -if {[gdb_compile_ada "${srcfile}" "${binfile}" executable [list debug ]] != "" } { - return -1 +if {[gdb_compile_ada "${srcfile}" "${binfile}" executable {debug}] != ""} { + return -1 } gdb_exit diff --git a/gdb/testsuite/gdb.ada/start.exp b/gdb/testsuite/gdb.ada/start.exp index 526fc5e91e0..690c7918a40 100644 --- a/gdb/testsuite/gdb.ada/start.exp +++ b/gdb/testsuite/gdb.ada/start.exp @@ -19,14 +19,16 @@ if $tracelevel then { load_lib "ada.exp" +if { [skip_ada_tests] } { return -1 } + set testdir "start" set testfile "${testdir}/dummy" set srcfile ${srcdir}/${subdir}/${testfile}.adb set binfile ${objdir}/${subdir}/${testfile} file mkdir ${objdir}/${subdir}/${testdir} -if {[gdb_compile_ada "${srcfile}" "${binfile}" executable [list debug ]] != "" } { - return -1 +if {[gdb_compile_ada "${srcfile}" "${binfile}" executable {debug}] != ""} { + return -1 } gdb_exit diff --git a/gdb/testsuite/gdb.ada/watch_arg.exp b/gdb/testsuite/gdb.ada/watch_arg.exp index 3465bd40bd0..f7600e983e8 100644 --- a/gdb/testsuite/gdb.ada/watch_arg.exp +++ b/gdb/testsuite/gdb.ada/watch_arg.exp @@ -19,14 +19,16 @@ if $tracelevel then { load_lib "ada.exp" +if { [skip_ada_tests] } { return -1 } + set testdir "watch_arg" set testfile "${testdir}/watch" set srcfile ${srcdir}/${subdir}/${testfile}.adb set binfile ${objdir}/${subdir}/${testfile} file mkdir ${objdir}/${subdir}/${testdir} -if {[gdb_compile_ada "${srcfile}" "${binfile}" executable [list debug ]] != "" } { - return -1 +if {[gdb_compile_ada "${srcfile}" "${binfile}" executable {debug}] != ""} { + return -1 } gdb_exit diff --git a/gdb/testsuite/gdb.fortran/array-element.exp b/gdb/testsuite/gdb.fortran/array-element.exp index 316ae07deae..b8d863a1dea 100644 --- a/gdb/testsuite/gdb.fortran/array-element.exp +++ b/gdb/testsuite/gdb.fortran/array-element.exp @@ -22,12 +22,14 @@ if $tracelevel then { strace $tracelevel } +if { [skip_fortran_tests] } { return -1 } + set testfile "array-element" set srcfile ${testfile}.f set binfile ${objdir}/${subdir}/${testfile} -if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug f77 quiet}] != "" } { - untested "Couldn't compile ${srcfile}" +if {[gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" \ + executable {debug f77}] != ""} { return -1 } diff --git a/gdb/testsuite/gdb.fortran/derived-type.exp b/gdb/testsuite/gdb.fortran/derived-type.exp index 47e68f2175c..ca75e1f56ed 100644 --- a/gdb/testsuite/gdb.fortran/derived-type.exp +++ b/gdb/testsuite/gdb.fortran/derived-type.exp @@ -22,12 +22,14 @@ if $tracelevel then { strace $tracelevel } +if { [skip_fortran_tests] } { return -1 } + set testfile "derived-type" set srcfile ${testfile}.f90 set binfile ${objdir}/${subdir}/${testfile} -if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug f77 quiet}] != "" } { - untested "Couldn't compile ${srcfile}" +if {[gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" \ + executable {debug f77}] != ""} { return -1 } diff --git a/gdb/testsuite/gdb.fortran/exprs.exp b/gdb/testsuite/gdb.fortran/exprs.exp index 656c54fca8b..ae3f771e6f2 100644 --- a/gdb/testsuite/gdb.fortran/exprs.exp +++ b/gdb/testsuite/gdb.fortran/exprs.exp @@ -21,6 +21,8 @@ if $tracelevel then { strace $tracelevel } +if { [skip_fortran_tests] } { continue } + set prms_id 0 set bug_id 0 diff --git a/gdb/testsuite/gdb.fortran/subarray.exp b/gdb/testsuite/gdb.fortran/subarray.exp index b8ddf2660c6..47fc40dca80 100644 --- a/gdb/testsuite/gdb.fortran/subarray.exp +++ b/gdb/testsuite/gdb.fortran/subarray.exp @@ -22,12 +22,14 @@ if $tracelevel then { strace $tracelevel } +if { [skip_fortran_tests] } { return -1 } + set testfile "subarray" set srcfile ${testfile}.f set binfile ${objdir}/${subdir}/${testfile} -if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug f77 quiet}] != "" } { - untested "Couldn't compile ${srcfile}" +if {[gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" \ + executable {debug f77}] != ""} { return -1 } diff --git a/gdb/testsuite/gdb.fortran/types.exp b/gdb/testsuite/gdb.fortran/types.exp index 1eb4c42a469..51e6e2f359b 100644 --- a/gdb/testsuite/gdb.fortran/types.exp +++ b/gdb/testsuite/gdb.fortran/types.exp @@ -21,6 +21,8 @@ if $tracelevel then { strace $tracelevel } +if { [skip_fortran_tests] } { continue } + set prms_id 0 set bug_id 0 diff --git a/gdb/testsuite/gdb.java/jmain.exp b/gdb/testsuite/gdb.java/jmain.exp index d834c202501..5545f230b96 100644 --- a/gdb/testsuite/gdb.java/jmain.exp +++ b/gdb/testsuite/gdb.java/jmain.exp @@ -22,12 +22,13 @@ if $tracelevel then { load_lib "java.exp" +if { [skip_java_tests] } { continue } + set testfile "jmain" set srcfile ${srcdir}/$subdir/${testfile}.java set binfile ${objdir}/${subdir}/${testfile} -if { [compile_java_from_source ${srcfile} ${binfile} "-g"] != "" } { - untested "Couldn't compile ${srcfile}" - return -1 +if {[compile_java_from_source ${srcfile} ${binfile} "-g"] != ""} { + continue } set prms_id 0 diff --git a/gdb/testsuite/gdb.java/jmisc.exp b/gdb/testsuite/gdb.java/jmisc.exp index 3970e61bc3c..50d32db00b6 100644 --- a/gdb/testsuite/gdb.java/jmisc.exp +++ b/gdb/testsuite/gdb.java/jmisc.exp @@ -22,12 +22,13 @@ if $tracelevel then { load_lib "java.exp" +if { [skip_java_tests] } { continue } + set testfile "jmisc" set srcfile ${srcdir}/$subdir/${testfile}.java set binfile ${objdir}/${subdir}/${testfile} -if { [compile_java_from_source ${srcfile} ${binfile} "-g"] != "" } { - untested "Couldn't compile ${srcfile}" - return -1 +if {[compile_java_from_source ${srcfile} ${binfile} "-g"] != ""} { + continue } # Set the current language to java. This counts as a test. If it diff --git a/gdb/testsuite/gdb.java/jprint.exp b/gdb/testsuite/gdb.java/jprint.exp index cd6eec095f9..a7cd84ef287 100644 --- a/gdb/testsuite/gdb.java/jprint.exp +++ b/gdb/testsuite/gdb.java/jprint.exp @@ -22,12 +22,13 @@ if $tracelevel then { load_lib "java.exp" +if { [skip_java_tests] } { continue } + set testfile "jprint" set srcfile ${srcdir}/$subdir/${testfile}.java set binfile ${objdir}/${subdir}/${testfile} -if { [compile_java_from_source ${srcfile} ${binfile} "-g"] != "" } { - untested "Couldn't compile ${srcfile}" - return -1 +if {[compile_java_from_source ${srcfile} ${binfile} "-g"] != ""} { + continue } # Set the current language to java. This counts as a test. If it diff --git a/gdb/testsuite/gdb.java/jv-print.exp b/gdb/testsuite/gdb.java/jv-print.exp index 52d44dc9110..42a0716bbe8 100644 --- a/gdb/testsuite/gdb.java/jv-print.exp +++ b/gdb/testsuite/gdb.java/jv-print.exp @@ -17,6 +17,10 @@ if $tracelevel then { strace $tracelevel } +load_lib "java.exp" + +if { [skip_java_tests] } { continue } + set prms_id 0 set bug_id 0 diff --git a/gdb/testsuite/gdb.mi/mi-var-child-f.exp b/gdb/testsuite/gdb.mi/mi-var-child-f.exp index e83fd3b9e04..cb123083772 100644 --- a/gdb/testsuite/gdb.mi/mi-var-child-f.exp +++ b/gdb/testsuite/gdb.mi/mi-var-child-f.exp @@ -18,6 +18,8 @@ load_lib mi-support.exp set MIFLAGS "-i=mi" +if { [skip_fortran_tests] } { return -1 } + gdb_exit if [mi_gdb_start] { continue @@ -26,8 +28,8 @@ if [mi_gdb_start] { set testfile "array" set srcfile ${testfile}.f set binfile ${objdir}/${subdir}/${testfile} -if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug f77 quiet}] != "" } { - untested "Couldn't compile ${srcfile}" +if {[gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" \ + executable {debug f77}] != ""} { return -1 } diff --git a/gdb/testsuite/lib/ada.exp b/gdb/testsuite/lib/ada.exp index 4c161d6dc88..9ec6b3fa1e5 100644 --- a/gdb/testsuite/lib/ada.exp +++ b/gdb/testsuite/lib/ada.exp @@ -423,9 +423,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 590a28470ac..53253b348cd 100644 --- a/gdb/testsuite/lib/gdb.exp +++ b/gdb/testsuite/lib/gdb.exp @@ -1241,6 +1241,24 @@ 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]" + } elseif { [regexp {.*: command not found[\r|\n]*$} $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++. @@ -1266,6 +1284,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 +} + # Return a 1 if we should skip shared library tests. proc skip_shlib_tests {} { @@ -1836,9 +1866,15 @@ proc gdb_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 19619df6bfa..c45af359229 100644 --- a/gdb/testsuite/lib/java.exp +++ b/gdb/testsuite/lib/java.exp @@ -90,31 +90,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} executable $args] + gdb_compile_test $srcfile $result + return $result } # Local Variables: