* [obish] Convert attach.exp to gdb_test_multiple
@ 2004-07-08 21:09 Andrew Cagney
2004-07-12 14:26 ` Andrew Cagney
0 siblings, 1 reply; 5+ messages in thread
From: Andrew Cagney @ 2004-07-08 21:09 UTC (permalink / raw)
To: gdb-patches
[-- Attachment #1: Type: text/plain, Size: 127 bytes --]
I'll leave committing this to tomorrow (i.e., after the branch date).
Still passes on amd64 GNU/Linux and PPC NetBSD.
Andrew
[-- Attachment #2: diffs --]
[-- Type: text/plain, Size: 14530 bytes --]
2004-07-08 Andrew Cagney <cagney@gnu.org>
* gdb.base/attach.exp: Replace send_gdb and gdb_expect with
gdb_test and gdb_test_multiple.
Index: gdb.base/attach.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.base/attach.exp,v
retrieving revision 1.15
diff -p -u -r1.15 attach.exp
--- gdb.base/attach.exp 8 Jul 2004 20:04:47 -0000 1.15
+++ gdb.base/attach.exp 8 Jul 2004 21:05:38 -0000
@@ -94,27 +94,21 @@ proc do_attach_tests {} {
# Verify that we cannot attach to nonsense.
- send_gdb "attach abc\n"
- gdb_expect {
- -re ".*Illegal process-id: abc.*$gdb_prompt $" {
- pass "attach to nonsense is prohibited"
+ set test "attach to nonsense is prohibited"
+ gdb_test_multiple "attach abc" "$test" {
+ -re "Illegal process-id: abc.*$gdb_prompt $" {
+ pass "$test"
}
-re "Attaching to.*, process .*couldn't open /proc file.*$gdb_prompt $" {
# Response expected from /proc-based systems.
- pass "attach to nonsense is prohibited"
+ pass "$test"
}
- -re ".*Can't attach to process..*$gdb_prompt $" {
+ -re "Can't attach to process..*$gdb_prompt $" {
# Response expected on Cygwin
- pass "attach to nonsense is prohibited"
+ pass "$test"
}
-re "Attaching to.*$gdb_prompt $" {
- fail "attach to nonsense is prohibited (bogus pid allowed)"
- }
- -re "$gdb_prompt $" {
- fail "attach to nonsense is prohibited"
- }
- timeout {
- fail "(timeout) attach to nonsense is prohibited"
+ fail "$test (bogus pid allowed)"
}
}
@@ -130,35 +124,29 @@ proc do_attach_tests {} {
# FreeBSD, and probably other *BSD's too).
set boguspid -1
}
- send_gdb "attach $boguspid\n"
- gdb_expect {
+ set test "attach to nonexistent process is prohibited"
+ gdb_test_multiple "attach $boguspid" "$test" {
-re "Attaching to.*, process $boguspid.*No such process.*$gdb_prompt $" {
# Response expected on ptrace-based systems (i.e. HP-UX 10.20).
- pass "attach to nonexistent process is prohibited"
+ pass "$test"
}
-re "Attaching to.*, process $boguspid failed.*Hint.*$gdb_prompt $" {
# Response expected on ttrace-based systems (i.e. HP-UX 11.0).
- pass "attach to nonexistent process is prohibited"
+ pass "$test"
}
-re "Attaching to.*, process $boguspid.*denied.*$gdb_prompt $" {
- pass "attach to nonexistent process is prohibited"
+ pass "$test"
}
-re "Attaching to.*, process $boguspid.*not permitted.*$gdb_prompt $" {
- pass "attach to nonexistent process is prohibited"
+ pass "$test"
}
-re "Attaching to.*, process .*couldn't open /proc file.*$gdb_prompt $" {
# Response expected from /proc-based systems.
- pass "attach to nonexistent process is prohibited"
+ pass "$test"
}
- -re ".*Can't attach to process..*$gdb_prompt $" {
+ -re "Can't attach to process..*$gdb_prompt $" {
# Response expected on Cygwin
- pass "attach to nonexistent process is prohibited"
- }
- -re "$gdb_prompt $" {
- fail "attach to nonexistent process is prohibited"
- }
- timeout {
- fail "(timeout) attach to nonexistent process is prohibited"
+ pass "$test"
}
}
@@ -170,80 +158,38 @@ proc do_attach_tests {} {
# us. So, we must also be prepared to be asked if we want to
# discard an existing set of symbols.)
- send_gdb "file $binfile\n"
- gdb_expect {
- -re "Load new symbol table from.*y or n.*$" {
- send_gdb "y\n"
- gdb_expect {
- -re "Reading symbols from $escapedbinfile\.\.\.*done.*$gdb_prompt $" {
- pass "(re)set file, before attach1"
- }
- -re "$gdb_prompt $" {
- fail "(re)set file, before attach1"
- }
- timeout {
- fail "(timeout) (re)set file, before attach1"
- }
- }
+ set test "set file, before attach1"
+ gdb_test_multiple "file $binfile" "$test" {
+ -re "Load new symbol table from.*y or n. $" {
+ gdb_test "y" "Reading symbols from $escapedbinfile\.\.\.*done." \
+ "$test (re-read)"
}
-re "Reading symbols from $escapedbinfile\.\.\.*done.*$gdb_prompt $" {
- pass "set file, before attach1"
- }
- -re "$gdb_prompt $" {
- fail "set file, before attach1"
- }
- timeout {
- fail "(timeout) set file, before attach1"
+ pass "$test"
}
}
- send_gdb "attach $testpid\n"
- gdb_expect {
+ set test "attach1, after setting file"
+ gdb_test_multiple "attach $testpid" "$test" {
-re "Attaching to program.*`?$escapedbinfile'?, process $testpid.*main.*at .*$srcfile:.*$gdb_prompt $" {
- pass "attach1, after setting file"
+ pass "$test"
}
-re "Attaching to program.*`?$escapedbinfile\.exe'?, process $testpid.*\[Switching to thread $testpid\..*\].*$gdb_prompt $" {
# Response expected on Cygwin
- pass "attach1, after setting file"
- }
- -re "$gdb_prompt $" {
- fail "attach1, after setting file"
- }
- timeout {
- fail "(timeout) attach1, after setting file"
+ pass "$test"
}
}
# Verify that we can "see" the variable "should_exit" in the
# program, and that it is zero.
- send_gdb "print should_exit\n"
- gdb_expect {
- -re ".* = 0.*$gdb_prompt $" {
- pass "after attach1, print should_exit"
- }
- -re "$gdb_prompt $" {
- fail "after attach1, print should_exit"
- }
- timeout {
- fail "(timeout) after attach1, print should_exit"
- }
- }
+ gdb_test "print should_exit" " = 0" "after attach1, print should_exit"
# Detach the process.
- send_gdb "detach\n"
- gdb_expect {
- -re "Detaching from program: .*$escapedbinfile.*$gdb_prompt $" {
- pass "attach1 detach"
- }
- -re "$gdb_prompt $" {
- fail "attach1 detach"
- }
- timeout {
- fail "(timeout) attach1 detach"
- }
- }
+ gdb_test "detach" \
+ "Detaching from program: .*$escapedbinfile, process $testpid" \
+ "attach1 detach"
# Wait a bit for gdb to finish detaching
@@ -255,30 +201,10 @@ proc do_attach_tests {} {
set old_timeout $timeout
set timeout 15
- send_gdb "file\n"
- gdb_expect {
- -re ".*gdb internal error.*$" {
- fail "Internal error, prob. Memory corruption"
- }
- -re "No executable file now.*Discard symbol table.*y or n.*$" {
- send_gdb "y\n"
- gdb_expect {
- -re "No symbol file now.*$gdb_prompt $" {
- pass "attach1, purging symbols after detach"
- }
- -re "$gdb_prompt $" {
- fail "attach1, purging symbols after detach"
- }
- timeout {
- fail "(timeout) attach1, purging symbols after detach"
- }
- }
- }
- -re "$gdb_prompt $" {
- fail "attach1, purging file after detach"
- }
- timeout {
- fail "(timeout) attach1, purging file after detach"
+ set test "attach1, purging symbols after detach"
+ gdb_test_multiple "file" "$test" {
+ -re "No executable file now.*Discard symbol table.*y or n. $" {
+ gdb_test "y" "No symbol file now." "$test"
}
}
set timeout $old_timeout
@@ -286,49 +212,25 @@ proc do_attach_tests {} {
# Verify that we can attach to the process just by giving the
# process ID.
- send_gdb "attach $testpid\n"
- gdb_expect {
- -re "Attaching to process $testpid.*Load new symbol table from \"$escapedbinfile\.exe\".*y or n.*$" {
+ set test "set file, before attach2"
+ gdb_test_multiple "attach $testpid" "$test" {
+ -re "Attaching to process $testpid.*Load new symbol table from \"$escapedbinfile\.exe\".*y or n. $" {
# On Cygwin, the DLL's symbol tables are loaded prior to the
# executable's symbol table. This in turn always results in
# asking the user for actually loading the symbol table of the
# executable.
- send_gdb "y\n"
- gdb_expect {
- -re "Reading symbols from $escapedbinfile\.\.\.*done.*$gdb_prompt $" {
- pass "(re)set file, before attach2"
- }
- -re "$gdb_prompt $" {
- fail "(re)set file, before attach2"
- }
- timeout {
- fail "(timeout) (re)set file, before attach2"
- }
- }
+ gdb_test "y" "Reading symbols from $escapedbinfile\.\.\.*done." \
+ "$test (reset file)"
}
-re "Attaching to process $testpid.*Reading symbols from $escapedbinfile.*main.*at .*$gdb_prompt $" {
- pass "attach2"
- }
- -re "$gdb_prompt $" {
- fail "attach2"
- }
- timeout {
- fail "(timeout) attach2"
+ pass "$test"
}
}
# Verify that we can modify the variable "should_exit" in the
# program.
- send_gdb "set should_exit=1\n"
- gdb_expect {
- -re "$gdb_prompt $" {
- pass "after attach2, set should_exit"
- }
- timeout {
- fail "(timeout) after attach2, set should_exit"
- }
- }
+ gdb_test "set should_exit=1" "" "after attach2, set should_exit"
# Verify that the modification really happened.
@@ -359,18 +261,7 @@ proc do_attach_tests {} {
# Allow the test process to exit, to cleanup after ourselves.
- send_gdb "continue\n"
- gdb_expect {
- -re "Program exited normally.*$gdb_prompt $" {
- pass "after attach2, exit"
- }
- -re "$gdb_prompt $" {
- fail "after attach2, exit"
- }
- timeout {
- fail "(timeout) after attach2, exit"
- }
- }
+ gdb_test "continue" "Program exited normally." "after attach2, exit"
# Make sure we don't leave a process around to confuse
# the next test run (and prevent the compile by keeping
@@ -378,6 +269,7 @@ proc do_attach_tests {} {
# work.
remote_exec build "kill -9 ${testpid}"
+
# Start the program running and then wait for a bit, to be sure
# that it can be attached to.
@@ -393,103 +285,36 @@ proc do_attach_tests {} {
# when we're cd'd to some directory that doesn't contain the
# a.out. (We use the source path set by the "dir" command.)
- send_gdb "dir ${objdir}/${subdir}\n"
- gdb_expect {
- -re ".*Source directories searched: .*$gdb_prompt $" {
- pass "set source path"
- }
- -re "$gdb_prompt $" {
- fail "set source path"
- }
- timeout {
- fail "(timeout) set source path"
- }
- }
+ gdb_test "dir ${objdir}/${subdir}" "Source directories searched: .*" \
+ "set source path"
- send_gdb "cd /tmp\n"
- gdb_expect {
- -re ".*Working directory /tmp.*$gdb_prompt $" {
- pass "cd away from process' a.out"
- }
- -re "$gdb_prompt $" {
- fail "cd away from process' a.out"
- }
- timeout {
- fail "(timeout) cd away from process' a.out"
- }
- }
+ gdb_test "cd /tmp" "Working directory /tmp." \
+ "cd away from process working directory"
# Explicitly flush out any knowledge of the previous attachment.
- send_gdb "symbol\n"
- gdb_expect {
- -re ".*Discard symbol table from.*y or n. $" {
- send_gdb "y\n"
- gdb_expect {
- -re ".*No symbol file now.*$gdb_prompt $" {
- pass "before attach3, flush symbols"
- }
- -re "$gdb_prompt $" {
- fail "before attach3, flush symbols"
- }
- timeout {
- fail "(timeout) before attach3, flush symbols"
- }
- }
- }
- -re ".*No symbol file now.*$gdb_prompt $" {
- pass "before attach3, flush symbols"
- }
- -re "$gdb_prompt $" {
- fail "before attach3, flush symbols"
- }
- timeout {
- fail "(timeout) before attach3, flush symbols"
- }
- }
- send_gdb "exec\n"
- gdb_expect {
- -re ".*No executable file now.*$gdb_prompt $" {
- pass "before attach3, flush exec"
- }
- -re "$gdb_prompt $" {
- fail "before attach3, flush exec"
- }
- timeout {
- fail "(timeout) before attach3, flush exec"
- }
- }
- send_gdb "attach $testpid\n"
- gdb_expect {
- -re "Attaching to process $testpid.*Reading symbols from $escapedbinfile.*main.*at .*$gdb_prompt $" {
- pass "attach when process' a.out not in cwd"
+ set test "before attach3, flush symbols"
+ gdb_test_multiple "symbol" "$test" {
+ -re "Discard symbol table from.*y or n. $" {
+ gdb_test "y" "No symbol file now." \
+ "$test"
}
- -re "$gdb_prompt $" {
- fail "attach when process' a.out not in cwd"
- }
- timeout {
- fail "(timeout) attach when process' a.out not in cwd"
+ -re "No symbol file now.*$gdb_prompt $" {
+ pass "$test"
}
}
- send_gdb "kill\n"
- gdb_expect {
- -re ".*Kill the program being debugged.*y or n. $" {
- send_gdb "y\n"
- gdb_expect {
- -re "$gdb_prompt $" {
- pass "after attach3, exit"
- }
- timeout {
- fail "(timeout) after attach3, exit"
- }
- }
- }
- -re "$gdb_prompt $" {
- fail "after attach3, exit"
- }
- timeout {
- fail "(timeout) after attach3, exit"
+ gdb_test "exec" "No executable file now." \
+ "before attach3, flush exec"
+
+ gdb_test "attach $testpid" \
+ "Attaching to process $testpid.*Reading symbols from $escapedbinfile.*main.*at .*" \
+ "attach when process' a.out not in cwd"
+
+ set test "after attach3, exit"
+ gdb_test_multiple "kill" "$test" {
+ -re "Kill the program being debugged.*y or n. $" {
+ gdb_test "y" "" "$test"
}
}
@@ -514,43 +339,36 @@ proc do_call_attach_tests {} {
# Attach
- gdb_test "file $binfile2" ".*" "force switch to gdb64, if necessary"
- send_gdb "attach $testpid\n"
- gdb_expect {
- -re ".*warning: reading register.*I.*O error.*$gdb_prompt $" {
- fail "attach call, read register 3 error"
+ gdb_test "file $binfile2" "" "force switch to gdb64, if necessary"
+ set test "attach call"
+ gdb_test_multiple "attach $testpid" "$test" {
+ -re "warning: reading register.*I.*O error.*$gdb_prompt $" {
+ fail "$test (read register error)"
}
-re "Attaching to.*process $testpid.*libc.*$gdb_prompt $" {
- pass "attach call"
+ pass "$test"
}
-re "Attaching to.*process $testpid.*\[Switching to thread $testpid\..*\].*$gdb_prompt $" {
- pass "attach call"
- }
- -re "$gdb_prompt $" {
- fail "attach call"
- }
- timeout {
- fail "(timeout) attach call"
+ pass "$test"
}
}
# See if other registers are problems
- send_gdb "i r r3\n"
- gdb_expect {
- -re ".*warning: reading register.*$gdb_prompt $" {
- pass "CHFts23490: known bug"
+ set test "info other register"
+ gdb_test_multiple "i r r3" "$test" {
+ -re "warning: reading register.*$gdb_prompt $" {
+ fail "$test"
}
- -re ".*r3.*$gdb_prompt $" {
- pass "Bug fixed, Yayyy!"
+ -re "r3.*$gdb_prompt $" {
+ pass "$test"
}
- timeout { fail "timeout on info reg" }
}
# Get rid of the process
- gdb_test "p should_exit = 1" ".*"
- gdb_test "c" ".*Program exited normally.*"
+ gdb_test "p should_exit = 1"
+ gdb_test "c" "Program exited normally."
# Be paranoid
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [obish] Convert attach.exp to gdb_test_multiple
@ 2004-07-09 0:23 Michael Elizabeth Chastain
2004-07-12 14:30 ` Andrew Cagney
0 siblings, 1 reply; 5+ messages in thread
From: Michael Elizabeth Chastain @ 2004-07-09 0:23 UTC (permalink / raw)
To: cagney, gdb-patches
> I'll leave committing this to tomorrow (i.e., after the branch date).
> Still passes on amd64 GNU/Linux and PPC NetBSD.
Hey, we don't have any ppc netbsd results in gdb-testers@.
Can I get you to send an abridged gdb.sum file to gdb-testers?
grep -v '^PASS:' gdb.sum
add a couple lines at the top:
netbsd/ppc
kernel version number
compiler name and version number
mail to gdb-testers@
Michael C
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [obish] Convert attach.exp to gdb_test_multiple
2004-07-09 0:23 Michael Elizabeth Chastain
@ 2004-07-12 14:30 ` Andrew Cagney
0 siblings, 0 replies; 5+ messages in thread
From: Andrew Cagney @ 2004-07-12 14:30 UTC (permalink / raw)
To: Michael Elizabeth Chastain; +Cc: gdb-patches
>>I'll leave committing this to tomorrow (i.e., after the branch date).
>>> Still passes on amd64 GNU/Linux and PPC NetBSD.
>
>
> Hey, we don't have any ppc netbsd results in gdb-testers@.
Nor amd64 GNU/Linux, ppc64 GNU/Linux, ... :-)
> Can I get you to send an abridged gdb.sum file to gdb-testers?
>
> grep -v '^PASS:' gdb.sum
> add a couple lines at the top:
> netbsd/ppc
> kernel version number
> compiler name and version number
> mail to gdb-testers@
Should there be a gdb/gdb_XXX.sh script that does this, or the
generation of the file made part of make check?
Andrew
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [obish] Convert attach.exp to gdb_test_multiple
@ 2004-07-12 18:25 Michael Elizabeth Chastain
0 siblings, 0 replies; 5+ messages in thread
From: Michael Elizabeth Chastain @ 2004-07-12 18:25 UTC (permalink / raw)
To: cagney, mec.gnu; +Cc: gdb-patches
mec> add a couple lines at the top:
mec> netbsd/ppc
mec> kernel version number
mec> compiler name and version number
mec> mail to gdb-testers@
ac> Should there be a gdb/gdb_XXX.sh script that does this, or the
ac> generation of the file made part of make check?
This is one of my projects, when I get some more round tuit's.
My test bed generates a gdb-test-run.xml file for each test run.
Here is one of the files:
<gdb-test-run version='11' uuid='1a7cf0fa-611f-4563-976e-555e9223b05e' group='2004-06-19' target='native' host='i686-pc-linux-gnu' osversion='redhat-8.0' dejagnu='1.4.4' expect='5.41' tcl='8.4.6' gdb='HEAD' suite='HEAD' gcc='3.3.3' as='2.15' ld='2.15' glibc='2.2.93-5-rh' gformat='dwarf-2' glevel='2'/>
This DTD needs some more work. The fields 'gcc', 'as', and 'ld'
assume that I am using gnu tools. I need to generalize it to something
like:
<compiler name='gcc' version='3.3.3'/>
<compiler name='hpacc' version='A.03.45'/>
Also the version of 'gdb' does not include the cvs timestamp when
it was checked out.
My plan is to work on the XML format some more, and then have 'make
check' emit this chunk of XML at the beginning of gdb.sum and gdb.log.
Then we can collect gdb.sum files from divers sources and crunch them
all together. We could even revive Terf and have people submit their
gdb.sum files to it.
Michael C
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2004-07-12 18:25 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-07-08 21:09 [obish] Convert attach.exp to gdb_test_multiple Andrew Cagney
2004-07-12 14:26 ` Andrew Cagney
2004-07-09 0:23 Michael Elizabeth Chastain
2004-07-12 14:30 ` Andrew Cagney
2004-07-12 18:25 Michael Elizabeth Chastain
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox