1 http://sourceware.org/ml/gdb-patches/2011-02/msg00679.html
2 Subject: Re: [patch 1/3] Code cleanup: gdb.threads/gcore-thread.exp
4 On Thu, 24 Feb 2011 08:20:09 +0100, Joel Brobecker wrote:
5 > Just a thought: Do we really need to worry about restoring
6 > the timeout at the end of the testcase, given that this is
7 > automatically done at the start of each testcase (see gdb.exp:
11 Re: [RFA/testsuite] Reset the timeout duration at the start of each testcase.
12 http://sourceware.org/ml/gdb-patches/2010-02/msg00202.html
13 commit 501c57da40fd27c8036a5fc995f750b0559272ad
23 2011-02-24 Jan Kratochvil <jan.kratochvil@redhat.com>
25 * gdb.threads/gcore-thread.exp ($testfile): Match it the .exp
27 ($srcfile): Preserve the original value.
28 ($testfile): Match it the .exp filename.
29 ($corefile): New variable. Substitute it around.
31 ($prev_timeout): Remove.
32 (load_core): Move core loading into this proc.
33 Fix restore of $timeout if load_core fails.
35 --- a/gdb/testsuite/gdb.threads/gcore-thread.exp
36 +++ b/gdb/testsuite/gdb.threads/gcore-thread.exp
37 @@ -21,11 +21,11 @@ if $tracelevel then {
42 # Single-threaded test case
43 -set testfile "pthreads"
44 -set srcfile ${testfile}.c
45 -set binfile ${objdir}/${subdir}/gcore-${testfile}
46 +set testfile "gcore-thread"
47 +set srcfile pthreads.c
48 +set binfile ${objdir}/${subdir}/${testfile}
49 +set corefile ${objdir}/${subdir}/${testfile}.test
51 if [istarget "*-*-linux"] then {
52 set target_cflags "-D_MIT_POSIX_THREADS"
53 @@ -41,10 +41,7 @@ if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executab
55 # Start with a fresh gdb.
59 -gdb_reinitialize_dir $srcdir/$subdir
61 +clean_restart ${testfile}
63 # regexp for "horizontal" text (i.e. doesn't include newline or
65 @@ -53,7 +50,6 @@ set horiz "\[^\n\r\]*"
69 -set prev_timeout $timeout
72 gdb_test_multiple "help gcore" "help gcore" {
73 @@ -92,10 +88,9 @@ delete_breakpoints
74 gdb_breakpoint "thread2"
75 gdb_test "continue" "Continuing.*Breakpoint.* thread2 .*" "thread 2 is running"
77 -set escapedfilename [string_to_regexp ${objdir}/${subdir}/gcore.test]
78 +set escapedfilename [string_to_regexp $corefile]
80 -gdb_test_multiple "gcore ${objdir}/${subdir}/gcore.test" \
82 +gdb_test_multiple "gcore $corefile" "save a corefile" \
84 -re "Saved corefile ${escapedfilename}\[\r\n\]+$gdb_prompt $" {
85 pass "save a corefile"
86 @@ -114,31 +109,38 @@ if {!$core_supported} {
91 # Now restart gdb and load the corefile.
94 -gdb_reinitialize_dir $srcdir/$subdir
97 -gdb_test_multiple "core ${objdir}/${subdir}/gcore.test" \
98 - "re-load generated corefile" {
99 - -re ".* is not a core dump:.*$gdb_prompt $" {
100 - fail "re-load generated corefile (bad file format)"
101 - # No use proceeding from here.
104 - -re ".*: No such file or directory.*$gdb_prompt $" {
105 - fail "re-load generated corefile (file not found)"
106 - # No use proceeding from here.
109 - -re ".*Couldn't find .* registers in core file.*$gdb_prompt $" {
110 - fail "re-load generated corefile (incomplete note section)"
112 - -re "Core was generated by .*$gdb_prompt $" {
113 - pass "re-load generated corefile"
114 +clean_restart ${testfile}
116 +proc load_core { corefile } {
119 + gdb_test_multiple "core $corefile" \
120 + "re-load generated corefile" {
121 + -re " is not a core dump:.*\r\n$gdb_prompt $" {
122 + fail "re-load generated corefile (bad file format)"
123 + # No use proceeding from here.
126 + -re ": No such file or directory.*\r\n$gdb_prompt $" {
127 + fail "re-load generated corefile (file not found)"
128 + # No use proceeding from here.
131 + -re "Couldn't find .* registers in core file.*\r\n$gdb_prompt $" {
132 + fail "re-load generated corefile (incomplete note section)"
134 + -re "Core was generated by .*\r\n$gdb_prompt $" {
135 + pass "re-load generated corefile"
142 +if ![load_core $corefile] {
146 # FIXME: now what can we test about the thread state?
147 # We do not know for certain that there should be at least
148 @@ -158,5 +160,3 @@ gdb_test "info threads" ".* thread2 .*" \
150 gdb_test "info threads" ".*${nl}\\* ${horiz} thread2 .*" \
151 "thread2 is current thread in corefile"
153 -set timeout $prev_timeout