Commit 2834b6e4 authored by Nicholas Ormrod's avatar Nicholas Ormrod Committed by Facebook GitHub Bot

Rm std::unique_ptr null-deleter test case

Summary:
The null-deleter test case showcases not_null's handling of null deleters. It also tries to demonstrate that std::unique_ptr does not handle null deleters properly (e.g. by segfaulting). The latter is really "check what kind of undefined behavior we encounter", and this doesn't always work. Surprise! Specifically, the undefined behavior encountered when supplying a null deleter into std::unique_ptr when using tsan is an infinite hang, which breaks the test suite.

Fortunately, testing std::unique_ptr's handling of null deleters is irrelevant to the correctness of not_null_unique_ptr, so we can remove this code.

After this diff, the following test does not hang:
  buck test mode/dev-tsan //folly/memory/test:not_null_test -- 'nn\.null_deleter' --run-disabled

Reviewed By: yfeldblum

Differential Revision: D24662902

fbshipit-source-id: 230187890b29e1d1a5c8284958c9b798c891c7f7
parent 98625fc8
......@@ -500,12 +500,6 @@ TEST(nn, hash) {
}
TEST(nn, null_deleter) {
int* i = new int(5);
auto f = [&]() { std::unique_ptr<int, void (*)(int*)> nnui(i, nullptr); };
// Error messages are different in build modes, but both die
EXPECT_DEATH(f(), "");
delete i;
int* j = new int(6);
try {
not_null_unique_ptr<int, void (*)(int*)> nnui(j, nullptr);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment