[libcxx-commits] [PATCH] D152939: [libc++] Add tests to make sure that stable algorithms work without memory available

Louis Dionne via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Wed Jun 14 13:01:49 PDT 2023


ldionne added inline comments.


================
Comment at: libcxx/test/std/algorithms/alg.modifying.operations/alg.partitions/stable_partition.pass.cpp:298
+    assert(std::is_partitioned(vec.begin(), vec.end(), [](int i) { return i < 5; }));
+    getGlobalMemCounter()->throw_after = 9999;
+  }
----------------
I think you want `->reset()` here instead.


================
Comment at: libcxx/test/std/algorithms/alg.modifying.operations/alg.partitions/stable_partition.pass.cpp:300
+  }
+#endif // TEST_STD_VER >= 11
 }
----------------
Same problem below as well.


================
Comment at: libcxx/test/std/algorithms/alg.sorting/alg.merge/inplace_merge.pass.cpp:113-116
+  std::vector<int> vec(150, 3);
+  getGlobalMemCounter()->throw_after = 0;
+  std::inplace_merge(vec.begin(), vec.begin() + 100, vec.end());
+  assert(std::all_of(vec.begin(), vec.end(), [](int i) { return i == 3; }));
----------------
Indentation is wrong. Please also enclose this in braces to clearly delimit that it's a test of its own.


================
Comment at: libcxx/test/support/count_new.h:423-429
+void* operator new(std::size_t s, std::align_val_t av, const std::nothrow_t&) TEST_NOEXCEPT {
+  try {
+    return operator new(s, av);
+  } catch (...) {
+    return nullptr;
+  }
+}
----------------
Just to clarify, this is temporary to figure out whether that is what's causing the AIX issues right?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D152939



More information about the libcxx-commits mailing list