BUILD.gn 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. # Copyright 2015 The Chromium Authors. All rights reserved.
  2. # Use of this source code is governed by a BSD-style license that can be
  3. # found in the LICENSE file.
  4. # LibFuzzer is a LLVM tool for coverage-guided fuzz testing.
  5. # See http://www.chromium.org/developers/testing/libfuzzer
  6. #
  7. # To enable libfuzzer, 'use_libfuzzer' GN option should be set to true.
  8. # Or to enable afl, 'use_afl' GN option should be set to true.
  9. import("//build/config/features.gni")
  10. import("//build/config/sanitizers/sanitizers.gni")
  11. # TODO(mmoroz): we should eventually rename this into "fuzzing_engine_main".
  12. source_set("libfuzzer_main") {
  13. deps = []
  14. sources = []
  15. if (use_libfuzzer) {
  16. deps += [ "//third_party/libFuzzer:libfuzzer" ]
  17. if (is_ios) {
  18. deps += [ "//testing/libfuzzer/fuzzer_support_ios:libfuzzer_main_ios" ]
  19. }
  20. } else if (use_afl) {
  21. deps += [ "//third_party/libFuzzer:afl_driver" ]
  22. } else {
  23. sources += [ "unittest_main.cc" ]
  24. }
  25. if (use_clang_coverage) {
  26. # For purposes of code coverage calculation, fuzzer targets are run through
  27. # a wrapper script in this directory, which handles corpus retrieval and
  28. # appropriate parameter passing to run the target in an isolate. This
  29. # directive makes this script and its dependencies to be included in the
  30. # target's isolate.
  31. data = [ "//tools/code_coverage/" ]
  32. }
  33. }
  34. # A config used by all fuzzer_tests.
  35. config("fuzzer_test_config") {
  36. if (use_libfuzzer && is_mac) {
  37. ldflags = [
  38. "-Wl,-U,_LLVMFuzzerCustomMutator",
  39. "-Wl,-U,_LLVMFuzzerInitialize",
  40. ]
  41. }
  42. }
  43. # Noop config used to tag fuzzer tests excluded from clusterfuzz.
  44. # Libfuzzer build bot uses this to filter out targets while
  45. # building an archive for clusterfuzz.
  46. config("no_clusterfuzz") {
  47. }
  48. # Since most iOS code doesn't compile in other platforms, and not all fuzzers
  49. # compile in iOS, a clusterfuzz job is set up to run only selected iOS fuzzers.
  50. # This is a noop config to tag fuzzer tests to be built for the job. iOS
  51. # Libfuzzer build bot uses this to filter targets while building an archive for
  52. # the job.
  53. config("build_for_ios_clusterfuzz_job") {
  54. }
  55. # noop to tag seed corpus rules.
  56. source_set("seed_corpus") {
  57. }
  58. if (use_fuzzing_engine) {
  59. pool("fuzzer_owners_pool") {
  60. depth = 1
  61. }
  62. }