1REQUIRES: lsan
2RUN: not LLVMFuzzer-LeakTest -runs=100000 -detect_leaks=1 2>&1 | FileCheck %s --check-prefix=LEAK_DURING
3LEAK_DURING: ERROR: LeakSanitizer: detected memory leaks
4LEAK_DURING: Direct leak of 4 byte(s) in 1 object(s) allocated from:
5LEAK_DURING: INFO: to ignore leaks on libFuzzer side use -detect_leaks=0
6LEAK_DURING: Test unit written to ./leak-
7LEAK_DURING-NOT: DONE
8LEAK_DURING-NOT: Done
9
10RUN: not LLVMFuzzer-LeakTest -runs=0 -detect_leaks=1 %S 2>&1 | FileCheck %s --check-prefix=LEAK_IN_CORPUS
11LEAK_IN_CORPUS: ERROR: LeakSanitizer: detected memory leaks
12LEAK_IN_CORPUS: INFO: a leak has been found in the initial corpus.
13
14RUN: not LLVMFuzzer-LeakTest -runs=100000000 %S/hi.txt 2>&1 | FileCheck %s --check-prefix=MULTI_RUN_LEAK
15MULTI_RUN_LEAK-NOT: pulse
16MULTI_RUN_LEAK: LeakSanitizer: detected memory leaks
17
18RUN: not LLVMFuzzer-LeakTest -runs=100000 -detect_leaks=0 2>&1 | FileCheck %s --check-prefix=LEAK_AFTER
19RUN: not LLVMFuzzer-LeakTest -runs=100000                 2>&1 | FileCheck %s --check-prefix=LEAK_DURING
20RUN: not LLVMFuzzer-ThreadedLeakTest -runs=100000 -detect_leaks=0 2>&1 | FileCheck %s --check-prefix=LEAK_AFTER
21RUN: not LLVMFuzzer-ThreadedLeakTest -runs=100000                 2>&1 | FileCheck %s --check-prefix=LEAK_DURING
22LEAK_AFTER: Done 100000 runs in
23LEAK_AFTER: ERROR: LeakSanitizer: detected memory leaks
24
25RUN: not LLVMFuzzer-LeakTest -runs=100000 -max_len=1 2>&1 | FileCheck %s --check-prefix=MAX_LEN_1
26MAX_LEN_1: Test unit written to ./leak-7cf184f4c67ad58283ecb19349720b0cae756829
27
28RUN: not LLVMFuzzer-LeakTimeoutTest -timeout=1 2>&1 | FileCheck %s --check-prefix=LEAK_TIMEOUT
29LEAK_TIMEOUT: ERROR: libFuzzer: timeout after
30LEAK_TIMEOUT-NOT: LeakSanitizer
31
32RUN: LLVMFuzzer-AccumulateAllocationsTest -detect_leaks=1 -runs=100000 2>&1 | FileCheck %s --check-prefix=ACCUMULATE_ALLOCS
33ACCUMULATE_ALLOCS: INFO: libFuzzer disabled leak detection after every mutation
34
35RUN: LLVMFuzzer-LeakTest -error_exitcode=0
36