rlimit_mmap_test.cc revision 2d1fdb26e458c4ddc04155c1d421bced3ba90cd0
1// Check that we properly report mmap failure. 2// RUN: %clangxx_asan %s -o %t && not %run %t 2>&1 | FileCheck %s 3#include <stdlib.h> 4#include <assert.h> 5#include <sys/time.h> 6#include <sys/resource.h> 7 8static volatile void *x; 9 10int main(int argc, char **argv) { 11 struct rlimit mmap_resource_limit = { 0, 0 }; 12 assert(0 == setrlimit(RLIMIT_AS, &mmap_resource_limit)); 13 x = malloc(10000000); 14// CHECK: ERROR: Failed to mmap 15 return 0; 16} 17