[libcxx-commits] [PATCH] D98006: Fixed test

kamlesh kumar via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Fri Mar 5 01:29:54 PST 2021


kamleshbhalui updated this revision to Diff 328438.
kamleshbhalui added a comment.

Added one fixed test


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D98006/new/

https://reviews.llvm.org/D98006

Files:
  libcxx/test/std/containers/sequences/list/list.modifiers/insert_iter_size_value.pass.cpp
  libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/nullptr_t_deleter_throw.pass.cpp
  libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/pointer_deleter_throw.pass.cpp
  libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/unique_ptr.pass.cpp


Index: libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/unique_ptr.pass.cpp
===================================================================
--- libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/unique_ptr.pass.cpp
+++ libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/unique_ptr.pass.cpp
@@ -81,7 +81,7 @@
         assert(p.get() == raw_ptr);
         assert(ptr.get() == 0);
     }
-#ifndef TEST_HAS_NO_EXCEPTIONS
+#if !defined(TEST_HAS_NO_EXCEPTIONS) && !defined(DISABLE_NEW_COUNT)
     assert(A::count == 0);
     {
         std::unique_ptr<A> ptr(new A);
Index: libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/pointer_deleter_throw.pass.cpp
===================================================================
--- libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/pointer_deleter_throw.pass.cpp
+++ libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/pointer_deleter_throw.pass.cpp
@@ -37,21 +37,19 @@
 
 int main(int, char**)
 {
-    globalMemCounter.reset();
-    A* ptr = new A;
-    globalMemCounter.throw_after = 0;
-    try
-    {
-        std::shared_ptr<A> p(ptr, test_deleter<A>(3));
-        assert(false);
-    }
-    catch (std::bad_alloc&)
-    {
-        assert(A::count == 0);
-        assert(test_deleter<A>::count == 0);
-        assert(test_deleter<A>::dealloc_count == 1);
-    }
-    assert(globalMemCounter.checkOutstandingNewEq(0));
-
+#if !defined(DISABLE_NEW_COUNT)
+  globalMemCounter.reset();
+  A* ptr = new A;
+  globalMemCounter.throw_after = 0;
+  try {
+    std::shared_ptr<A> p(ptr, test_deleter<A>(3));
+    assert(false);
+  } catch (std::bad_alloc&) {
+    assert(A::count == 0);
+    assert(test_deleter<A>::count == 0);
+    assert(test_deleter<A>::dealloc_count == 1);
+  }
+  assert(globalMemCounter.checkOutstandingNewEq(0));
+#endif
   return 0;
 }
Index: libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/nullptr_t_deleter_throw.pass.cpp
===================================================================
--- libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/nullptr_t_deleter_throw.pass.cpp
+++ libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/nullptr_t_deleter_throw.pass.cpp
@@ -39,18 +39,16 @@
 
 int main(int, char**)
 {
-    globalMemCounter.throw_after = 0;
-    try
-    {
-        std::shared_ptr<A> p(nullptr, test_deleter<A>(3));
-        assert(false);
-    }
-    catch (std::bad_alloc&)
-    {
-        assert(A::count == 0);
-        assert(test_deleter<A>::count == 0);
-        assert(test_deleter<A>::dealloc_count == 1);
-    }
-
+#if !defined(DISABLE_NEW_COUNT)
+  globalMemCounter.throw_after = 0;
+  try {
+    std::shared_ptr<A> p(nullptr, test_deleter<A>(3));
+    assert(false);
+  } catch (std::bad_alloc&) {
+    assert(A::count == 0);
+    assert(test_deleter<A>::count == 0);
+    assert(test_deleter<A>::dealloc_count == 1);
+  }
+#endif
   return 0;
 }
Index: libcxx/test/std/containers/sequences/list/list.modifiers/insert_iter_size_value.pass.cpp
===================================================================
--- libcxx/test/std/containers/sequences/list/list.modifiers/insert_iter_size_value.pass.cpp
+++ libcxx/test/std/containers/sequences/list/list.modifiers/insert_iter_size_value.pass.cpp
@@ -28,7 +28,7 @@
     typename List::iterator i = l1.insert(next(l1.cbegin()), 5, 4);
     assert(i == next(l1.begin()));
     assert(l1 == List(a2, a2+8));
-#ifndef TEST_HAS_NO_EXCEPTIONS
+#if !defined(TEST_HAS_NO_EXCEPTIONS) && !defined(DISABLE_NEW_COUNT)
     globalMemCounter.throw_after = 4;
     int save_count = globalMemCounter.outstanding_new;
     try


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D98006.328438.patch
Type: text/x-patch
Size: 3954 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20210305/bc045a24/attachment.bin>


More information about the libcxx-commits mailing list