[asan] make a test consume 2x less RAM (we observe flaky bot failures that seem like OOMs)

llvm-svn: 225478
This commit is contained in:
Kostya Serebryany 2015-01-08 23:37:09 +00:00
parent 616b9f035c
commit 8cc4002df2
1 changed files with 11 additions and 11 deletions

View File

@ -2,8 +2,8 @@
// RUN: %clangxx -O2 %s -o %t
//
// Run with limit should fail:
// RUN: %tool_options=soft_rss_limit_mb=400:quarantine_size=1:allocator_may_return_null=1 %run %t 2>&1 | FileCheck %s -check-prefix=CHECK_MAY_RETURN_1
// RUN: %tool_options=soft_rss_limit_mb=400:quarantine_size=1:allocator_may_return_null=0 not %run %t 2>&1 | FileCheck %s -check-prefix=CHECK_MAY_RETURN_0
// RUN: %tool_options=soft_rss_limit_mb=220:quarantine_size=1:allocator_may_return_null=1 %run %t 2>&1 | FileCheck %s -check-prefix=CHECK_MAY_RETURN_1
// RUN: %tool_options=soft_rss_limit_mb=220:quarantine_size=1:allocator_may_return_null=0 not %run %t 2>&1 | FileCheck %s -check-prefix=CHECK_MAY_RETURN_0
// FIXME: make it work for other sanitizers.
// XFAIL: lsan
@ -14,8 +14,8 @@
#include <string.h>
#include <unistd.h>
static const int kMaxNumAllocs = 1 << 10;
static const int kAllocSize = 1 << 20; // Large enough to go vi mmap.
static const int kMaxNumAllocs = 1 << 9;
static const int kAllocSize = 1 << 20; // Large enough to go via mmap.
static char *allocs[kMaxNumAllocs];
@ -25,7 +25,7 @@ int main() {
fprintf(stderr, "[%d] allocating %d times\n", i, num_allocs);
int zero_results = 0;
for (int j = 0; j < num_allocs; j++) {
if ((j % (num_allocs / 4)) == 0) {
if ((j % (num_allocs / 8)) == 0) {
usleep(100000);
fprintf(stderr, " [%d]\n", j);
}
@ -47,16 +47,16 @@ int main() {
}
}
// CHECK_MAY_RETURN_1: allocating 128 times
// CHECK_MAY_RETURN_1: Some of the malloc calls returned non-null: 128
// CHECK_MAY_RETURN_1: allocating 256 times
// CHECK_MAY_RETURN_1: Some of the malloc calls returned non-null: 256
// CHECK_MAY_RETURN_1: Some of the malloc calls returned null:
// CHECK_MAY_RETURN_1: Some of the malloc calls returned non-null:
// CHECK_MAY_RETURN_1: allocating 512 times
// CHECK_MAY_RETURN_1: Some of the malloc calls returned null:
// CHECK_MAY_RETURN_1: Some of the malloc calls returned non-null:
// CHECK_MAY_RETURN_1: allocating 1024 times
// CHECK_MAY_RETURN_1: Some of the malloc calls returned null:
// CHECK_MAY_RETURN_1: Some of the malloc calls returned non-null:
// CHECK_MAY_RETURN_0: allocating 128 times
// CHECK_MAY_RETURN_0: Some of the malloc calls returned non-null: 128
// CHECK_MAY_RETURN_0: allocating 256 times
// CHECK_MAY_RETURN_0: Some of the malloc calls returned non-null: 256
// CHECK_MAY_RETURN_0: allocating 512 times
// CHECK_MAY_RETURN_0: allocator is terminating the process instead of returning