aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYao Qi <yao.qi@linaro.org>2016-07-19 10:42:08 +0100
committerYao Qi <yao.qi@linaro.org>2016-07-19 10:42:08 +0100
commitf25827c194fe9894f2c65f7e1101854022be4328 (patch)
treecc482d3be179ebe5e98313b99b6f1ee2d7b41eef
parentace667e59aede65c400381f1cff704b61e8ccb0b (diff)
downloadgdb-f25827c194fe9894f2c65f7e1101854022be4328.zip
gdb-f25827c194fe9894f2c65f7e1101854022be4328.tar.gz
gdb-f25827c194fe9894f2c65f7e1101854022be4328.tar.bz2
Use do_self_tests in selftest.exp
This patch uses do_self_tests to simplify selftest.exp. It doesn't change the tests except the order, -PASS: gdb.gdb/selftest.exp: Disassemble main PASS: gdb.gdb/selftest.exp: breakpoint in captured_main +PASS: gdb.gdb/selftest.exp: run until breakpoint at captured_main +PASS: gdb.gdb/selftest.exp: Disassemble main PASS: gdb.gdb/selftest.exp: set interrupt character in test_with_self PASS: gdb.gdb/selftest.exp: set listsize to 1 -PASS: gdb.gdb/selftest.exp: run until breakpoint at captured_main gdb/testsuite: 2016-07-19 Yao Qi <yao.qi@linaro.org> * gdb.gdb/selftest.exp: Remove checks on is_remote and isnative. (test_with_self): Remove some code. Remove argument executable. (top-level): Use do_self_tests.
-rw-r--r--gdb/testsuite/ChangeLog6
-rw-r--r--gdb/testsuite/gdb.gdb/selftest.exp108
2 files changed, 9 insertions, 105 deletions
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index aaa1c9e..c92264f 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,3 +1,9 @@
+2016-07-19 Yao Qi <yao.qi@linaro.org>
+
+ * gdb.gdb/selftest.exp: Remove checks on is_remote and isnative.
+ (test_with_self): Remove some code. Remove argument executable.
+ (top-level): Use do_self_tests.
+
2016-07-15 Zachary Welch <zwelch@codesourcery.com>
Don Breazeal <donb@codesourcery.com>
diff --git a/gdb/testsuite/gdb.gdb/selftest.exp b/gdb/testsuite/gdb.gdb/selftest.exp
index af0026c..809045a 100644
--- a/gdb/testsuite/gdb.gdb/selftest.exp
+++ b/gdb/testsuite/gdb.gdb/selftest.exp
@@ -17,11 +17,6 @@
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