summaryrefslogtreecommitdiff
path: root/gdb/testsuite/gdb.base/a2-run.exp
diff options
context:
space:
mode:
authorBob Manson <manson@cygnus>1997-01-29 09:40:31 +0000
committerBob Manson <manson@cygnus>1997-01-29 09:40:31 +0000
commit787f6220773d9174a9675dedd3bbfc8f070511a6 (patch)
tree64911c10d46bc93973cc825a730b4173b3367a49 /gdb/testsuite/gdb.base/a2-run.exp
parent1a2faf1f1e335ff32c1d8c5c7675cd7ce9055e33 (diff)
downloadbinutils-gdb-787f6220773d9174a9675dedd3bbfc8f070511a6.tar.gz
Major revision to testsuites for cross-testing and DOS testing support.
Diffstat (limited to 'gdb/testsuite/gdb.base/a2-run.exp')
-rw-r--r--gdb/testsuite/gdb.base/a2-run.exp134
1 files changed, 74 insertions, 60 deletions
diff --git a/gdb/testsuite/gdb.base/a2-run.exp b/gdb/testsuite/gdb.base/a2-run.exp
index 88392b9c6d3..89f2c7d9f6e 100644
--- a/gdb/testsuite/gdb.base/a2-run.exp
+++ b/gdb/testsuite/gdb.base/a2-run.exp
@@ -21,14 +21,19 @@
# These tests don't work for targets can't take arguments...
-if $noargs then {
- verbose "Skipping a2-run.exp because of noargs."
- return
- }
+if [target_info exists gdb,noargs] then {
+ verbose "Skipping a2-run.exp because of noargs."
+ return
+}
+
+if [target_info exists gdb,noinferiorio] {
+ verbose "Skipping a2-run.exp because of noinferiorio."
+ return
+}
if $tracelevel then {
- strace $tracelevel
- }
+ strace $tracelevel
+}
#
# test running programs
@@ -37,9 +42,9 @@ set prms_id 0
set bug_id 0
set testfile "run"
-set srcfile ${srcdir}/$subdir/${testfile}.c
+set srcfile ${testfile}.c
set binfile ${objdir}/${subdir}/${testfile}
-if { [compile "${srcfile} -g -o ${binfile}"] != "" } {
+if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
perror "Couldn't compile ${srcfile}"
return -1
}
@@ -51,102 +56,109 @@ gdb_load ${binfile}
# Run with no arguments.
# On VxWorks this justs make sure the program was run.
-send "run\n"
-expect -re "run\[\r\n\]+" {}
+gdb_run_cmd
+
if [istarget "*-*-vxworks*"] then {
set timeout 120
+ verbose "Timeout is now $timeout seconds" 2
expect {
- -i $shell_id "Program exited normally" {
- unresolved "run \"$binfile\" with no args"
+ -i $gdb_spawn_id "Program exited normally" {
+ unresolved "run \"$testfile\" with no args"
}
- -i $shell_id -re "usage: factorial <number>" {
- pass "run \"$binfile\" with no args"
+ -i $gdb_spawn_id -re "usage: factorial <number>" {
+ pass "run \"$testfile\" with no args"
}
timeout {
- fail "(timeout) run \"$binfile\" with no args"
+ fail "(timeout) run \"$testfile\" with no args"
}
}
set timeout 10
+ verbose "Timeout is now $timeout seconds" 2
expect -re "$prompt $" {}
} else {
expect {
- -re "Starting program.*usage: factorial <number>.*Program exited with code 01.*$prompt $" {
- pass "run \"$binfile\" with no args"
+ -re ".*usage: factorial <number>.*Program exited with code 01.*$prompt $" {
+ pass "run \"$testfile\" with no args"
}
-re ".*$prompt $" {
- fail "run \"$binfile\" with no args"
+ fail "run \"$testfile\" with no args"
+ verbose "expect_out is $expect_out(buffer)" 2
}
timeout {
- fail "(timeout) run \"$binfile\" no args"
+ fail "(timeout) run \"$testfile\" no args"
}
}
}
-
# Now run with some arguments
if [istarget "*-*-vxworks*"] then {
- send "run vxmain \"5\"\n"
+ send_gdb "run vxmain \"5\"\n"
expect -re "run vxmain \"5\"\r\n" {}
set timeout 120
+ verbose "Timeout is now $timeout seconds" 2
expect {
-i $shell_id "Program exited normally" {
- unresolved "run \"$binfile\" with arg"
+ unresolved "run \"$testfile\" with arg"
}
-i $shell_id "120" {
- pass "run \"$binfile\" with arg"
+ pass "run \"$testfile\" with arg"
}
timeout {
- fail "(timeout) run \"$binfile\" with arg"
+ fail "(timeout) run \"$testfile\" with arg"
}
}
set timeout 10
+ verbose "Timeout is now $timeout seconds" 2
expect -re "$prompt $" {}
} else {
setup_xfail "mips-idt-*"
- send "run 5\n"
+ gdb_run_cmd 5
expect {
- -re "Starting program.*$binfile.*120.*$prompt $"\
- { pass "run \"$binfile\" with arg" }
- -re ".*$prompt $" { fail "run \"$binfile\" with arg" }
- timeout { fail "(timeout) run \"$binfile\" with arg" }
+ -re ".*120.*$prompt $"\
+ { pass "run \"$testfile\" with arg" }
+ -re ".*$prompt $" { fail "run \"$testfile\" with arg" }
+ timeout { fail "(timeout) run \"$testfile\" with arg" }
}
}
# Run again with same arguments.
setup_xfail "mips-idt-*"
-send "run\n"
-expect -re "run\[\r\n\]+" {}
+gdb_run_cmd
+
if [istarget "*-*-vxworks*"] then {
set timeout 120
+ verbose "Timeout is now $timeout seconds" 2
expect {
-i $shell_id "Program exited normally" {
- unresolved "run \"$binfile\" again with same args"
+ unresolved "run \"$testfile\" again with same args"
}
- -i $shell_id "120" { pass "run \"$binfile\" again with same args" }
- timeout { fail "(timeout) run \"$binfile\" again with same args" }
+ -i $shell_id "120" { pass "run \"$testfile\" again with same args" }
+ timeout { fail "(timeout) run \"$testfile\" again with same args" }
}
set timeout 10
+ verbose "Timeout is now $timeout seconds" 2
expect -re "$prompt $" {}
} else {
expect {
- -re "Starting program.*120.*$prompt $"\
- { pass "run \"$binfile\" again with same args" }
- -re ".*$prompt $" { fail "run \"$binfile\" again with same args" }
- timeout { fail "(timeout) run \"$binfile\" again with same args" }
+ -re ".*120.*$prompt $"\
+ { pass "run \"$testfile\" again with same args" }
+ -re ".*$prompt $" { fail "run \"$testfile\" again with same args" }
+ timeout { fail "(timeout) run \"$testfile\" again with same args" }
}
}
# Use "set args" command to specify no arguments as default and run again.
if [istarget "*-*-vxworks*"] then {
- send "set args main\n"
+ send_gdb "set args main\n"
} else {
- send "set args\n"
+ send_gdb "set args\n"
}
expect -re "$prompt $"
-send "run\n"
-expect -re "run\[\r\n\]+" {}
+gdb_run_cmd
+
if [istarget "*-*-vxworks*"] then {
set timeout 120
+ verbose "Timeout is now $timeout seconds" 2
expect {
-i $shell_id "Program exited normally" {
unresolved "run after setting args to nil"
@@ -159,10 +171,11 @@ if [istarget "*-*-vxworks*"] then {
}
}
set timeout 10
+ verbose "Timeout is now $timeout seconds" 2
expect -re "$prompt $" {}
} else {
expect {
- -re "Starting program.*usage: factorial <number>.*$prompt $" {
+ -re ".*usage: factorial <number>.*$prompt $" {
pass "run after setting args to nil"
}
-re ".*$prompt $" {
@@ -177,38 +190,40 @@ if [istarget "*-*-vxworks*"] then {
# Use "set args" command to specify an argument and run again.
setup_xfail "mips-idt-*"
if [istarget "*-*-vxworks*"] then {
- send "set args vxmain \"6\"\n"
+ send_gdb "set args vxmain \"6\"\n"
} else {
- send "set args 6\n"
+ send_gdb "set args 6\n"
}
expect -re "$prompt $"
-send "run\n"
-expect -re "run\[\r\n\]+" {}
+gdb_run_cmd
+
if [istarget "*-*-vxworks*"] then {
set timeout 120
+ verbose "Timeout is now $timeout seconds" 2
expect {
-i $shell_id "Program exited normally" {
- unresolved "run \"$binfile\" again after setting args"
+ unresolved "run \"$testfile\" again after setting args"
}
-i $shell_id "720" {
- pass "run \"$binfile\" again after setting args"
+ pass "run \"$testfile\" again after setting args"
}
timeout {
- fail "(timeout) run \"$binfile\" again after setting args"
+ fail "(timeout) run \"$testfile\" again after setting args"
}
}
set timeout 10
+ verbose "Timeout is now $timeout seconds" 2
expect -re "$prompt $" {}
} else {
expect {
- -re "Starting program.*720.*$prompt $" {
- pass "run \"$binfile\" again after setting args"
+ -re ".*720.*$prompt $" {
+ pass "run \"$testfile\" again after setting args"
}
-re ".*$prompt $" {
- fail "run \"$binfile\" again after setting args"
+ fail "run \"$testfile\" again after setting args"
}
timeout {
- fail "(timeout) run \"$binfile\" again after setting args"
+ fail "(timeout) run \"$testfile\" again after setting args"
}
}
}
@@ -216,23 +231,22 @@ if [istarget "*-*-vxworks*"] then {
# GOAL: Test that shell is being used with "run". For remote debugging
# targets, there is no guarantee that a "shell" (whatever that is) is used.
if [isnative] then {
- send "run `echo 8`\n"
+ send_gdb "run `echo 8`\n"
expect {
-re "Starting program.*40320.*$prompt $" {
- pass "run \"$binfile\" with shell"
+ pass "run \"$testfile\" with shell"
}
-re ".*$prompt $" {
- fail "run \"$binfile\" with shell"
+ fail "run \"$testfile\" with shell"
}
timeout {
- fail "(timeout) run \"$binfile\" with shell"
+ fail "(timeout) run \"$testfile\" with shell"
}
}
}
# Reset the default arguments for VxWorks
if [istarget "*-*-vxworks*"] then {
- send "set args main\n"
+ send_gdb "set args main\n"
expect -re ".*$prompt $" {}
}
-