GDB copyright headers update after running GDB's copyright.py script.
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.base / return.exp
index bc4e76e1452f1c6399757d42034be49c75b6d1c4..95748eb25cf03bd3f38f1c3f487e3ed6519bdcec 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright (C) 1992, 1997, 2001, 2007 Free Software Foundation, Inc.
+# Copyright (C) 1992-2016 Free Software Foundation, Inc.
 
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-# Please email any bugs, comments, and/or additions to this file to:
-# bug-gdb@prep.ai.mit.edu
-
 # This file was written by Jeff Law. (law@cs.utah.edu)
 
-if $tracelevel then {
-       strace $tracelevel
-}
-
-set prms_id 0
-set bug_id 0
-
-set testfile "return"
-set srcfile ${testfile}.c
-set binfile ${objdir}/${subdir}/${testfile}
-if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
-     untested return.exp
-     return -1
+if { [prepare_for_testing return.exp "return"] } {
+    return -1
 }
 
 proc return_tests { } {
@@ -38,8 +24,8 @@ proc return_tests { } {
 
 
     if { ! [ runto func1 ] } then { return 0 }
-    send_gdb "return\n"
-    gdb_expect {
+
+    gdb_test_multiple "return" "simple return" {
        -re "Make .* return now.*y or n. $" {
            send_gdb "y\n"
            exp_continue
@@ -48,26 +34,27 @@ proc return_tests { } {
            send_gdb "step\n"
            exp_continue
        }
-    -re ".*in main after func1.*$gdb_prompt $" { pass "simple return" }
-    -re "$gdb_prompt $" { fail "simple return" }
-    timeout { fail "(timeout) simple return" }
+       -re ".*in main after func1.*$gdb_prompt $" { 
+           pass "simple return" 
+       }
     }
 
     # Set breakpoints in other interesting functions.
-    gdb_test "break func2" "" "break func2"
-    gdb_test "break func3" "" "break func3"
+    gdb_test "break func2" ".*" "break func2"
+    gdb_test "break func3" ".*" "break func3"
 
     gdb_test "continue" "return -5;" "continue to return of -5"
-    send_gdb "return 5\n"
-    gdb_expect {
+
+    gdb_test_multiple "return 5" "return value 5" {
        -re "Make .* return now.*y or n. $" {
            send_gdb "y\n"
            exp_continue
        }
-    -re ".*tmp2 = func2.*$gdb_prompt $" { }
-    -re "$gdb_prompt $" { fail "did not return (integer test)" }
-    timeout { fail "(timeout) did not return (integer test)" }
+       -re ".*tmp2 = func2.*$gdb_prompt $" {
+           # pass without comment
+       }
     }
+
     gdb_test "next" "tmp3 = func3.*" "next over call to func2"
 
     gdb_test "p tmp2" ".* = 5" "correct value returned (integer test)"
@@ -77,15 +64,15 @@ proc return_tests { } {
     # Return of a double does not work for 68hc11 (need struct return
     # in memory).
     setup_xfail "m6811-*-*"
-    send_gdb "return 5.0\n"
-    gdb_expect {
+
+    gdb_test_multiple "return 5.0" "return value 5.0" {
        -re "Make .* return now.*y or n. $" {
            send_gdb "y\n"
            exp_continue
        }
-       -re ".*tmp3 = func3.*$gdb_prompt $" { }
-       -re "$gdb_prompt $" { fail "did not return (double test)" }
-       timeout { fail "(timeout) did not return (double test)" }
+       -re ".*tmp3 = func3.*$gdb_prompt $" {
+           # pass without comment
+       }
     }
 
     setup_xfail "m6811-*-*"
@@ -101,16 +88,13 @@ proc return_tests { } {
     # is not xfailed.
 
     setup_xfail "sparc-*-solaris2.3*" "sparc-*-solaris2.4*" "m6811-*-*"
-    gdb_test "p tmp3" ".* = 5.*" "correct value returned double test (known problem with sparc solaris)"
+    if ![target_info exists gdb,skip_float_tests] {
+       gdb_test "p tmp3" ".* = 5.*" \
+           "correct value returned double test (known problem with sparc solaris)"
+    }
 }
 
-
-# Start with a fresh gdb.
-
-gdb_exit
-gdb_start
-gdb_reinitialize_dir $srcdir/$subdir
-gdb_load ${binfile}
-
+set prev_timeout $timeout
 set timeout 30
 return_tests
+set timeout $prev_timeout
This page took 0.029415 seconds and 4 git commands to generate.