OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #define _CRT_SECURE_NO_WARNINGS | 5 #define _CRT_SECURE_NO_WARNINGS |
6 | 6 |
7 #include <limits> | 7 #include <limits> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/eintr_wrapper.h" | 10 #include "base/eintr_wrapper.h" |
(...skipping 397 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
408 | 408 |
409 TEST_F(OutOfMemoryTest, Pvalloc) { | 409 TEST_F(OutOfMemoryTest, Pvalloc) { |
410 ASSERT_DEATH(value_ = pvalloc(test_size_), ""); | 410 ASSERT_DEATH(value_ = pvalloc(test_size_), ""); |
411 } | 411 } |
412 | 412 |
413 TEST_F(OutOfMemoryTest, Memalign) { | 413 TEST_F(OutOfMemoryTest, Memalign) { |
414 ASSERT_DEATH(value_ = memalign(4, test_size_), ""); | 414 ASSERT_DEATH(value_ = memalign(4, test_size_), ""); |
415 } | 415 } |
416 | 416 |
417 TEST_F(OutOfMemoryTest, Posix_memalign) { | 417 TEST_F(OutOfMemoryTest, Posix_memalign) { |
418 ASSERT_DEATH(posix_memalign(&value_, 8, test_size_), ""); | 418 // Grab the return value of posix_memalign to silence a compiler |
| 419 // warning about unused variables. We don't actually care about |
| 420 // the return value, since we're asserting death. |
| 421 int ret; |
| 422 ASSERT_DEATH(ret = posix_memalign(&value_, 8, test_size_), ""); |
419 } | 423 } |
420 | 424 |
421 extern "C" { | 425 extern "C" { |
422 | 426 |
423 void* __libc_malloc(size_t size); | 427 void* __libc_malloc(size_t size); |
424 void* __libc_realloc(void* ptr, size_t size); | 428 void* __libc_realloc(void* ptr, size_t size); |
425 void* __libc_calloc(size_t nmemb, size_t size); | 429 void* __libc_calloc(size_t nmemb, size_t size); |
426 void* __libc_valloc(size_t size); | 430 void* __libc_valloc(size_t size); |
427 void* __libc_pvalloc(size_t size); | 431 void* __libc_pvalloc(size_t size); |
428 void* __libc_memalign(size_t alignment, size_t size); | 432 void* __libc_memalign(size_t alignment, size_t size); |
(...skipping 20 matching lines...) Expand all Loading... |
449 ASSERT_DEATH(value_ = __libc_pvalloc(test_size_), ""); | 453 ASSERT_DEATH(value_ = __libc_pvalloc(test_size_), ""); |
450 } | 454 } |
451 | 455 |
452 TEST_F(OutOfMemoryTest, __libc_memalign) { | 456 TEST_F(OutOfMemoryTest, __libc_memalign) { |
453 ASSERT_DEATH(value_ = __libc_memalign(4, test_size_), ""); | 457 ASSERT_DEATH(value_ = __libc_memalign(4, test_size_), ""); |
454 } | 458 } |
455 | 459 |
456 #endif // defined(OS_LINUX) | 460 #endif // defined(OS_LINUX) |
457 | 461 |
458 } // namespace base | 462 } // namespace base |
OLD | NEW |