summaryrefslogtreecommitdiffstats
path: root/compiler-rt/lib/sanitizer_common/tests/sanitizer_allocator_test.cc
diff options
context:
space:
mode:
authorReid Kleckner <rnk@google.com>2016-07-26 17:59:09 +0000
committerReid Kleckner <rnk@google.com>2016-07-26 17:59:09 +0000
commitcb42ea0b4f9562c3e715d2e22bddf114d7da7c5d (patch)
tree4d614aad9636a6637fd9c709e1b9811d799413ba /compiler-rt/lib/sanitizer_common/tests/sanitizer_allocator_test.cc
parent276b4e642845c3edd379a2a671f8314e38a864cb (diff)
downloadbcm5719-llvm-cb42ea0b4f9562c3e715d2e22bddf114d7da7c5d.tar.gz
bcm5719-llvm-cb42ea0b4f9562c3e715d2e22bddf114d7da7c5d.zip
[sanitizer] Try to fix LargeMmapAllocator test on Windows
This test attempts to allocate 100 512MB aligned pages of memory. This is implemented in the usual way by allocating size + alignment bytes and aligning the result. As a result, this test allocates 51.2GB of memory. Windows allocates swap for all memory allocated, and our bots do not have this much swap available. Avoid the failure by using a more reasonable alignment, like 16MB, as we do on 32-bit. llvm-svn: 276779
Diffstat (limited to 'compiler-rt/lib/sanitizer_common/tests/sanitizer_allocator_test.cc')
-rw-r--r--compiler-rt/lib/sanitizer_common/tests/sanitizer_allocator_test.cc6
1 files changed, 4 insertions, 2 deletions
diff --git a/compiler-rt/lib/sanitizer_common/tests/sanitizer_allocator_test.cc b/compiler-rt/lib/sanitizer_common/tests/sanitizer_allocator_test.cc
index c9d360947b1..03f765ba040 100644
--- a/compiler-rt/lib/sanitizer_common/tests/sanitizer_allocator_test.cc
+++ b/compiler-rt/lib/sanitizer_common/tests/sanitizer_allocator_test.cc
@@ -392,8 +392,10 @@ TEST(SanitizerCommon, LargeMmapAllocator) {
}
CHECK_EQ(a.TotalMemoryUsed(), 0);
- // Test alignments.
- uptr max_alignment = SANITIZER_WORDSIZE == 64 ? (1 << 28) : (1 << 24);
+ // Test alignments. Test with 512MB alignment on x64 non-Windows machines.
+ // Windows doesn't overcommit, and many machines do not have 51.2GB of swap.
+ uptr max_alignment =
+ (SANITIZER_WORDSIZE == 64 && !SANITIZER_WINDOWS) ? (1 << 28) : (1 << 24);
for (uptr alignment = 8; alignment <= max_alignment; alignment *= 2) {
const uptr kNumAlignedAllocs = 100;
for (uptr i = 0; i < kNumAlignedAllocs; i++) {
OpenPOWER on IntegriCloud