Merge "Small test fixes."
This commit is contained in:
commit
9a4f572a95
|
@ -74,7 +74,7 @@ TEST_F(DisableMallocTest, deadlock_new) {
|
|||
{
|
||||
alarm(100ms);
|
||||
ScopedDisableMalloc disable_malloc;
|
||||
char* ptr = new(char);
|
||||
char* ptr = new (std::nothrow)(char);
|
||||
ASSERT_NE(ptr, nullptr);
|
||||
delete(ptr);
|
||||
}
|
||||
|
@ -89,6 +89,8 @@ TEST_F(DisableMallocTest, deadlock_delete) {
|
|||
alarm(250ms);
|
||||
ScopedDisableMalloc disable_malloc;
|
||||
delete(ptr);
|
||||
// Force ptr usage or this code gets optimized away by the arm64 compiler.
|
||||
ASSERT_NE(ptr, nullptr);
|
||||
}
|
||||
}, "");
|
||||
}
|
||||
|
|
|
@ -23,8 +23,6 @@
|
|||
|
||||
#include <memunreachable/memunreachable.h>
|
||||
|
||||
void* ptr;
|
||||
|
||||
class HiddenPointer {
|
||||
public:
|
||||
explicit HiddenPointer(size_t size = 256) {
|
||||
|
@ -92,10 +90,12 @@ TEST(MemunreachableTest, stack) {
|
|||
}
|
||||
}
|
||||
|
||||
void* g_ptr;
|
||||
|
||||
TEST(MemunreachableTest, global) {
|
||||
HiddenPointer hidden_ptr;
|
||||
|
||||
ptr = hidden_ptr.Get();
|
||||
g_ptr = hidden_ptr.Get();
|
||||
|
||||
{
|
||||
UnreachableMemoryInfo info;
|
||||
|
@ -104,7 +104,7 @@ TEST(MemunreachableTest, global) {
|
|||
ASSERT_EQ(0U, info.leaks.size());
|
||||
}
|
||||
|
||||
ptr = NULL;
|
||||
g_ptr = nullptr;
|
||||
|
||||
{
|
||||
UnreachableMemoryInfo info;
|
||||
|
@ -126,7 +126,7 @@ TEST(MemunreachableTest, global) {
|
|||
TEST(MemunreachableTest, tls) {
|
||||
HiddenPointer hidden_ptr;
|
||||
pthread_key_t key;
|
||||
pthread_key_create(&key, NULL);
|
||||
pthread_key_create(&key, nullptr);
|
||||
|
||||
pthread_setspecific(key, hidden_ptr.Get());
|
||||
|
||||
|
|
Loading…
Reference in New Issue