Bug 550425: Bump up the timeout for expensive deadlock tests and print more info on failures. r=bsmedberg,sdwilsh
authorChris Jones <jones.chris.g@gmail.com>
Wed, 24 Mar 2010 19:12:32 -0500
changeset 39799 724a5ba759fae44fefc3c8e0e552abe363ab47ab
parent 39798 da7fc1899b53309d133efdd6b3119170fd391853
child 39800 7d81ca137806b2eb73baf63c7ae77ce6760d71aa
push id1
push userroot
push dateTue, 26 Apr 2011 22:38:44 +0000
treeherdermozilla-beta@bfdb6e623a36 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbsmedberg, sdwilsh
bugs550425
milestone1.9.3a4pre
Bug 550425: Bump up the timeout for expensive deadlock tests and print more info on failures. r=bsmedberg,sdwilsh
storage/test/test_deadlock_detector.cpp
xpcom/tests/TestDeadlockDetector.cpp
--- a/storage/test/test_deadlock_detector.cpp
+++ b/storage/test/test_deadlock_detector.cpp
@@ -213,16 +213,17 @@ public:
                 pollfds[nfds].out_flags = 0;
                 ++nfds;
             }
 
             PRInt32 rv = PR_Poll(pollfds, nfds, deadline - now);
             NS_ASSERTION(0 <= rv, PR_ErrorToName(PR_GetError()));
 
             if (0 == rv) {      // timeout
+                fputs("(timed out!)\n", stderr);
                 Finish(PR_FALSE); // abnormal
                 return;
             }
 
             for (PRInt32 i = 0; i < nfds; ++i) {
                 if (!pollfds[i].out_flags)
                     continue;
 
@@ -241,47 +242,51 @@ public:
 
                 if (0 < len) {
                     buf[len] = '\0';
                     if (isStdout)
                         mStdout += buf;
                     else
                         mStderr += buf;
                 }
+                else if (isStdout) {
+                    stdoutOpen = PR_FALSE;
+                }
                 else {
-                    if (isStdout) {
-                        stdoutOpen = PR_FALSE;
-                        PR_Close(mStdoutfd);
-                    }
-                    else {
-                        stderrOpen = PR_FALSE;
-                        PR_Close(mStderrfd);
-                    }
+                    stderrOpen = PR_FALSE;
                 }
             }
 
             now = PR_IntervalNow();
         }
 
+        if (stdoutOpen)
+            fputs("(stdout still open!)\n", stderr);
+        if (stderrOpen)
+            fputs("(stderr still open!)\n", stderr);
+        if (now > deadline)
+            fputs("(timed out!)\n", stderr);
+
         Finish(!stdoutOpen && !stderrOpen && now <= deadline);
     }
 
 private:
     void Finish(PRBool normalExit) {
         if (!normalExit) {
             PR_KillProcess(mProc);
-            PR_Close(mStdoutfd);
-            PR_Close(mStderrfd);
             mExitCode = -1;
             PRInt32 dummy;
             PR_WaitProcess(mProc, &dummy);
         }
         else {
             PR_WaitProcess(mProc, &mExitCode); // this had better not block ...
         }
+
+        PR_Close(mStdoutfd);
+        PR_Close(mStderrfd);
     }
 
     PRProcess* mProc;
     PRFileDesc* mStdinfd;         // writeable
     PRFileDesc* mStdoutfd;        // readable
     PRFileDesc* mStderrfd;        // readable
 };
 
@@ -554,17 +559,17 @@ ContentionNoDeadlock_Child()
     return 0;
 }
 
 nsresult
 ContentionNoDeadlock()
 {
     const char * func = __func__;
     Subprocess proc(func);
-    proc.RunToCompletion(10000);
+    proc.RunToCompletion(60000);
     if (0 != proc.mExitCode) {
         printf("(expected 0 == return code, got %d)\n", proc.mExitCode);
         puts("(output)\n----------------------------------\n");
         puts(proc.mStdout.get());
         puts("----------------------------------\n");
         puts("(error output)\n----------------------------------\n");
         puts(proc.mStderr.get());
         puts("----------------------------------\n");
--- a/xpcom/tests/TestDeadlockDetector.cpp
+++ b/xpcom/tests/TestDeadlockDetector.cpp
@@ -175,16 +175,17 @@ public:
                 pollfds[nfds].out_flags = 0;
                 ++nfds;
             }
 
             PRInt32 rv = PR_Poll(pollfds, nfds, deadline - now);
             NS_ASSERTION(0 <= rv, PR_ErrorToName(PR_GetError()));
 
             if (0 == rv) {      // timeout
+                fputs("(timed out!)\n", stderr);
                 Finish(PR_FALSE); // abnormal
                 return;
             }
 
             for (PRInt32 i = 0; i < nfds; ++i) {
                 if (!pollfds[i].out_flags)
                     continue;
 
@@ -214,16 +215,23 @@ public:
                 else {
                     stderrOpen = PR_FALSE;
                 }
             }
 
             now = PR_IntervalNow();
         }
 
+        if (stdoutOpen)
+            fputs("(stdout still open!)\n", stderr);
+        if (stderrOpen)
+            fputs("(stderr still open!)\n", stderr);
+        if (now > deadline)
+            fputs("(timed out!)\n", stderr);
+
         Finish(!stdoutOpen && !stderrOpen && now <= deadline);
     }
 
 private:
     void Finish(PRBool normalExit) {
         if (!normalExit) {
             PR_KillProcess(mProc);
             mExitCode = -1;
@@ -513,17 +521,17 @@ ContentionNoDeadlock_Child()
     return 0;
 }
 
 nsresult
 ContentionNoDeadlock()
 {
     const char * func = __func__;
     Subprocess proc(func);
-    proc.RunToCompletion(10000);
+    proc.RunToCompletion(60000);
     if (0 != proc.mExitCode) {
         printf("(expected 0 == return code, got %d)\n", proc.mExitCode);
         puts("(output)\n----------------------------------\n");
         puts(proc.mStdout.get());
         puts("----------------------------------\n");
         puts("(error output)\n----------------------------------\n");
         puts(proc.mStderr.get());
         puts("----------------------------------\n");