Bug 1424341 Add tests for Atomic*ReleaseAcquire r=bkelly,njn
authorTom Ritter <tom@mozilla.com>
Wed, 20 Dec 2017 14:49:16 -0600
changeset 450406 4a6035d8a0399473c8acbb4bb376a5a2c3793a04
parent 450405 ab399bd8412b47486dc8f10f2a647ed247ea675d
child 450407 9fd027751d817fae5f471b05c087cf2590790c04
push id8527
push userCallek@gmail.com
push dateThu, 11 Jan 2018 21:05:50 +0000
treeherdermozilla-beta@95342d212a7a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbkelly, njn
bugs1424341
milestone59.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 1424341 Add tests for Atomic*ReleaseAcquire r=bkelly,njn MozReview-Commit-ID: HvA2QK4KcHf
modules/libpref/test/gtest/CallbackAndVarCacheOrder.cpp
--- a/modules/libpref/test/gtest/CallbackAndVarCacheOrder.cpp
+++ b/modules/libpref/test/gtest/CallbackAndVarCacheOrder.cpp
@@ -67,16 +67,23 @@ AddVarCacheFunc(bool* aVar, const char* 
 void
 AddVarCacheFunc(Atomic<bool, Relaxed>* aVar, const char* aPrefName)
 {
   nsresult rv = Preferences::AddAtomicBoolVarCache(aVar, aPrefName);
   ASSERT_TRUE(NS_SUCCEEDED(rv));
 }
 
 void
+AddVarCacheFunc(Atomic<bool, ReleaseAcquire>* aVar, const char* aPrefName)
+{
+  nsresult rv = Preferences::AddAtomicBoolVarCache(aVar, aPrefName);
+  ASSERT_TRUE(NS_SUCCEEDED(rv));
+}
+
+void
 AddVarCacheFunc(int32_t* aVar, const char* aPrefName)
 {
   nsresult rv = Preferences::AddIntVarCache(aVar, aPrefName);
   ASSERT_TRUE(NS_SUCCEEDED(rv));
 }
 
 void
 AddVarCacheFunc(Atomic<int32_t, Relaxed>* aVar, const char* aPrefName)
@@ -95,16 +102,23 @@ AddVarCacheFunc(uint32_t* aVar, const ch
 void
 AddVarCacheFunc(Atomic<uint32_t, Relaxed>* aVar, const char* aPrefName)
 {
   nsresult rv = Preferences::AddAtomicUintVarCache(aVar, aPrefName);
   ASSERT_TRUE(NS_SUCCEEDED(rv));
 }
 
 void
+AddVarCacheFunc(Atomic<uint32_t, ReleaseAcquire>* aVar, const char* aPrefName)
+{
+  nsresult rv = Preferences::AddAtomicUintVarCache(aVar, aPrefName);
+  ASSERT_TRUE(NS_SUCCEEDED(rv));
+}
+
+void
 AddVarCacheFunc(float* aVar, const char* aPrefName)
 {
   nsresult rv = Preferences::AddFloatVarCache(aVar, aPrefName);
   ASSERT_TRUE(NS_SUCCEEDED(rv));
 }
 
 template<typename T, typename U = T>
 void
@@ -150,20 +164,26 @@ RunTest(const char* aPrefName1, const ch
   ASSERT_TRUE(closure2.mCalled);
 }
 
 TEST(CallbackAndVarCacheOrder, Bool)
 {
   RunTest<bool>("test_pref.bool.1", "test_pref.bool.2", false, true);
 }
 
-TEST(CallbackAndVarCacheOrder, AtomicBool)
+TEST(CallbackAndVarCacheOrder, AtomicBoolRelaxed)
 {
   RunTest<bool, Atomic<bool, Relaxed>>(
     "test_pref.atomic_bool.1", "test_pref.atomic_bool.2", false, true);
+ }
+
+TEST(CallbackAndVarCacheOrder, AtomicBoolReleaseAcquire)
+{
+  RunTest<bool, Atomic<bool, ReleaseAcquire>>(
+    "test_pref.atomic_bool.3", "test_pref.atomic_bool.4", false, true);
 }
 
 TEST(CallbackAndVarCacheOrder, Int)
 {
   RunTest<int32_t>("test_pref.int.1", "test_pref.int.2", -2, 3);
 }
 
 TEST(CallbackAndVarCacheOrder, AtomicInt)
@@ -172,20 +192,26 @@ TEST(CallbackAndVarCacheOrder, AtomicInt
     "test_pref.atomic_int.1", "test_pref.atomic_int.2", -3, 4);
 }
 
 TEST(CallbackAndVarCacheOrder, Uint)
 {
   RunTest<uint32_t>("test_pref.uint.1", "test_pref.uint.2", 4u, 5u);
 }
 
-TEST(CallbackAndVarCacheOrder, AtomicUint)
+TEST(CallbackAndVarCacheOrder, AtomicUintRelaxed)
 {
   RunTest<uint32_t, Atomic<uint32_t, Relaxed>>(
     "test_pref.atomic_uint.1", "test_pref.atomic_uint.2", 6u, 7u);
 }
 
+TEST(CallbackAndVarCacheOrder, AtomicUintReleaseAcquire)
+{
+  RunTest<uint32_t, Atomic<uint32_t, ReleaseAcquire>>(
+    "test_pref.atomic_uint.3", "test_pref.atomic_uint.4", 8u, 9u);
+}
+
 TEST(CallbackAndVarCacheOrder, Float)
 {
-  RunTest<float>("test_pref.float.1", "test_pref.float.2", -8.0f, 9.0f);
+  RunTest<float>("test_pref.float.1", "test_pref.float.2", -10.0f, 11.0f);
 }
 
 } // namespace mozilla