|
12 | 12 | # See the License for the specific language governing permissions and |
13 | 13 | # limitations under the License. |
14 | 14 |
|
15 | | -# Builds all fuzzing targets using firebase_ios_cc_fuzz_test build rule, which |
| 15 | +# Builds all fuzzing targets using firebase_ios_add_fuzz_test build rule, which |
16 | 16 | # copies the provided dictionary and corpus to the destination directory. A |
17 | | -# fuzzing target that tests xyz must be called 'xyz_fuzzer'. The copied |
18 | | -# dictionary will be called 'xyz_fuzzer.dict' and its corpus |
19 | | -# 'xyz_fuzzer_seed_corpus'. See cc_rules.cmake for more information. |
| 17 | +# fuzzing target that tests xyz must be called 'firestore_xyz_fuzzer'. The copied |
| 18 | +# dictionary will be called 'firestore_xyz_fuzzer.dict' and its corpus |
| 19 | +# 'firestore_xyz_fuzzer_seed_corpus'. See cc_rules.cmake for more information. |
20 | 20 |
|
21 | 21 | if(NOT FUZZING) |
22 | 22 | return() |
23 | 23 | endif() |
24 | 24 |
|
| 25 | +# Finds the fuzzer library that is either provided by OSS Fuzz or libFuzzer that |
| 26 | +# is manually built from sources. |
| 27 | +find_package(Fuzzer REQUIRED) |
| 28 | + |
25 | 29 | # Use the fuzzing resources directory from the iOS fuzz tests. |
26 | | -set(fuzzing_resources ${FIREBASE_SOURCE_DIR}/Firestore/Example/FuzzTests/FuzzingResources) |
| 30 | +set( |
| 31 | + fuzzing_resources |
| 32 | + ${FIREBASE_SOURCE_DIR}/Firestore/Example/FuzzTests/FuzzingResources |
| 33 | +) |
| 34 | + |
| 35 | +link_libraries(firestore_core) |
| 36 | + |
27 | 37 |
|
28 | 38 | # Serializer fuzzing target. |
29 | 39 | # TODO(minafarid): Do not define a CORPUS in this target, but rather generate |
30 | 40 | # the serializer corpus by converting the text protos from the serializer |
31 | 41 | # corpus in the iOS FuzzingResources to binary protos. This conversion requires |
32 | 42 | # the protoc binary that is not currently available. |
33 | | -firebase_ios_cc_fuzz_test( |
34 | | - serializer_fuzzer |
| 43 | +firebase_ios_add_fuzz_test( |
| 44 | + firestore_serializer_fuzzer |
35 | 45 | DICTIONARY ${fuzzing_resources}/Serializer/serializer.dictionary |
36 | 46 | CORPUS ${fuzzing_resources}/Serializer/Corpus/BinaryProtos |
37 | | - SOURCES serializer_fuzzer.cc |
38 | | - DEPENDS firebase_firestore_remote |
| 47 | + serializer_fuzzer.cc |
39 | 48 | ) |
40 | 49 |
|
41 | | - |
42 | 50 | # FieldPath fuzzing target. |
43 | | -firebase_ios_cc_fuzz_test( |
44 | | - fieldpath_fuzzer |
| 51 | +firebase_ios_add_fuzz_test( |
| 52 | + firestore_fieldpath_fuzzer |
45 | 53 | DICTIONARY ${fuzzing_resources}/FieldPath/fieldpath.dictionary |
46 | 54 | CORPUS ${fuzzing_resources}/FieldPath/Corpus |
47 | | - SOURCES fieldpath_fuzzer.cc |
48 | | - DEPENDS firebase_firestore_model |
| 55 | + fieldpath_fuzzer.cc |
49 | 56 | ) |
50 | 57 |
|
51 | 58 | # ResourcePath fuzzing target. Use the same corpus and dict as FieldPath. |
52 | | -firebase_ios_cc_fuzz_test( |
53 | | - resourcepath_fuzzer |
| 59 | +firebase_ios_add_fuzz_test( |
| 60 | + firestore_resourcepath_fuzzer |
54 | 61 | DICTIONARY ${fuzzing_resources}/FieldPath/fieldpath.dictionary |
55 | 62 | CORPUS ${fuzzing_resources}/FieldPath/Corpus |
56 | | - SOURCES resourcepath_fuzzer.cc |
57 | | - DEPENDS firebase_firestore_model |
| 63 | + resourcepath_fuzzer.cc |
58 | 64 | ) |
59 | 65 |
|
60 | 66 | # LevelDB fuzzer. |
61 | | -firebase_ios_cc_fuzz_test( |
62 | | - leveldb_fuzzer |
| 67 | +firebase_ios_add_fuzz_test( |
| 68 | + firestore_leveldb_fuzzer |
63 | 69 | DICTIONARY ${fuzzing_resources}/LevelDb/leveldb.dictionary |
64 | | - SOURCES leveldb_fuzzer.cc |
65 | | - DEPENDS firebase_firestore_local_persistence_leveldb |
| 70 | + leveldb_fuzzer.cc |
66 | 71 | ) |
0 commit comments