Use do_self_tests in selftest.exp
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.gdb / selftest.exp
index af0026c9e95abcd6974d9973ac8c95924c296b36..809045ae0d47aa8c9ae1eddea5020ec2fcb0bd7c 100644 (file)
 
 load_lib selftest-support.exp
 
-# are we on a target board
-if { [is_remote target] || ![isnative] } then {
-    return
-}
-
 # Not all of the lines of code near the start of main are executed for
 # every machine.  Also, optimization may reorder some of the lines.
 # So all we do is try to step or next over everything until we get
@@ -254,44 +249,11 @@ proc do_steps_and_nexts {} {
     }
 }
 
-proc test_with_self { executable } {
+proc test_with_self { } {
     global gdb_prompt
-    global tool
-    global det_file
     global decimal
     global timeout
-    global INTERNAL_GDBFLAGS
-    global inferior_spawn_id gdb_spawn_id
-
-    # load yourself into the debugger
-    # This can take a relatively long time, particularly for testing where
-    # the executable is being accessed over a network, or where gdb does not
-    # support partial symbols for a particular target and has to load the
-    # 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 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
-    verbose "Timeout is now $timeout seconds" 2
-
-    global gdb_file_cmd_debug_info
-    set gdb_file_cmd_debug_info "unset"
-
-    set result [gdb_load $executable]
-    set timeout $oldtimeout
-    verbose "Timeout is now $timeout seconds" 2
-
-    if { $result != 0 } then {
-       return -1
-    }
-
-    if { $gdb_file_cmd_debug_info != "debug" } then {
-       untested "No debug information, skipping testcase."
-       return -1
-    }
+    global inferior_spawn_id
 
     # When GDB is built as a C++ program, disassemble shows the full
     # prototype.
@@ -302,11 +264,6 @@ proc test_with_self { executable } {
            "x/10i.*main.*main($cxx_main_args_re)?.$decimal.*main($cxx_main_args_re)?.$decimal.*" \
            "Disassemble main"
 
-    # Set a breakpoint at main
-    gdb_test "break captured_main" \
-           "Breakpoint.*at.* file.*, line.*" \
-           "breakpoint in captured_main"
-
     # 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.
     gdb_test "shell stty intr '^C'" ".*" \
@@ -317,36 +274,6 @@ proc test_with_self { executable } {
     # gdb is stopped.
     gdb_test_no_output "set listsize 1" "set listsize to 1"
 
-    # run yourself
-    # It may take a very long time for the inferior gdb to start (lynx),
-    # so we bump it back up for the duration of this command.
-    set timeout 600
-
-    set description "run until breakpoint at captured_main"
-    gdb_test_multiple "run $INTERNAL_GDBFLAGS" "$description" {
-       -re "Starting program.*Breakpoint \[0-9\]+,.*captured_main .data.* at .*main.c:.*$gdb_prompt $" {
-           pass "$description"
-       }
-       -re "Starting program.*Breakpoint \[0-9\]+,.*captured_main .data.*$gdb_prompt $" {
-           xfail "$description (line numbers scrambled?)"
-       }
-       -re "vfork: No more processes.*$gdb_prompt $" {
-           fail "$description (out of virtual memory)"
-           set timeout $oldtimeout
-           verbose "Timeout is now $timeout seconds" 2
-           return -1
-       }
-       -re ".*$gdb_prompt $" {
-           fail "$description"
-           set timeout $oldtimeout
-           verbose "Timeout is now $timeout seconds" 2
-           return -1
-       }
-    }
-
-    set timeout $oldtimeout
-    verbose "Timeout is now $timeout seconds" 2
-
     # do we have a version number ?
     gdb_test_multiple "print version" "printed version" {
        -re ".\[0-9\]+ = .\[0-9.\]+.*$gdb_prompt $" {
@@ -476,37 +403,8 @@ proc test_with_self { executable } {
        }
     }
 
-
-    # Set the timeout back to the value it had when we were called.
-    set timeout $oldtimeout
-    verbose "Timeout is now $timeout seconds" 2
-
     # Restart gdb in case next test expects it to be started already.
     return 0
 }
 
-# Run the test with self.
-# Copy the file executable file in case this OS doesn't like to edit its own
-# text space.
-
-set GDB_FULLPATH [find_gdb $GDB]
-
-if {[is_remote host]} {
-    set xgdb x$tool
-} else {
-    set xgdb [standard_output_file x$tool]
-}
-
-# Remove any old copy lying around.
-remote_file host delete $xgdb
-
-gdb_start
-set file [remote_download host $GDB_FULLPATH $xgdb]
-set result [test_with_self $file]
-gdb_exit
-catch "remote_file host delete $file"
-
-if {$result <0} then {
-    warning "Couldn't test self"
-    return -1
-}
+do_self_tests captured_main test_with_self
This page took 0.026276 seconds and 4 git commands to generate.