45 lines · plain
1REQUIRES: lsan2// See https://github.com/llvm/llvm-project/issues/97712.3UNSUPPORTED: target={{.*}}4 5RUN: %cpp_compiler %S/LeakTest.cpp -o %t-LeakTest6RUN: %cpp_compiler %S/ThreadedLeakTest.cpp -o %t-ThreadedLeakTest7RUN: %cpp_compiler %S/LeakTimeoutTest.cpp -o %t-LeakTimeoutTest8 9RUN: rm -rf %t-corpus && mkdir -p %t-corpus10RUN: not %run %t-LeakTest -runs=100000 -detect_leaks=1 %t-corpus 2>&1 | FileCheck %s --check-prefix=LEAK_DURING11LEAK_DURING: ERROR: LeakSanitizer: detected memory leaks12LEAK_DURING: Direct leak of {{.*}} byte(s) in {{.*}} object(s) allocated from:13LEAK_DURING: INFO: to ignore leaks on libFuzzer side use -detect_leaks=014LEAK_DURING: Test unit written to ./leak-15LEAK_DURING-NOT: DONE16LEAK_DURING-NOT: Done17 18// Verify leaking input was not added to corpus19RUN: %run %t-LeakTest -runs=0 %t-corpus20 21RUN: not %run %t-LeakTest -runs=0 -detect_leaks=1 %S 2>&1 | FileCheck %s --check-prefix=LEAK_IN_CORPUS22LEAK_IN_CORPUS: ERROR: LeakSanitizer: detected memory leaks23LEAK_IN_CORPUS: INFO: a leak has been found in the initial corpus.24 25RUN: not %run %t-LeakTest -runs=100000000 %S/hi.txt 2>&1 | FileCheck %s --check-prefix=MULTI_RUN_LEAK26MULTI_RUN_LEAK-NOT: pulse27MULTI_RUN_LEAK: LeakSanitizer: detected memory leaks28 29RUN: not %run %t-LeakTest -runs=100000 -detect_leaks=0 2>&1 | FileCheck %s --check-prefix=LEAK_AFTER30RUN: not %run %t-LeakTest -runs=100000 2>&1 | FileCheck %s --check-prefix=LEAK_DURING31RUN: not %run %t-ThreadedLeakTest -runs=100000 -detect_leaks=0 2>&1 | FileCheck %s --check-prefix=LEAK_AFTER32RUN: not %run %t-ThreadedLeakTest -runs=100000 2>&1 | FileCheck %s --check-prefix=LEAK_DURING33LEAK_AFTER: Done 100000 runs in34LEAK_AFTER: ERROR: LeakSanitizer: detected memory leaks35 36RUN: not %run %t-LeakTest -runs=100000 -max_len=1 2>&1 | FileCheck %s --check-prefix=MAX_LEN_137MAX_LEN_1: Test unit written to ./leak-7cf184f4c67ad58283ecb19349720b0cae75682938 39RUN: not %run %t-LeakTimeoutTest -timeout=1 2>&1 | FileCheck %s --check-prefix=LEAK_TIMEOUT40LEAK_TIMEOUT: ERROR: libFuzzer: timeout after41LEAK_TIMEOUT-NOT: LeakSanitizer42 43 44RUN: %run %t-LeakTest -error_exitcode=045