Bug 833127 - fix startupcache test issues identified by asan; r=mwu
authorNathan Froyd <froydnj@mozilla.com>
Mon, 21 Jan 2013 19:17:20 -0500
changeset 129590 dff72e90b3ac62fe7a90cf8fd1cdcbc130a44a05
parent 129589 00f8e147686ad668f533073bdaa492dd8d6290ac
child 129591 9c792b677b4c6289c6a2887dd4f9ac099e5e093c
push id2323
push userbbajaj@mozilla.com
push dateMon, 01 Apr 2013 19:47:02 +0000
treeherdermozilla-beta@7712be144d91 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmwu
bugs833127
milestone21.0a1
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
Bug 833127 - fix startupcache test issues identified by asan; r=mwu
startupcache/test/TestStartupCache.cpp
--- a/startupcache/test/TestStartupCache.cpp
+++ b/startupcache/test/TestStartupCache.cpp
@@ -356,35 +356,45 @@ TestEarlyShutdown() {
   sc->InvalidateCache();
 
   const char* buf = "Find your soul beardmate on BeardBook";
   const char* id = "id";
   uint32_t len;
   char* outbuf = NULL;
   
   sc->ResetStartupWriteTimer();
-  rv = sc->PutBuffer(buf, id, strlen(buf) + 1);
+  rv = sc->PutBuffer(id, buf, strlen(buf) + 1);
   NS_ENSURE_SUCCESS(rv, rv);
 
   nsCOMPtr<nsIObserver> obs;
   sc->GetObserver(getter_AddRefs(obs));
   obs->Observe(nullptr, "xpcom-shutdown", nullptr);
   rv = WaitForStartupTimer();
   NS_ENSURE_SUCCESS(rv, rv);
   
   rv = sc->GetBuffer(id, &outbuf, &len);
   delete[] outbuf;
 
+  if (NS_SUCCEEDED(rv)) {
+    passed("GetBuffer succeeded after early shutdown");
+  } else {
+    fail("GetBuffer failed after early shutdown");
+    return rv;
+  }
+
+  const char* other_id = "other_id";
+  rv = sc->PutBuffer(other_id, buf, strlen(buf) + 1);
+
   if (rv == NS_ERROR_NOT_AVAILABLE) {
-    passed("buffer not available after early shutdown");
+    passed("PutBuffer not available after early shutdown");
   } else if (NS_SUCCEEDED(rv)) {
-    fail("GetBuffer succeeded unexpectedly after early shutdown");
+    fail("PutBuffer succeeded unexpectedly after early shutdown");
     return NS_ERROR_UNEXPECTED;
   } else {
-    fail("GetBuffer gave an unexpected failure, expected NOT_AVAILABLE");
+    fail("PutBuffer gave an unexpected failure, expected NOT_AVAILABLE");
     return rv;
   }
  
   return NS_OK;
 }
 
 bool
 SetupJS(JSContext **cxp)