Bug 619350 - Better identify the 2 'Deadlock detector correctness' tests; (Av1) Remove unwanted ";" at end of macros, Make test names and (failed) result logs more explicit, Add a log when skipping TestDeadlockDetectorScalability tests.
authorSerge Gautherie <sgautherie.bz@free.fr>
Thu, 03 Feb 2011 10:57:00 +0100
changeset 61839 094a7967e1713423cf2d6c907ce4e54cf0819fd1
parent 61838 274e546e9da95d02da1e1706d2cf2ecfa5532020
child 61840 f911fba0ea0bc71b96d788e42b4d2c96e05958ba
push idunknown
push userunknown
push dateunknown
bugs619350
milestone2.0b12pre
Bug 619350 - Better identify the 2 'Deadlock detector correctness' tests; (Av1) Remove unwanted ";" at end of macros, Make test names and (failed) result logs more explicit, Add a log when skipping TestDeadlockDetectorScalability tests. r=jones.chris.g a=(test only).
storage/test/test_deadlock_detector.cpp
xpcom/tests/TestDeadlockDetector.cpp
xpcom/tests/TestDeadlockDetectorScalability.cpp
xpcom/tests/TestSynchronization.cpp
--- a/storage/test/test_deadlock_detector.cpp
+++ b/storage/test/test_deadlock_detector.cpp
@@ -101,24 +101,23 @@ spawn(void (*run)(void*), void* arg)
                            PR_JOINABLE_THREAD,
                            0);
 }
 
 #define PASS()                                  \
     do {                                        \
         passed(__FUNCTION__);                   \
         return NS_OK;                           \
-    } while (0);
-
+    } while (0)
 
 #define FAIL(why)                               \
     do {                                        \
-        fail(why);                              \
+        fail("%s | %s - %s", __FILE__, __FUNCTION__, why); \
         return NS_ERROR_FAILURE;                \
-    } while (0);
+    } while (0)
 
 //-----------------------------------------------------------------------------
 
 static const char* sPathToThisBinary;
 static const char* sAssertBehaviorEnv = "XPCOM_DEBUG_BREAK=abort";
 
 class Subprocess
 {
@@ -606,17 +605,17 @@ main(int argc, char** argv)
         if (!strcmp("TwoThreads", test))
             return TwoThreads_Child();
         if (!strcmp("ContentionNoDeadlock", test))
             return ContentionNoDeadlock_Child();
 
         FAIL("unknown child test");
     }
 
-    ScopedXPCOM xpcom("Deadlock detector correctness");
+    ScopedXPCOM xpcom("Storage deadlock detector correctness (" __FILE__ ")");
     if (xpcom.failed())
         return 1;
 
     // in the first invocation of this process.  we will be the "driver".
     int rv = 0;
 
     sPathToThisBinary = argv[0];
 
--- a/xpcom/tests/TestDeadlockDetector.cpp
+++ b/xpcom/tests/TestDeadlockDetector.cpp
@@ -63,24 +63,23 @@ spawn(void (*run)(void*), void* arg)
                            PR_JOINABLE_THREAD,
                            0);
 }
 
 #define PASS()                                  \
     do {                                        \
         passed(__FUNCTION__);                   \
         return NS_OK;                           \
-    } while (0);
-
+    } while (0)
 
 #define FAIL(why)                               \
     do {                                        \
-        fail(why);                              \
+        fail("%s | %s - %s", __FILE__, __FUNCTION__, why); \
         return NS_ERROR_FAILURE;                \
-    } while (0);
+    } while (0)
 
 //-----------------------------------------------------------------------------
 
 static const char* sPathToThisBinary;
 static const char* sAssertBehaviorEnv = "XPCOM_DEBUG_BREAK=abort";
 
 class Subprocess
 {
@@ -568,17 +567,17 @@ main(int argc, char** argv)
         if (!strcmp("TwoThreads", test))
             return TwoThreads_Child();
         if (!strcmp("ContentionNoDeadlock", test))
             return ContentionNoDeadlock_Child();
 
         FAIL("unknown child test");
     }
 
-    ScopedXPCOM xpcom("Deadlock detector correctness");
+    ScopedXPCOM xpcom("XPCOM deadlock detector correctness (" __FILE__ ")");
     if (xpcom.failed())
         return 1;
 
     // in the first invocation of this process.  we will be the "driver".
     int rv = 0;
 
     sPathToThisBinary = argv[0];
 
--- a/xpcom/tests/TestDeadlockDetectorScalability.cpp
+++ b/xpcom/tests/TestDeadlockDetectorScalability.cpp
@@ -40,24 +40,23 @@
 #include "TestHarness.h"
 
 //#define OLD_API
 
 #define PASS()                                  \
     do {                                        \
         passed(__FUNCTION__);                   \
         return NS_OK;                           \
-    } while (0);
-
+    } while (0)
 
 #define FAIL(why)                               \
     do {                                        \
-        fail(why);                              \
+        fail("%s | %s - %s", __FILE__, __FUNCTION__, why); \
         return NS_ERROR_FAILURE;                \
-    } while (0);
+    } while (0)
 
 #ifdef OLD_API
 #  include "nsAutoLock.h"
    typedef PRLock* moz_lock_t;
 #  define NEWLOCK(n) nsAutoLock::NewLock(n)
 #  define DELETELOCK(v) nsAutoLock::DestroyLock(v)
 #  define AUTOLOCK(v, l) nsAutoLock v(l)
 #else
@@ -186,33 +185,39 @@ MaxDepsNsq(const int N, const int K)
 
 #endif
 
 //-----------------------------------------------------------------------------
 
 int
 main(int argc, char** argv)
 {
-    ScopedXPCOM xpcom("Deadlock detector scalability");
+    ScopedXPCOM xpcom("Deadlock detector scalability (" __FILE__ ")");
     if (xpcom.failed())
         return 1;
 
     int rv = 0;
 
     // Uncomment these tests to run them.  Not expected to be common.
 
-#ifdef DD_TEST1
+#ifndef DD_TEST1
+    puts("Skipping not-requested LengthNDepChain() test");
+#else
     if (NS_FAILED(LengthNDepChain(1 << 14))) // 16K
         rv = 1;
 #endif
 
-#ifdef DD_TEST2
+#ifndef DD_TEST2
+    puts("Skipping not-requested OneLockNDeps() test");
+#else
     if (NS_FAILED(OneLockNDeps(1 << 14, 100))) // 16k
         rv = 1;
 #endif
 
-#ifdef DD_TEST3
+#ifndef DD_TEST3
+    puts("Skipping not-requested MaxDepsNsq() test");
+#else
     if (NS_FAILED(MaxDepsNsq(1 << 10, 10))) // 1k
         rv = 1;
 #endif
 
     return rv;
 }
--- a/xpcom/tests/TestSynchronization.cpp
+++ b/xpcom/tests/TestSynchronization.cpp
@@ -58,24 +58,23 @@ spawn(void (*run)(void*), void* arg)
                            0);
 }
 
 
 #define PASS()                                  \
     do {                                        \
         passed(__FUNCTION__);                   \
         return NS_OK;                           \
-    } while (0);
-
+    } while (0)
 
 #define FAIL(why)                               \
     do {                                        \
-        fail(why);                              \
+        fail("%s | %s - %s", __FILE__, __FUNCTION__, why); \
         return NS_ERROR_FAILURE;                \
-    } while (0);
+    } while (0)
 
 //-----------------------------------------------------------------------------
 // Sanity check: tests that can be done on a single thread
 //
 static nsresult
 Sanity()
 {
     Mutex lock("sanity::lock");
@@ -387,17 +386,17 @@ AutoMonitor()
     PASS();
 }
 
 //-----------------------------------------------------------------------------
 
 int
 main(int argc, char** argv)
 {
-    ScopedXPCOM xpcom("Synchronization");
+    ScopedXPCOM xpcom("Synchronization (" __FILE__ ")");
     if (xpcom.failed())
         return 1;
 
     int rv = 0;
 
     if (NS_FAILED(Sanity()))
         rv = 1;
     if (NS_FAILED(MutexContention()))