1UNSUPPORTED: aarch64, ios
2# Tests break on windows unless exe extension is used (because there are periods
3# in expansion of %t, the string after the period is interpreted as the file
4# extension, so each compilation will clobber the previous one's lib and exp
5# files causing symbolization to break).
6RUN: %cpp_compiler %S/OutOfMemoryTest.cpp -o %t-OutOfMemoryTest.exe
7RUN: %cpp_compiler %S/OutOfMemorySingleLargeMallocTest.cpp -o %t-OutOfMemorySingleLargeMallocTest.exe
8RUN: %cpp_compiler %S/AccumulateAllocationsTest.cpp -o %t-AccumulateAllocationsTest.exe
9
10RUN: not %run %t-OutOfMemoryTest.exe -rss_limit_mb=300 2>&1 | FileCheck %s
11
12CHECK: ERROR: libFuzzer: out-of-memory (used: {{.*}}; limit: 300Mb)
13CHECK: Test unit written to ./oom-
14SUMMARY: libFuzzer: out-of-memory
15
16RUN: not %run %t-OutOfMemorySingleLargeMallocTest.exe -rss_limit_mb=300    2>&1 | FileCheck %s --check-prefix=SINGLE_LARGE_MALLOC
17RUN: not %run %t-OutOfMemorySingleLargeMallocTest.exe -malloc_limit_mb=300 2>&1 | FileCheck %s --check-prefix=SINGLE_LARGE_MALLOC
18RUN: not %run %t-OutOfMemorySingleLargeMallocTest.exe -rss_limit_mb=1000 -malloc_limit_mb=300 2>&1 | FileCheck %s --check-prefix=SINGLE_LARGE_MALLOC
19
20We used to check for "out-of-memory (malloc(53{{.*}}))", but that would fail
21sometimes, so now we accept any OOM message.
22
23SINGLE_LARGE_MALLOC: libFuzzer: out-of-memory
24SINGLE_LARGE_MALLOC: in LLVMFuzzerTestOneInput
25
26# Check that -rss_limit_mb=0 means no limit.
27RUN: %run %t-AccumulateAllocationsTest.exe -runs=1000 -rss_limit_mb=0
28