BUILD 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. # Part of the Carbon Language project, under the Apache License v2.0 with LLVM
  2. # Exceptions. See /LICENSE for license information.
  3. # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  4. load("//testing/fuzzing:rules.bzl", "cc_fuzz_test")
  5. cc_library(
  6. name = "ast_to_proto_lib",
  7. testonly = 1,
  8. srcs = ["ast_to_proto.cpp"],
  9. hdrs = ["ast_to_proto.h"],
  10. deps = [
  11. "//explorer/ast",
  12. "//testing/fuzzing:carbon_cc_proto",
  13. "@llvm-project//llvm:Support",
  14. ],
  15. )
  16. cc_binary(
  17. name = "ast_to_proto",
  18. testonly = 1,
  19. srcs = ["ast_to_proto_main.cpp"],
  20. deps = [
  21. ":ast_to_proto_lib",
  22. "//common:bazel_working_dir",
  23. "//common:error",
  24. "//explorer/ast",
  25. "//explorer/base:arena",
  26. "//explorer/syntax",
  27. "//testing/fuzzing:carbon_cc_proto",
  28. "@com_google_protobuf//:protobuf_headers",
  29. ],
  30. )
  31. cc_test(
  32. name = "ast_to_proto_test",
  33. srcs = ["ast_to_proto_test.cpp"],
  34. args = [
  35. "$(locations //explorer:standard_libraries)",
  36. "$(locations //explorer:carbon_files)",
  37. ],
  38. data = [
  39. "//explorer:carbon_files",
  40. "//explorer:standard_libraries",
  41. ],
  42. deps = [
  43. ":ast_to_proto_lib",
  44. "//explorer/syntax",
  45. "//testing/base:test_raw_ostream",
  46. "//testing/fuzzing:carbon_cc_proto",
  47. "//testing/fuzzing:proto_to_carbon_lib",
  48. "@com_google_googletest//:gtest",
  49. "@com_google_protobuf//:protobuf_headers",
  50. ],
  51. )
  52. cc_library(
  53. name = "fuzzer_util",
  54. testonly = 1,
  55. srcs = ["fuzzer_util.cpp"],
  56. hdrs = ["fuzzer_util.h"],
  57. deps = [
  58. "//common:check",
  59. "//common:error",
  60. "//explorer/ast",
  61. "//explorer/parse_and_execute",
  62. "//testing/fuzzing:carbon_cc_proto",
  63. "//testing/fuzzing:proto_to_carbon_lib",
  64. "@bazel_tools//tools/cpp/runfiles",
  65. "@com_google_protobuf//:protobuf_headers",
  66. "@llvm-project//llvm:Support",
  67. ],
  68. )
  69. cc_test(
  70. name = "fuzzer_util_test",
  71. srcs = ["fuzzer_util_test.cpp"],
  72. data = [
  73. "//explorer:standard_libraries",
  74. ],
  75. deps = [
  76. ":fuzzer_util",
  77. "//testing/base:gtest_main",
  78. "//testing/fuzzing:proto_to_carbon_lib",
  79. "@com_google_googletest//:gtest",
  80. "@com_google_protobuf//:protobuf_headers",
  81. "@llvm-project//llvm:Support",
  82. ],
  83. )
  84. cc_fuzz_test(
  85. name = "explorer_fuzzer",
  86. size = "small",
  87. srcs = ["explorer_fuzzer.cpp"],
  88. corpus = glob(["fuzzer_corpus/*"]),
  89. shard_count = 8,
  90. tags = ["proto-fuzzer"],
  91. deps = [
  92. ":fuzzer_util",
  93. "//common:error",
  94. "@com_google_libprotobuf_mutator//:libprotobuf_mutator",
  95. "@llvm-project//llvm:Support",
  96. ],
  97. )