2 // See https://github.com/llvm/llvm-project/issues/97712.
3 UNSUPPORTED: target={{.*}}
5 RUN: %cpp_compiler %S/LeakTest.cpp -o %t-LeakTest
6 RUN: %cpp_compiler %S/ThreadedLeakTest.cpp -o %t-ThreadedLeakTest
7 RUN: %cpp_compiler %S/LeakTimeoutTest.cpp -o %t-LeakTimeoutTest
9 RUN: rm -rf %t-corpus && mkdir -p %t-corpus
10 RUN: not %run %t-LeakTest -runs=100000 -detect_leaks=1 %t-corpus 2>&1 | FileCheck %s --check-prefix=LEAK_DURING
11 LEAK_DURING: ERROR: LeakSanitizer: detected memory leaks
12 LEAK_DURING: Direct leak of {{.*}} byte(s) in {{.*}} object(s) allocated from:
13 LEAK_DURING: INFO: to ignore leaks on libFuzzer side use -detect_leaks=0
14 LEAK_DURING: Test unit written to ./leak-
18 // Verify leaking input was not added to corpus
19 RUN: %run %t-LeakTest -runs=0 %t-corpus
21 RUN: not %run %t-LeakTest -runs=0 -detect_leaks=1 %S 2>&1 | FileCheck %s --check-prefix=LEAK_IN_CORPUS
22 LEAK_IN_CORPUS: ERROR: LeakSanitizer: detected memory leaks
23 LEAK_IN_CORPUS: INFO: a leak has been found in the initial corpus.
25 RUN: not %run %t-LeakTest -runs=100000000 %S/hi.txt 2>&1 | FileCheck %s --check-prefix=MULTI_RUN_LEAK
26 MULTI_RUN_LEAK-NOT: pulse
27 MULTI_RUN_LEAK: LeakSanitizer: detected memory leaks
29 RUN: not %run %t-LeakTest -runs=100000 -detect_leaks=0 2>&1 | FileCheck %s --check-prefix=LEAK_AFTER
30 RUN: not %run %t-LeakTest -runs=100000 2>&1 | FileCheck %s --check-prefix=LEAK_DURING
31 RUN: not %run %t-ThreadedLeakTest -runs=100000 -detect_leaks=0 2>&1 | FileCheck %s --check-prefix=LEAK_AFTER
32 RUN: not %run %t-ThreadedLeakTest -runs=100000 2>&1 | FileCheck %s --check-prefix=LEAK_DURING
33 LEAK_AFTER: Done 100000 runs in
34 LEAK_AFTER: ERROR: LeakSanitizer: detected memory leaks
36 RUN: not %run %t-LeakTest -runs=100000 -max_len=1 2>&1 | FileCheck %s --check-prefix=MAX_LEN_1
37 MAX_LEN_1: Test unit written to ./leak-7cf184f4c67ad58283ecb19349720b0cae756829
39 RUN: not %run %t-LeakTimeoutTest -timeout=1 2>&1 | FileCheck %s --check-prefix=LEAK_TIMEOUT
40 LEAK_TIMEOUT: ERROR: libFuzzer: timeout after
41 LEAK_TIMEOUT-NOT: LeakSanitizer
44 RUN: %run %t-LeakTest -error_exitcode=0