Backed out changeset c6287220baaf (bug 1111224) for Windows build bustage on a CLOSED TREE
authorWes Kocher <wkocher@mozilla.com>
Mon, 15 Dec 2014 14:55:09 -0800
changeset 219772 b836016d82b50d46630cc22013a5d925b1615cac
parent 219771 4f239165dbb26ab9b925b1e63d1e1207fd4cd267
child 219773 a321e217332db2e170da519e8f5f566b6cb05048
child 219886 a3030140d5df8385b6c0dee0faa54c13a3dd1368
push id52920
push userkwierso@gmail.com
push dateMon, 15 Dec 2014 22:55:23 +0000
treeherdermozilla-inbound@b836016d82b5 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1111224
milestone37.0a1
backs outc6287220baafd8ab76f5fd934366cb6ac400546a
first release with
nightly linux32
b836016d82b5 / 37.0a1 / 20141216030203 / files
nightly linux64
b836016d82b5 / 37.0a1 / 20141216030203 / files
nightly mac
b836016d82b5 / 37.0a1 / 20141216030203 / files
nightly win32
b836016d82b5 / 37.0a1 / 20141216030203 / files
nightly win64
b836016d82b5 / 37.0a1 / 20141216030203 / files
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
releases
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Backed out changeset c6287220baaf (bug 1111224) for Windows build bustage on a CLOSED TREE
xpcom/glue/tests/gtest/TestExpirationTracker.cpp
xpcom/glue/tests/gtest/moz.build
xpcom/tests/TestExpirationTracker.cpp
xpcom/tests/moz.build
--- a/xpcom/glue/tests/gtest/moz.build
+++ b/xpcom/glue/tests/gtest/moz.build
@@ -3,17 +3,16 @@
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 UNIFIED_SOURCES += [
     'TestArray.cpp',
     'TestCRT.cpp',
     'TestEncoding.cpp',
-    'TestExpirationTracker.cpp',
     'TestFileUtils.cpp',
     'TestGCPostBarriers.cpp',
     'TestStrings.cpp',
 ]
 
 LOCAL_INCLUDES = [
     '../..',
 ]
rename from xpcom/glue/tests/gtest/TestExpirationTracker.cpp
rename to xpcom/tests/TestExpirationTracker.cpp
--- a/xpcom/glue/tests/gtest/TestExpirationTracker.cpp
+++ b/xpcom/tests/TestExpirationTracker.cpp
@@ -13,17 +13,16 @@
 #include "nsString.h"
 #include "nsDirectoryServiceDefs.h"
 #include "nsDirectoryServiceUtils.h"
 #include "nsComponentManagerUtils.h"
 #include "nsXPCOM.h"
 #include "nsIFile.h"
 #include "prinrval.h"
 #include "nsThreadUtils.h"
-#include "gtest/gtest.h"
 
 namespace TestExpirationTracker {
 
 struct Object {
   Object() : mExpired(false) { Touch(); }
   void Touch() { mLastUsed = PR_IntervalNow(); mExpired = false; }
 
   nsExpirationState mExpiration;
@@ -36,16 +35,21 @@ struct Object {
 static bool error;
 static uint32_t periodMS = 100;
 static uint32_t ops = 1000;
 static uint32_t iterations = 2;
 static bool logging = 0;
 static uint32_t sleepPeriodMS = 50;
 static uint32_t slackMS = 20; // allow this much error
 
+static void SignalError() {
+  printf("ERROR!\n");
+  error = true;
+}
+
 template <uint32_t K> class Tracker : public nsExpirationTracker<Object,K> {
 public:
   Tracker() : nsExpirationTracker<Object,K>(periodMS) {
     Object* obj = new Object();
     mUniverse.AppendElement(obj);
     LogAction(obj, "Created");
   }
 
@@ -116,17 +120,21 @@ protected:
     // bounds
     uint32_t lowerBoundMS = (K-1)*periodMS - slackMS;
     uint32_t upperBoundMS = K*(periodMS + sleepPeriodMS) + slackMS;
     if (logging) {
       printf("Checking: %d-%d = %d [%d,%d]\n",
              now, aObj->mLastUsed, timeDiffMS, lowerBoundMS, upperBoundMS);
     }
     if (timeDiffMS < lowerBoundMS || timeDiffMS > upperBoundMS) {
-      EXPECT_TRUE(timeDiffMS < periodMS && aObj->mExpired);
+      if (timeDiffMS < periodMS && aObj->mExpired) {
+        // This is probably OK, it probably just expired twice
+      } else {
+        SignalError();
+      }
     }
     aObj->Touch();
     aObj->mExpired = true;
     DoRandomOperation();
     DoRandomOperation();
     DoRandomOperation();
   }
 };
@@ -168,17 +176,29 @@ static const struct Test {
   TestFunc    func;
 } tests[] = {
   DECL_TEST(test_random3),
   DECL_TEST(test_random4),
   DECL_TEST(test_random8),
   { nullptr, nullptr }
 };
 
-TEST(ExpirationTracker, main)
-{
-  for (const TestExpirationTracker::Test* t = tests;
-       t->name != nullptr; ++t) {
-    EXPECT_TRUE(t->func());
-  }
 }
 
+using namespace TestExpirationTracker;
+
+int main(int argc, char **argv) {
+  int count = 1;
+  if (argc > 1)
+    count = atoi(argv[1]);
+
+  if (NS_FAILED(NS_InitXPCOM2(nullptr, nullptr, nullptr)))
+    return -1;
+
+  while (count--) {
+    for (const Test* t = tests; t->name != nullptr; ++t) {
+      printf("%25s : %s\n", t->name, t->func() ? "SUCCESS" : "FAILURE");
+    }
+  }
+  
+  NS_ShutdownXPCOM(nullptr);
+  return 0;
 }
--- 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 += [
+#    'TestExpirationTracker',
 #    'TestPipes',
 #    'TestPriorityQueue',
 #    'TestStorageStream',
 #    'TestSynchronization',
 #    'TestTArray',
 #    'TestThreadPool',
 #    'TestThreads',
 #    'TestTimeStamp',