Submitted By: Bruce Dubbs Date: 2010-06-19 Initial Package Version: 1.4.4 Origin: Dejagnu CVS http://cvs.fedoraproject.org/viewvc/F-13/dejagnu/ Description: Consolidation of four fixes: runtest, smp, testsuite, speedup diff -Naur dejagnu-1.4.4/lib/remote.exp dejagnu-1.4.4.new/lib/remote.exp --- dejagnu-1.4.4/lib/remote.exp 2003-10-11 01:42:46.000000000 -0500 +++ dejagnu-1.4.4.new/lib/remote.exp 2010-06-19 17:07:06.000000000 -0500 @@ -91,9 +91,13 @@ # 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 @@ 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. diff -Naur dejagnu-1.4.4/lib/utils.exp dejagnu-1.4.4.new/lib/utils.exp --- dejagnu-1.4.4/lib/utils.exp 2003-10-11 01:42:46.000000000 -0500 +++ dejagnu-1.4.4.new/lib/utils.exp 2010-06-19 17:07:19.000000000 -0500 @@ -106,7 +106,7 @@ foreach i $dirs { verbose "Looking in $i" 3 foreach match [glob -nocomplain $i/$pattern] { - if ![file isdirectory $match] { + if {![file isdirectory $match]} { lappend files $match verbose "Adding $match to file list" 3 } @@ -216,7 +216,7 @@ set tmp {} foreach i $list { verbose "Checking pattern \"$pattern\" against $i" 3 - if ![string match $pattern $i] { + if {![string match $pattern $i]} { lappend tmp $i } else { verbose "Removing element $i from list" 3 diff -Naur dejagnu-1.4.4/runtest.exp dejagnu-1.4.4.new/runtest.exp --- dejagnu-1.4.4/runtest.exp 2003-10-15 08:22:52.000000000 -0500 +++ dejagnu-1.4.4.new/runtest.exp 2010-06-19 17:06:55.000000000 -0500 @@ -1443,8 +1443,7 @@ global tool clone_output "Running $test_file_name ..." - set prms_id 0 - set bug_id 0 + reset_vars set test_result "" if [file exists $test_file_name] { diff -Naur dejagnu-1.4.4/testsuite/libdejagnu/unit.cc dejagnu-1.4.4.new/testsuite/libdejagnu/unit.cc --- dejagnu-1.4.4/testsuite/libdejagnu/unit.cc 2003-08-16 20:33:06.000000000 -0500 +++ dejagnu-1.4.4.new/testsuite/libdejagnu/unit.cc 2010-06-19 17:07:14.000000000 -0500 @@ -7,6 +7,7 @@ #include #include #include +#include using namespace std; @@ -49,12 +50,8 @@ // Replace the output buffer for cout, so we can examine it to // see what was displayed. Otherwise, there is no way we can test // the logging functions completely. - char bbuuff[5120]; -#ifdef __STDC_HOSTED__ - cout.rdbuf()->pubsetbuf(bbuuff, 5120); -#else - cout.rdbuf()->setbuf(bbuuff, 5120); -#endif + stringstream stream; + streambuf * buf = cout.rdbuf(stream.rdbuf()); testClass1.tname = "testType1"; testClass1.tnum = 1; @@ -65,53 +62,59 @@ // Test the pass message test.pass ("bogus pass message for testing"); + cout.flush(); outstate = os2; - if (strncmp(bbuuff, "\tPAS: bogus pass message", 22) == 0) { + if (strncmp(stream.str().c_str(), "\tPAS: bogus pass message", 22) == 0) { runtest.pass ("Pass message"); } else { runtest.fail ("Pass message"); } + stream.str(""); // Test the fail message outstate = os1; test.fail ("bogus fail message for testing"); cout.flush(); outstate = os2; - if (strncmp(bbuuff, "\tFAI: bogus fail message", 22) == 0) { + if (strncmp(stream.str().c_str(), "\tFAI: bogus fail message", 22) == 0) { runtest.pass ("Fail message"); } else { runtest.fail ("Fail message"); } + stream.str(""); // Test the untested message outstate = os1; test.untested ("bogus untested message for testing"); cout.flush(); outstate = os2; - if (strncmp(bbuuff, "\tUNT: bogus untested message", 21) == 0) { + if (strncmp(stream.str().c_str(), "\tUNT: bogus untested message", 21) == 0) { runtest.pass ("Untested message"); } else { runtest.fail ("Untested message"); } + stream.str(""); // Test the unresolved message outstate = os1; test.unresolved ("bogus unresolved message for testing"); cout.flush(); outstate = os2; - if (strncmp(bbuuff, "\tUNR: bogus unresolved message", 21) == 0) { + if (strncmp(stream.str().c_str(), "\tUNR: bogus unresolved message", 21) == 0) { runtest.pass ("Unresolved message"); } else { runtest.fail ("Unresolved message"); } + stream.str(""); // Make sure we got everything in the totals regcomp (®ex_pat, "\r\n\t#passed.*#failed.*#untested.*#unresolved", REG_NOSUB|REG_NEWLINE); - if (regexec (®ex_pat, bbuuff, 0, (regmatch_t *)0, 0)) { + if (regexec (®ex_pat, stream.str().c_str(), 0, (regmatch_t *)0, 0)) { runtest.pass ("Totals message"); } else { runtest.fail ("Totals message"); } -} - + stream.str(""); + cout.rdbuf(buf); +}