2010-06-02 Michael Snyder <msnyder@msnyder-server.eng.vmware.com>
[binutils-gdb.git] / gdb / testsuite / gdb.threads / gcore-thread.exp
index 40c9adaad80825606db28ea2b2fc63a9f1ac0c0a..83f8641105ec0444114c9ade4f3347c740b707bb 100644 (file)
@@ -1,21 +1,18 @@
-# Copyright 2002, 2003 Free Software Foundation, Inc.
+# Copyright 2002, 2003, 2004, 2007, 2008, 2009, 2010
+# Free Software Foundation, Inc.
 
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
+# the Free Software Foundation; either version 3 of the License, or
 # (at your option) any later version.
-# 
+#
 # This program is distributed in the hope that it will be useful,
 # but WITHOUT ANY WARRANTY; without even the implied warranty of
 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 # GNU General Public License for more details.
-# 
+#
 # You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  
-
-# Please email any bugs, comments, and/or additions to this file to:
-# bug-gdb@prep.ai.mit.edu
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 # This file was written by Michael Snyder (msnyder@redhat.com)
 # This is a test for the gdb command "generate-core-file".
@@ -24,13 +21,11 @@ if $tracelevel then {
        strace $tracelevel
 }
 
-set prms_id 0
-set bug_id 0
 
 # Single-threaded test case
 set testfile "pthreads"
 set srcfile  ${testfile}.c
-set binfile  ${objdir}/${subdir}/${testfile}
+set binfile  ${objdir}/${subdir}/gcore-${testfile}
 
 if [istarget "*-*-linux"] then {
     set target_cflags "-D_MIT_POSIX_THREADS"
@@ -58,10 +53,10 @@ set horiz "\[^\n\r\]*"
 # regexp for newline
 set nl "\[\r\n\]+"
 
+set prev_timeout $timeout
 set timeout 30
 
-send_gdb "help gcore\n"
-gdb_expect {
+gdb_test_multiple "help gcore" "help gcore" {
     -re "Undefined command: .gcore.*$gdb_prompt $" {
        # gcore command not supported -- nothing to test here.
        unsupported "gdb does not support gcore on this target"
@@ -70,20 +65,14 @@ gdb_expect {
     -re "Save a core file .*$gdb_prompt $" {
        pass "help gcore"
     }
-    -re ".*$gdb_prompt $" {
-       fail "help gcore"
-    }
-    timeout {
-       fail "help gcore (timeout)"
-    }
 }
 
-if { ! [ runto main ] } then {
-    gdb_suppress_entire_file "Run to main failed, so all tests in this file will automatically fail."
+if { ! [ runto_main ] } then {
+    untested gcore-thread.exp
+    return -1
 }
 
-send_gdb "info threads\n"
-gdb_expect {
+gdb_test_multiple "info threads" "threads are supported" {
     -re ".* main .*$gdb_prompt $" {
        # OK, threads are supported.
     }
@@ -131,31 +120,25 @@ gdb_start
 gdb_reinitialize_dir $srcdir/$subdir
 gdb_load ${binfile}
 
-send_gdb "core ${objdir}/${subdir}/gcore.test\n"
-gdb_expect {
-    -re ".* is not a core dump:.*$gdb_prompt $" {
-       fail "re-load generated corefile (bad file format)"
-       # No use proceeding from here.
-       return; 
-    }
-    -re ".*: No such file or directory.*$gdb_prompt $" {
-       fail "re-load generated corefile (file not found)"
-       # No use proceeding from here.
-       return; 
+gdb_test_multiple "core ${objdir}/${subdir}/gcore.test" \
+    "re-load generated corefile" {
+       -re ".* is not a core dump:.*$gdb_prompt $" {
+           fail "re-load generated corefile (bad file format)"
+           # No use proceeding from here.
+           return;
+       }
+       -re ".*: No such file or directory.*$gdb_prompt $" {
+           fail "re-load generated corefile (file not found)"
+           # No use proceeding from here.
+           return;
+       }
+       -re ".*Couldn't find .* registers in core file.*$gdb_prompt $" {
+           fail "re-load generated corefile (incomplete note section)"
+       }
+       -re "Core was generated by .*$gdb_prompt $" {
+           pass "re-load generated corefile"
+       }
     }
-    -re ".*Couldn't find .* registers in core file.*$gdb_prompt $" {
-       fail "re-load generated corefile (incomplete note section)"
-    }
-    -re "Core was generated by .*$gdb_prompt $" {
-       pass "re-load generated corefile"
-    }
-    -re ".*$gdb_prompt $" {
-       fail "re-load generated corefile"
-    }
-    timeout {
-       fail "re-load generated corefile (timeout)"
-    }
-}
 
 # FIXME: now what can we test about the thread state?
 # We do not know for certain that there should be at least 
@@ -176,3 +159,4 @@ gdb_test "info threads" ".* thread2 .*" \
 gdb_test "info threads" ".*${nl}\\* ${horiz} thread2 .*" \
        "thread2 is current thread in corefile"
 
+set timeout $prev_timeout