bug-dejagnu
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug-dejagnu] PACTH: Fix dejagnu for SMP


From: H. J. Lu
Subject: [Bug-dejagnu] PACTH: Fix dejagnu for SMP
Date: Fri, 5 Aug 2005 22:35:57 -0700
User-agent: Mutt/1.4.1i

I have seen random "make check" failures in gcc on Linux/x86-64 SMP
machines. The log file doesn't say much except for compiler exit
status 1. When I ran the failed command by hand, it was OK.

I think the problem is in lib/remote.exp:

    expect {
        -i $spawn_id -timeout $timeout -re ".+" {
            append output $expect_out(buffer)
            if { [string length $output] < 512000 } {
                exp_continue -continue_timer
            }
        }
        timeout {
            warning "program timed out."
        }
        eof {
            set got_eof 1
        }
    }

...
   set r2 [catch "wait -i $spawn_id" wres]
    if { $id > 0 } {
        set r2 [catch "close $id" res]
    } else {
        verbose "waitres is $wres" 2
        if { $r2 == 0 } {
            set r2 [lindex $wres 3]
            if { [llength $wres] > 4 } {
                if { [lindex $wres 4] == "CHILDKILLED" } {
                    set r2 1
                }

But the expect command will close the connection when it sees EOF. On
SMP machine, close the connection may send SIGHUP to the child and
cause it to exit before it can exit normally. In this case,

   set r2 [catch "wait -i $spawn_id" wres]

will return "CHILDKILLED SIGHUP hangup". This patch will make sure
that compiler will ignore SIGHUP sent by expect when it sees EOF.


H.J.
--- dejagnu-1.4.4/lib/remote.exp.smp    2003-10-10 23:42:46.000000000 -0700
+++ dejagnu-1.4.4/lib/remote.exp        2005-08-05 12:32:10.107161990 -0700
@@ -91,9 +91,13 @@ proc local_exec { commandline inp outp t
     # programs that bear children. We can't use tcl's exec because it has
     # no way to timeout programs that hang. *sigh*
     #
+    # The expect command will close the connection when it sees EOF. On
+    # SMP machine, close the connection may send SIGHUP to the child
+    # and cause it to exit before it can exit normally.  We should make
+    # the child to ignore SIGHUP.
     if { "$inp" == "" && "$outp" == "" } {
        set id -1
-       set result [catch "eval spawn \{${commandline}\}" pid]
+       set result [catch "eval spawn -ignore SIGHUP \{${commandline}\}" pid]
        if { $result == 0 } {
            set result2 0
        } else {
@@ -134,7 +138,7 @@ proc local_exec { commandline inp outp t
            return [list -1 "open of $commandline $inp $outp failed: 
$errorInfo"]
        }
        set pid [pid $id]
-       set result [catch "spawn -leaveopen $id" result2]
+       set result [catch "spawn -ignore SIGHUP -leaveopen $id" result2]
     }
     # Prepend "-" to each pid, to generate the "process group IDs" needed by
     # kill.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]