]> git.proxmox.com Git - rustc.git/blob - src/libcompiler_builtins/compiler-rt/test/fuzzer/fuzzer-leak.test
New upstream version 1.25.0+dfsg1
[rustc.git] / src / libcompiler_builtins / compiler-rt / test / fuzzer / fuzzer-leak.test
1 REQUIRES: lsan
2 RUN: %cpp_compiler %S/LeakTest.cpp -o %t-LeakTest
3 RUN: %cpp_compiler %S/ThreadedLeakTest.cpp -o %t-ThreadedLeakTest
4 RUN: %cpp_compiler %S/LeakTimeoutTest.cpp -o %t-LeakTimeoutTest
5
6 RUN: rm -rf %t-corpus && mkdir -p %t-corpus
7 RUN: not %t-LeakTest -runs=100000 -detect_leaks=1 %t-corpus 2>&1 | FileCheck %s --check-prefix=LEAK_DURING
8 LEAK_DURING: ERROR: LeakSanitizer: detected memory leaks
9 LEAK_DURING: Direct leak of 4 byte(s) in 1 object(s) allocated from:
10 LEAK_DURING: INFO: to ignore leaks on libFuzzer side use -detect_leaks=0
11 LEAK_DURING: Test unit written to ./leak-
12 LEAK_DURING-NOT: DONE
13 LEAK_DURING-NOT: Done
14
15 // Verify leaking input was not added to corpus
16 RUN: %t-LeakTest -runs=0 %t-corpus
17
18 RUN: not %t-LeakTest -runs=0 -detect_leaks=1 %S 2>&1 | FileCheck %s --check-prefix=LEAK_IN_CORPUS
19 LEAK_IN_CORPUS: ERROR: LeakSanitizer: detected memory leaks
20 LEAK_IN_CORPUS: INFO: a leak has been found in the initial corpus.
21
22 RUN: not %t-LeakTest -runs=100000000 %S/hi.txt 2>&1 | FileCheck %s --check-prefix=MULTI_RUN_LEAK
23 MULTI_RUN_LEAK-NOT: pulse
24 MULTI_RUN_LEAK: LeakSanitizer: detected memory leaks
25
26 RUN: not %t-LeakTest -runs=100000 -detect_leaks=0 2>&1 | FileCheck %s --check-prefix=LEAK_AFTER
27 RUN: not %t-LeakTest -runs=100000 2>&1 | FileCheck %s --check-prefix=LEAK_DURING
28 RUN: not %t-ThreadedLeakTest -runs=100000 -detect_leaks=0 2>&1 | FileCheck %s --check-prefix=LEAK_AFTER
29 RUN: not %t-ThreadedLeakTest -runs=100000 2>&1 | FileCheck %s --check-prefix=LEAK_DURING
30 LEAK_AFTER: Done 100000 runs in
31 LEAK_AFTER: ERROR: LeakSanitizer: detected memory leaks
32
33 RUN: not %t-LeakTest -runs=100000 -max_len=1 2>&1 | FileCheck %s --check-prefix=MAX_LEN_1
34 MAX_LEN_1: Test unit written to ./leak-7cf184f4c67ad58283ecb19349720b0cae756829
35
36 RUN: not %t-LeakTimeoutTest -timeout=1 2>&1 | FileCheck %s --check-prefix=LEAK_TIMEOUT
37 LEAK_TIMEOUT: ERROR: libFuzzer: timeout after
38 LEAK_TIMEOUT-NOT: LeakSanitizer
39
40
41 RUN: %t-LeakTest -error_exitcode=0