annotate compiler-rt/test/fuzzer/only-some-bytes.test @ 266:00f31e85ec16 default tip

Added tag current for changeset 31d058e83c98
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Sat, 14 Oct 2023 10:13:55 +0900
parents 5f17cb93ff66
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
150
anatofuz
parents:
diff changeset
1 # Tests the data flow tracer.
anatofuz
parents:
diff changeset
2 REQUIRES: linux, x86_64
anatofuz
parents:
diff changeset
3
223
5f17cb93ff66 LLVM13 (2021/7/18)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 221
diff changeset
4 # Disabling due to dfs$ prefix to .dfsan suffix change in DFSan.
5f17cb93ff66 LLVM13 (2021/7/18)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 221
diff changeset
5 # TODO(kcc): re-enable.
5f17cb93ff66 LLVM13 (2021/7/18)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 221
diff changeset
6 RUN: false
5f17cb93ff66 LLVM13 (2021/7/18)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 221
diff changeset
7 XFAIL: *
5f17cb93ff66 LLVM13 (2021/7/18)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 221
diff changeset
8
150
anatofuz
parents:
diff changeset
9 # Build the tracer and the test.
223
5f17cb93ff66 LLVM13 (2021/7/18)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 221
diff changeset
10 DISABLED: %no_fuzzer_cpp_compiler -c -fno-sanitize=all -fsanitize=dataflow %S/../../lib/fuzzer/dataflow/DataFlow.cpp -o %t-DataFlow.o
5f17cb93ff66 LLVM13 (2021/7/18)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 221
diff changeset
11 DISABLED: %no_fuzzer_cpp_compiler -c -fno-sanitize=all -fPIC %S/../../lib/fuzzer/dataflow/DataFlowCallbacks.cpp -o %t-DataFlowCallbacks.o
5f17cb93ff66 LLVM13 (2021/7/18)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 221
diff changeset
12 DISABLED: %no_fuzzer_cpp_compiler -fno-sanitize=all -fsanitize=dataflow -fsanitize-coverage=trace-pc-guard,pc-table,bb,trace-cmp %S/OnlySomeBytesTest.cpp %t-DataFlow*.o -o %t-DFT
5f17cb93ff66 LLVM13 (2021/7/18)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 221
diff changeset
13 DISABLED: %cpp_compiler %S/OnlySomeBytesTest.cpp -o %t-Fuzz
150
anatofuz
parents:
diff changeset
14
anatofuz
parents:
diff changeset
15 # Prepare the inputs.
223
5f17cb93ff66 LLVM13 (2021/7/18)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 221
diff changeset
16 DISABLED: rm -rf %t/*
5f17cb93ff66 LLVM13 (2021/7/18)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 221
diff changeset
17 DISABLED: mkdir -p %t/IN
5f17cb93ff66 LLVM13 (2021/7/18)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 221
diff changeset
18 DISABLED: echo -n 0123456789012345678901234567890123456789012345678901234567891234 > %t/IN/6
5f17cb93ff66 LLVM13 (2021/7/18)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 221
diff changeset
19 DISABLED: cat %t/IN/6 %t/IN/6 %t/IN/6 %t/IN/6 > %t/IN/8
5f17cb93ff66 LLVM13 (2021/7/18)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 221
diff changeset
20 DISABLED: cat %t/IN/8 %t/IN/8 %t/IN/8 %t/IN/8 > %t/IN/10
5f17cb93ff66 LLVM13 (2021/7/18)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 221
diff changeset
21 DISABLED: cat %t/IN/10 %t/IN/10 %t/IN/10 %t/IN/10 > %t/IN/12
150
anatofuz
parents:
diff changeset
22 # %t/IN/12 is 4096 bytes-long.
anatofuz
parents:
diff changeset
23
223
5f17cb93ff66 LLVM13 (2021/7/18)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 221
diff changeset
24 DISABLED: %t-Fuzz -focus_function='fB(unsigned char const*)' -runs=0 %t/IN 2>&1 | FileCheck %s --check-prefix=FOCUS_fB
150
anatofuz
parents:
diff changeset
25 FOCUS_fB: Focus function is set to 'fB(unsigned char const*)'
anatofuz
parents:
diff changeset
26
223
5f17cb93ff66 LLVM13 (2021/7/18)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 221
diff changeset
27 DISABLED: %t-Fuzz -focus_function=f0 -runs=0 %t/IN 2>&1 | FileCheck %s --check-prefix=NO_FOCUSED_INPUT
150
anatofuz
parents:
diff changeset
28 NO_FOCUSED_INPUT: Focus function is set to 'f0'
anatofuz
parents:
diff changeset
29 NO_FOCUSED_INPUT: INFO: 0/2 inputs touch the focus function
anatofuz
parents:
diff changeset
30
223
5f17cb93ff66 LLVM13 (2021/7/18)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 221
diff changeset
31 DISABLED: (echo -n ABC; cat %t/IN/12) > %t/IN/ABC
5f17cb93ff66 LLVM13 (2021/7/18)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 221
diff changeset
32 DISABLED: %t-Fuzz -focus_function=f0 -runs=0 %t/IN 2>&1 | FileCheck %s --check-prefix=ONE_FOCUSED_INPUT
150
anatofuz
parents:
diff changeset
33 ONE_FOCUSED_INPUT: INFO: 1/3 inputs touch the focus function
anatofuz
parents:
diff changeset
34
223
5f17cb93ff66 LLVM13 (2021/7/18)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 221
diff changeset
35 DISABLED: rm -rf %t/IN_DFT
5f17cb93ff66 LLVM13 (2021/7/18)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 221
diff changeset
36 DISABLED: %t-Fuzz -collect_data_flow=%t-DFT %t/IN -data_flow_trace=%t/IN_DFT > /dev/null 2>&1
150
anatofuz
parents:
diff changeset
37
anatofuz
parents:
diff changeset
38 # Repeat twice to make sure that the inputs with DFT are not removed from the corpus.
223
5f17cb93ff66 LLVM13 (2021/7/18)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 221
diff changeset
39 DISABLED: %t-Fuzz -focus_function=f0 -data_flow_trace=%t/IN_DFT -runs=100 %t/IN 2>&1 | FileCheck %s --check-prefix=HAVE_DFT
5f17cb93ff66 LLVM13 (2021/7/18)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 221
diff changeset
40 DISABLED: %t-Fuzz -focus_function=f0 -data_flow_trace=%t/IN_DFT -runs=100 %t/IN 2>&1 | FileCheck %s --check-prefix=HAVE_DFT
150
anatofuz
parents:
diff changeset
41 HAVE_DFT: INFO: 1/{{.*}} inputs have the Data Flow Trace
anatofuz
parents:
diff changeset
42
anatofuz
parents:
diff changeset
43 # Collect DFT, then use it.
223
5f17cb93ff66 LLVM13 (2021/7/18)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 221
diff changeset
44 DISABLED: rm -rf %t/C %t/C1 && mkdir %t/C %t/C1 && cp %t/IN/* %t/C
5f17cb93ff66 LLVM13 (2021/7/18)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 221
diff changeset
45 DISABLED: rm -rf %t/C_DFT && %t-Fuzz -collect_data_flow=%t-DFT %t/C -data_flow_trace=%t/C_DFT > /dev/null 2>&1
5f17cb93ff66 LLVM13 (2021/7/18)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 221
diff changeset
46 DISABLED: not %t-Fuzz -focus_function=f0 -data_flow_trace=%t/C_DFT -seed=1 -runs=1000000 -use_value_profile=1 %t/C1 %t/C 2> %t/log
5f17cb93ff66 LLVM13 (2021/7/18)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 221
diff changeset
47 DISABLED: grep BINGO %t/log
150
anatofuz
parents:
diff changeset
48
anatofuz
parents:
diff changeset
49 # Test -focus_function=auto: run 100 times and verify that
anatofuz
parents:
diff changeset
50 # * 'f0' is the most frequent focus function.
anatofuz
parents:
diff changeset
51 # * the second most frequent is one of fA/fB/fC in a de-mangled form.
223
5f17cb93ff66 LLVM13 (2021/7/18)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 221
diff changeset
52 DISABLED: %t-Fuzz -focus_function=auto -data_flow_trace=%t/C_DFT -runs=0 %t/C -jobs=100 2>&1 | grep AUTOFOCUS | sort | uniq -c | sort -g -r | head -n 2 | FileCheck %s --check-prefix=AUTOFOCUS
150
anatofuz
parents:
diff changeset
53 AUTOFOCUS: INFO: AUTOFOCUS: {{.*}} f0
anatofuz
parents:
diff changeset
54 AUTOFOCUS: INFO: AUTOFOCUS: {{.*f[ABC]}}(unsigned char const*)
anatofuz
parents:
diff changeset
55
anatofuz
parents:
diff changeset
56 # Actually execute 50 fuzzing processes with a small number of runs, to test -focus_function=auto for real.
anatofuz
parents:
diff changeset
57 # We can not test data_flow_trace=auto in just a single run, because it may choose to focus on a wrong function.
223
5f17cb93ff66 LLVM13 (2021/7/18)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 221
diff changeset
58 DISABLED: not %t-Fuzz -focus_function=auto -data_flow_trace=%t/C_DFT %t/C -jobs=50 -runs=200000 -use_value_profile=1 2> %t/log
5f17cb93ff66 LLVM13 (2021/7/18)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 221
diff changeset
59 DISABLED: grep BINGO %t/log