2012-02-20 Pedro Alves <palves@redhat.com>
authorPedro Alves <palves@redhat.com>
Mon, 20 Feb 2012 13:18:36 +0000 (13:18 +0000)
committerPedro Alves <palves@redhat.com>
Mon, 20 Feb 2012 13:18:36 +0000 (13:18 +0000)
General cleanup, make output test messages unique, and build
different executable files for the non-threaded and threaded
cases.

* gdb.threads/attach-into-signal.exp (binfile, escapedbinfile):
Delete.
(executable_nothr, executable_thr): New globals.
(top level): Adjust to delete both executables.
(corefunc): New parameter $executable.  Set $pf_prefix instead of
hand writing a prefix in tests.  Issue a clean_restart and enable
lin-lwp debug output here.
(top level): Adjust.  Use build_executable.  Don't start gdb here,
and don't enable lin-lwp debug output here.
* gdb.threads/Makefile.in (EXECUTABLES): Adjust.

gdb/testsuite/ChangeLog
gdb/testsuite/gdb.threads/Makefile.in
gdb/testsuite/gdb.threads/attach-into-signal.exp

index 5b31bd8cb4d82e594c510b8af654ae06580ebba3..fa4b063837690b1cfe6e7331bf6e016b3928e101 100644 (file)
@@ -1,3 +1,20 @@
+2012-02-20  Pedro Alves  <palves@redhat.com>
+
+       General cleanup, make output test messages unique, and build
+       different executable files for the non-threaded and threaded
+       cases.
+
+       * gdb.threads/attach-into-signal.exp (binfile, escapedbinfile):
+       Delete.
+       (executable_nothr, executable_thr): New globals.
+       (top level): Adjust to delete both executables.
+       (corefunc): New parameter $executable.  Set $pf_prefix instead of
+       hand writing a prefix in tests.  Issue a clean_restart and enable
+       lin-lwp debug output here.
+       (top level): Adjust.  Use build_executable.  Don't start gdb here,
+       and don't enable lin-lwp debug output here.
+       * gdb.threads/Makefile.in (EXECUTABLES): Adjust.
+
 2012-02-20  Jan Kratochvil  <jan.kratochvil@redhat.com>
 
        Fix racy FAILs.
index 954d547cf647fc0916be0f46c5986192335fe769..79e4c4c879121684e9be72a7980746a3b00afc2b 100644 (file)
@@ -1,7 +1,8 @@
 VPATH = @srcdir@
 srcdir = @srcdir@
 
-EXECUTABLES = attach-into-signal attach-stopped attachstop-mt \
+EXECUTABLES = attach-into-signal-nothr attach-into-signal-thr \
+       attach-stopped attachstop-mt \
        bp_in_thread current-lwp-dead execl execl1 fork-child-threads \
        fork-thread-pending gcore-pthreads hand-call-in-threads \
        ia64-sigill interrupted-hand-call killed linux-dp \
index db8822208537acee453b128a1302df7e576eb414..651ce1c6dbc4b8ff889885f7e9f5490608bb46d2 100644 (file)
@@ -24,23 +24,34 @@ if { ![isnative] || [is_remote host] || [target_info exists use_gdb_stub]
 
 set testfile "attach-into-signal"
 set srcfile  ${testfile}.c
-set binfile  ${objdir}/${subdir}/${testfile}
-set escapedbinfile  [string_to_regexp ${objdir}/${subdir}/${testfile}]
+set executable_nothr ${testfile}-nothr
+set executable_thr ${testfile}-thr
 
-remote_exec build "rm -f ${binfile}"
+remote_exec build "rm -f ${objdir}/${subdir}/${executable_nothr}"
+remote_exec build "rm -f ${objdir}/${subdir}/${executable_thr}"
 # For debugging this test
 #
 #log_user 1
 
-proc corefunc { threadtype } {
+proc corefunc { threadtype executable } {
     global srcfile
-    global binfile
-    global escapedbinfile
     global srcdir
+    global objdir
     global subdir
     global gdb_prompt
+    global pf_prefix
+
+    set save_pf_prefix $pf_prefix
+    lappend pf_prefix "$threadtype:"
+
+    clean_restart ${executable}
+    gdb_test_no_output "set debug lin-lwp 1" ""
+
+    set binfile ${objdir}/${subdir}/${executable}
+    set escapedbinfile [string_to_regexp ${objdir}/${subdir}/${executable}]
 
     if [get_compiler_info ${binfile}] {
+       set pf_prefix $save_pf_prefix
        return -1
     }
 
@@ -79,12 +90,12 @@ proc corefunc { threadtype } {
        }
        if { $stoppedtry >= 10 } {
            verbose -log $line2
-           set test "$threadtype: process is still running on the attempt # $attempt of $attempts"
+           set test "process is still running on the attempt # $attempt of $attempts"
            break
        }
 
        # Main test:
-       set test "$threadtype: attach (pass $passes), pending signal catch"
+       set test "attach (pass $passes), pending signal catch"
        if {[gdb_test_multiple "attach $testpid" $test {
            -re "Attaching to program.*`?$escapedbinfile'?, process $testpid.*Received Alarm clock.*$gdb_prompt $" {
                # nonthreaded:
@@ -136,35 +147,24 @@ proc corefunc { threadtype } {
     remote_exec build "kill -s CONT ${testpid}"
        
     remote_exec build "kill -9 ${testpid}"
-}
 
-# Start with clean gdb
-gdb_exit
+    set pf_prefix $save_pf_prefix
+}
 
 # build the test case first without threads
 #
-if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
-    untested "attach-into-signal.exp (unthreaded)"
+if {[build_executable $testfile $executable_nothr $srcfile] == -1} {
+    untested "attach-into-signal.exp (nonthreaded)"
     return -1
 }
 
-gdb_start
-gdb_reinitialize_dir $srcdir/$subdir
-gdb_load ${binfile}
-gdb_test_no_output "set debug lin-lwp 1" ""
-
-corefunc nonthreaded
+corefunc nonthreaded ${executable_nothr}
 
 # build the test case also with threads
 #
-if  { [gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug additional_flags=-DUSE_THREADS}] != "" } {
+if  { [gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${objdir}/${subdir}/${executable_thr}" executable {debug additional_flags=-DUSE_THREADS}] != "" } {
     untested "attach-into-signal.exp (threaded)"
     return -1
 }
 
-gdb_start
-gdb_reinitialize_dir $srcdir/$subdir
-gdb_load ${binfile}
-gdb_test_no_output "set debug lin-lwp 1" ""
-
-corefunc threaded
+corefunc threaded ${executable_thr}