OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 #include "base/metrics/persistent_memory_allocator.h" | 5 #include "base/metrics/persistent_memory_allocator.h" |
6 | 6 |
7 #include "base/files/file.h" | 7 #include "base/files/file.h" |
8 #include "base/files/file_util.h" | 8 #include "base/files/file_util.h" |
9 #include "base/files/memory_mapped_file.h" | 9 #include "base/files/memory_mapped_file.h" |
10 #include "base/files/scoped_temp_dir.h" | 10 #include "base/files/scoped_temp_dir.h" |
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
300 EXPECT_FALSE(allocator_->IsCorrupt()); | 300 EXPECT_FALSE(allocator_->IsCorrupt()); |
301 EXPECT_TRUE(allocator_->IsFull()); | 301 EXPECT_TRUE(allocator_->IsFull()); |
302 EXPECT_EQ(CountIterables(), | 302 EXPECT_EQ(CountIterables(), |
303 t1.iterable() + t2.iterable() + t3.iterable() + t4.iterable() + | 303 t1.iterable() + t2.iterable() + t3.iterable() + t4.iterable() + |
304 t5.iterable()); | 304 t5.iterable()); |
305 } | 305 } |
306 | 306 |
307 // This test doesn't verify anything other than it doesn't crash. Its goal | 307 // This test doesn't verify anything other than it doesn't crash. Its goal |
308 // is to find coding errors that aren't otherwise tested for, much like a | 308 // is to find coding errors that aren't otherwise tested for, much like a |
309 // "fuzzer" would. | 309 // "fuzzer" would. |
310 TEST_F(PersistentMemoryAllocatorTest, CorruptionTest) { | 310 // This test is suppsoed to fail on TSAN bot (crbug.com/579867). |
| 311 #if defined(THREAD_SANITIZER) |
| 312 #define MAYBE_CorruptionTest DISABLED_CorruptionTest |
| 313 #else |
| 314 #define MAYBE_CorruptionTest CorruptionTest |
| 315 #endif |
| 316 TEST_F(PersistentMemoryAllocatorTest, MAYBE_CorruptionTest) { |
311 char* memory = mem_segment_.get(); | 317 char* memory = mem_segment_.get(); |
312 AllocatorThread t1("t1", memory, TEST_MEMORY_SIZE, TEST_MEMORY_PAGE); | 318 AllocatorThread t1("t1", memory, TEST_MEMORY_SIZE, TEST_MEMORY_PAGE); |
313 AllocatorThread t2("t2", memory, TEST_MEMORY_SIZE, TEST_MEMORY_PAGE); | 319 AllocatorThread t2("t2", memory, TEST_MEMORY_SIZE, TEST_MEMORY_PAGE); |
314 AllocatorThread t3("t3", memory, TEST_MEMORY_SIZE, TEST_MEMORY_PAGE); | 320 AllocatorThread t3("t3", memory, TEST_MEMORY_SIZE, TEST_MEMORY_PAGE); |
315 AllocatorThread t4("t4", memory, TEST_MEMORY_SIZE, TEST_MEMORY_PAGE); | 321 AllocatorThread t4("t4", memory, TEST_MEMORY_SIZE, TEST_MEMORY_PAGE); |
316 AllocatorThread t5("t5", memory, TEST_MEMORY_SIZE, TEST_MEMORY_PAGE); | 322 AllocatorThread t5("t5", memory, TEST_MEMORY_SIZE, TEST_MEMORY_PAGE); |
317 | 323 |
318 t1.Start(); | 324 t1.Start(); |
319 t2.Start(); | 325 t2.Start(); |
320 t3.Start(); | 326 t3.Start(); |
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
498 // For filesize >= minsize, the file must be acceptable. This | 504 // For filesize >= minsize, the file must be acceptable. This |
499 // else clause (file-not-acceptable) should be reached only if | 505 // else clause (file-not-acceptable) should be reached only if |
500 // filesize < minsize. | 506 // filesize < minsize. |
501 EXPECT_GT(minsize, filesize); | 507 EXPECT_GT(minsize, filesize); |
502 } | 508 } |
503 #endif | 509 #endif |
504 } | 510 } |
505 } | 511 } |
506 | 512 |
507 } // namespace base | 513 } // namespace base |
OLD | NEW |