CMakeLists.txt 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. # Copyright 2018 Google LLC
  2. #
  3. # Licensed under the Apache License, Version 2.0 (the "License");
  4. # you may not use this file except in compliance with the License.
  5. # You may obtain a copy of the License at
  6. #
  7. # http://www.apache.org/licenses/LICENSE-2.0
  8. #
  9. # Unless required by applicable law or agreed to in writing, software
  10. # distributed under the License is distributed on an "AS IS" BASIS,
  11. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. # See the License for the specific language governing permissions and
  13. # limitations under the License.
  14. # Builds all fuzzing targets using firebase_ios_cc_fuzz_test build rule, which
  15. # copies the provided dictionary and corpus to the destination directory. A
  16. # fuzzing target that tests xyz must be called 'xyz_fuzzer'. The copied
  17. # dictionary will be called 'xyz_fuzzer.dict' and its corpus
  18. # 'xyz_fuzzer_seed_corpus'. See cc_rules.cmake for more information.
  19. if(NOT FUZZING)
  20. return()
  21. endif()
  22. # Use the fuzzing resources directory from the iOS fuzz tests.
  23. set(fuzzing_resources ${FIREBASE_SOURCE_DIR}/Firestore/Example/FuzzTests/FuzzingResources)
  24. # Serializer fuzzing target.
  25. # TODO(minafarid): Do not define a CORPUS in this target, but rather generate
  26. # the serializer corpus by converting the text protos from the serializer
  27. # corpus in the iOS FuzzingResources to binary protos. This conversion requires
  28. # the protoc binary that is not currently available.
  29. firebase_ios_cc_fuzz_test(
  30. serializer_fuzzer
  31. DICTIONARY ${fuzzing_resources}/Serializer/serializer.dictionary
  32. CORPUS ${fuzzing_resources}/Serializer/Corpus/BinaryProtos
  33. SOURCES serializer_fuzzer.cc
  34. DEPENDS firebase_firestore_remote
  35. )
  36. # FieldPath fuzzing target.
  37. firebase_ios_cc_fuzz_test(
  38. fieldpath_fuzzer
  39. DICTIONARY ${fuzzing_resources}/FieldPath/fieldpath.dictionary
  40. CORPUS ${fuzzing_resources}/FieldPath/Corpus
  41. SOURCES fieldpath_fuzzer.cc
  42. DEPENDS firebase_firestore_model
  43. )
  44. # ResourcePath fuzzing target. Use the same corpus and dict as FieldPath.
  45. firebase_ios_cc_fuzz_test(
  46. resourcepath_fuzzer
  47. DICTIONARY ${fuzzing_resources}/FieldPath/fieldpath.dictionary
  48. CORPUS ${fuzzing_resources}/FieldPath/Corpus
  49. SOURCES resourcepath_fuzzer.cc
  50. DEPENDS firebase_firestore_model
  51. )
  52. # LevelDB fuzzer.
  53. firebase_ios_cc_fuzz_test(
  54. leveldb_fuzzer
  55. DICTIONARY ${fuzzing_resources}/LevelDb/leveldb.dictionary
  56. SOURCES leveldb_fuzzer.cc
  57. DEPENDS firebase_firestore_local_persistence_leveldb
  58. )