* gdb.base/a1-selftest.exp: Reset the timeout value to 30 seconds
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.base / a1-selftest.exp
index af9d836d2afcaa78500a37056addb360ef7e699d..5a56a895c715fb4c958bf4ea40d7e7c01f704ea1 100644 (file)
@@ -28,7 +28,14 @@ set bug_id 0
 
 # are we on a target board
 if ![isnative] then {
-    warning "These test cases can't run on a target system."
+    continue
+}
+if [istarget "m68k*-*-hpux*"] then {
+    # The top-level makefile passes CFLAGS= (no -g) for hp300.  This probably
+    # should be fixed (it is only needed for gcc bootstrapping, not gdb),
+    # but until then.....
+    setup_xfail "*-*-*"
+    fail "cannot test self if compiled without debug info"
     continue
 }
 
@@ -36,7 +43,6 @@ proc test_with_self {} {
     global prompt
     global tool
     global det_file
-    global timeout
     global decimal
 
     # load yourself into the debugger
@@ -46,17 +52,14 @@ proc test_with_self {} {
     # entire symbol table.  Set the timeout to 10 minutes, which should be
     # adequate for most environments (it *has* timed out with 5 min on a
     # SPARCstation SLC under moderate load, so this isn't unreasonable).
-    # After gdb is loaded, set the timeout to 30 seconds for the duration
+    # After gdb is started, set the timeout to 30 seconds for the duration
     # of this test, and then back to the original value.
 
-    set oldtimeout $timeout
     set timeout 600
     if {[gdb_load "./x$tool"] <0} then {
        return -1
     }
 
-    set timeout 30
-
     # disassemble yourself
     send "x/10i main\n"
     expect {
@@ -80,6 +83,15 @@ proc test_with_self {} {
        }
     }
 
+    # We'll need this when we send a ^C to GDB.  Need to do it before we
+    # run the program and gdb starts saving and restoring tty states.
+    # On Ultrix, we don't need it and it is really slow (because shell_escape
+    # doesn't use vfork).
+    if ![istarget "*-*-ultrix*"] then {
+       gdb_test "shell stty intr '^C'" "" \
+           "set interrupt character in test_with_self"
+    }
+
     # run yourself
     set description "run until breakpoint at main"
     send "run\n"
@@ -103,6 +115,10 @@ proc test_with_self {} {
        }
     }
 
+    # It may take a very long time for the inferior gdb to start (lynx),
+    # so we wait until after it's started to reset the timeout value.
+    set timeout 30
+
     # do we have a version number ?
     send "print version\n"
     expect {
@@ -154,7 +170,7 @@ proc test_with_self {} {
            fail "$description"
        }
        timeout {
-           fail "$description" (timeout)"
+           fail "$description (timeout)"
        }
     }
 
@@ -174,7 +190,7 @@ proc test_with_self {} {
            fail "$description"
        }
        timeout {
-           fail "$description" (timeout)"
+           fail "$description (timeout)"
        }
     }
     
@@ -194,14 +210,14 @@ proc test_with_self {} {
            fail "$description"
        }
        timeout {
-           fail "$description" (timeout)"
+           fail "$description (timeout)"
        }
     }
     
     set description "step over ttyarg initialization"
     send "step\n"
     expect {
-       -re "init_malloc.* NULL.*$prompt $" {
+       -re ".*time_at_startup = get_run_time .*$prompt $" {
            pass "$description"
        }
        -re ".*No such file or directory.\r\n$prompt $" {
@@ -214,23 +230,49 @@ proc test_with_self {} {
            fail "$description"
        }
        timeout {
-           fail "$description" (timeout)"
+           fail "$description (timeout)"
        }
     }
 
     # now jump over a few functions
 
-    set description "next over init_malloc and everything it calls"
+    set description "next over get_run_time and everything it calls"
+    set got_over_get_run_time 0
     send "next\n"
     expect {
-       -re "if.*SET_TOP_LEVEL.*$prompt $" {
+       -re ".*init_malloc.*$prompt $" {
            pass "$description"
+           set got_over_get_run_time 1
+       }
+       -re ".*No such file or directory.\r\n$prompt $" {
+           pass "$description (no source available)"
+           set got_over_get_run_time 1
        }
-       -re "i = .*count.*$prompt $" {
-           pass "$description"
-           set description "next over ALIGN_STACK_ON_STARTUP code"
-           send "next\n"
-           expect {
+       -re ".*A file or directory .* does not exist..\r\n$prompt $" {
+           pass "$description (no source available)"
+           set got_over_get_run_time 1
+       }
+       -re ".*$prompt $" {
+           fail "$description"
+       }
+       timeout {
+           fail "$description (timeout)"
+       }
+    }
+    #    -re "if \(setmp \(to_top_level\)\).*$prompt $" { pass "first next" }
+
+    if $got_over_get_run_time then {
+       set description "next over init_malloc and everything it calls"
+       send "next\n"
+       expect {
+           -re "if.*SET_TOP_LEVEL.*$prompt $" {
+               pass "$description"
+           }
+           -re "i = .*count.*$prompt $" {
+             pass "$description"
+             set description "next over ALIGN_STACK_ON_STARTUP code"
+             send "next\n"
+             expect {
                -re "if.*i != 0.*$prompt $" {
                    pass "$description"
                    send "next\n"
@@ -248,27 +290,23 @@ proc test_with_self {} {
                        }
                    }
                }
+             }
+           }
+           -re ".*No such file or directory.\r\n$prompt $" {
+               pass "$description (no source available)"
+           }
+           -re ".*A file or directory .* does not exist..\r\n$prompt $" {
+               pass "$description (no source available)"
+           }
+           -re ".*$prompt $" {
+               fail "$description"
+           }
+           default {
+               fail "$description (timeout or eof)"
            }
-       }
-       -re ".*No such file or directory.\r\n$prompt $" {
-           pass "$description (no source available)"
-       }
-       -re ".*A file or directory .* does not exist..\r\n$prompt $" {
-           pass "$description (no source available)"
-       }
-       -re ".*$prompt $" {
-           fail "$description"
-       }
-       timeout {
-           fail "$description (timeout)"
        }
     }
-    #    -re "if \(setmp \(to_top_level\)\).*$prompt $" { pass "first next" }
-    
-    
-    # This one fails on Solaris (for some versions of gdb) because you
-    # can't next over library functions
-    setup_xfail "sparc-sun-solaris2" 1817
+
     set next_ok 1
     set need_to_step_over_cmdsize 1
     set description "next over SET_TOP_LEVEL call"
@@ -330,14 +368,12 @@ proc test_with_self {} {
                fail "$description"
            }
            timeout {
-               fail "$description" (timeout)"
+               fail "$description (timeout)"
            }
        }
     }
 
     # and another step for good luck
-    # This one fails on Solaris (for some versions of gdb) because you
-    # can't step into library functions
     if $next_ok {
        set description "step into xmalloc call"
         send "step\n"
@@ -359,7 +395,7 @@ proc test_with_self {} {
            }
        }
     }
-    
+
     # start the "xgdb" process
     send "continue\n"
     expect {
@@ -410,57 +446,30 @@ GDB.*Copyright \[0-9\]+ Free Software Foundation, Inc..*$prompt $"\
     }
     
     # get a stack trace
-    setup_xfail "rs6000-*-*"
     setup_xfail "i486-*-sysv4"
     set description "backtrace through signal handler"
     send "backtrace\n"
     expect {
-       -re "#0.*read.*#\[1-9\].*main.c.*$prompt $" {
+       -re "#0.*read.*in main \\(.*\\) at .*main\\.c.*$prompt $" {
            pass "$description"
        }
        -re ".*$prompt $" {
+           # On the alpha, we hit the infamous problem about gdb
+           # being unable to get the frame pointer (mentioned in
+           # gdb/README).  As it is intermittent, there is no way to
+           # XFAIL it which will give us an XPASS if the problem goes
+           # away.
+           setup_xfail "alpha*-*-osf*"
            fail "$description"
        }
        timeout {
            fail "$description (timeout)"
        }
     }
-    
-    # force GDB to dump core.  On Solaris expect seems to not see the
-    # final message, even if gdb did dump core, so we check for the
-    # core dump explicitly if we time out.
-    # bsd 386 systems append the name of the program to the corefile name.
-    system rm -f core core.gdb
-    send "maint dump-me\n"
-    expect {
-       -re "maint dump-me.*Should GDB dump core.*y or n. $" {
-           send "y\n"
-           expect {
-               -re "Quit.*core dumped.*"    { pass "GDB dumped core" }
-               -re "Program received signal SIGQUIT.*$prompt $" {
-                   pass "GDB dumped core"
-                   # This means we just told xgdb, not gdb, to dump core.
-                   # Get out of gdb so that removing xgdb doesn't get
-                   # test busy errors.
-                   gdb_exit
-               }
-               -re "$prompt $" { fail "GDB dumped core" }
-               default { 
-                   if {[file exists core] || [file exists core.gdb]} then {
-                       pass "GDB dumped core"
-                   } else {
-                       fail "GDB dumped core"
-                   }
-               }
-           }
-       }
-       -re ".*$prompt $"       { fail "GDB dumped core" }
-       timeout             { fail "(timeout) GDB dumped core" }
-    }
-    system rm -f core core.gdb
+
+    gdb_exit
 
     # Set the timeout back to the value it had when we were called.
-    set timeout $oldtimeout
 
     # Restart gdb in case next test expects it to be started already.
     gdb_start
This page took 0.026789 seconds and 4 git commands to generate.