Backed out changeset 8ae4f78d7e25 (bug 1125559) for checktest orange
authorWes Kocher <wkocher@mozilla.com>
Mon, 26 Jan 2015 15:18:50 -0800
changeset 225892 c2fd55873192bd5a34e63c0cfddc4e46dbeb03e4
parent 225891 1d696936757ee05f527a71db3f8de747e530c281
child 225893 b456ab25b529f0f1c9dfb1e37f70649ca3ee4b65
push id54679
push userkwierso@gmail.com
push dateMon, 26 Jan 2015 23:18:58 +0000
treeherdermozilla-inbound@c2fd55873192 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1125559
milestone38.0a1
backs out8ae4f78d7e259bdde22b41764a3c2a9a5d250d3c
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Backed out changeset 8ae4f78d7e25 (bug 1125559) for checktest orange
xpcom/tests/TestThreadPool.cpp
xpcom/tests/gtest/TestThreadPool.cpp
xpcom/tests/gtest/moz.build
xpcom/tests/moz.build
rename from xpcom/tests/gtest/TestThreadPool.cpp
rename to xpcom/tests/TestThreadPool.cpp
--- a/xpcom/tests/gtest/TestThreadPool.cpp
+++ b/xpcom/tests/TestThreadPool.cpp
@@ -7,54 +7,56 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include "nsXPCOM.h"
 #include "nsXPCOMCIDInternal.h"
 #include "nsIThreadPool.h"
 #include "nsComponentManagerUtils.h"
 #include "nsCOMPtr.h"
 #include "nsIRunnable.h"
-#include "mozilla/Atomics.h"
-#include "gtest/gtest.h"
 
-class Task MOZ_FINAL : public nsIRunnable
+class Task : public nsIRunnable
 {
 public:
   NS_DECL_THREADSAFE_ISUPPORTS
 
-  explicit Task(int i) : mIndex(i) {}
+  Task(int i) : mIndex(i) {}
 
   NS_IMETHOD Run()
   {
     printf("###(%d) running from thread: %p\n", mIndex, (void *) PR_GetCurrentThread());
     int r = (int) ((float) rand() * 200 / RAND_MAX);
     PR_Sleep(PR_MillisecondsToInterval(r));
     printf("###(%d) exiting from thread: %p\n", mIndex, (void *) PR_GetCurrentThread());
-    ++sCount;
     return NS_OK;
   }
 
-  static mozilla::Atomic<int> sCount;
-
 private:
-  ~Task() {}
-
   int mIndex;
 };
 NS_IMPL_ISUPPORTS(Task, nsIRunnable)
 
-mozilla::Atomic<int> Task::sCount;
-
-TEST(ThreadPool, Main)
+static nsresult
+RunTests()
 {
   nsCOMPtr<nsIThreadPool> pool = do_CreateInstance(NS_THREADPOOL_CONTRACTID);
-  EXPECT_TRUE(pool);
+  NS_ENSURE_STATE(pool);
 
   for (int i = 0; i < 100; ++i) {
     nsCOMPtr<nsIRunnable> task = new Task(i);
-    EXPECT_TRUE(task);
+    NS_ENSURE_TRUE(task, NS_ERROR_OUT_OF_MEMORY);
 
     pool->Dispatch(task, NS_DISPATCH_NORMAL);
   }
 
   pool->Shutdown();
-  EXPECT_EQ(Task::sCount, 100);
+  return NS_OK;
 }
+
+int
+main(int argc, char **argv)
+{
+  if (NS_FAILED(NS_InitXPCOM2(nullptr, nullptr, nullptr)))
+    return -1;
+  RunTests();
+  NS_ShutdownXPCOM(nullptr);
+  return 0;
+}
--- a/xpcom/tests/gtest/moz.build
+++ b/xpcom/tests/gtest/moz.build
@@ -9,15 +9,14 @@ UNIFIED_SOURCES += [
     'TestEncoding.cpp',
     'TestExpirationTracker.cpp',
     'TestPipes.cpp',
     'TestPriorityQueue.cpp',
     'TestSnappyStreams.cpp',
     'TestStorageStream.cpp',
     'TestStrings.cpp',
     'TestSynchronization.cpp',
-    'TestThreadPool.cpp',
     'TestTimeStamp.cpp',
 ]
 
 FINAL_LIBRARY = 'xul-gtest'
 
 FAIL_ON_WARNINGS = True
--- a/xpcom/tests/moz.build
+++ b/xpcom/tests/moz.build
@@ -75,16 +75,17 @@ GeckoCppUnitTests([
 
 if CONFIG['MOZ_MEMORY']:
     GeckoCppUnitTests([
         'TestJemalloc',
     ])
 
 # XXX Make these tests work in libxul builds.
 #CPP_UNIT_TESTS += [
+#    'TestThreadPool',
 #    'TestThreads',
 #    'TestXPIDLString',
 #    'TestUTF',
 #    'TestAtoms',
 #]
 
 # FIXME: bug 577500 TestStaticAtoms fails when run in dist/bin
 #CPP_UNIT_TESTS += [