BUILD 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  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("//bazel/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. "//common/fuzzing:carbon_cc_proto",
  12. "//explorer/ast",
  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. "//common/fuzzing:carbon_cc_proto",
  25. "//explorer/ast",
  26. "//explorer/common:arena",
  27. "//explorer/syntax",
  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. "//common/fuzzing:carbon_cc_proto",
  45. "//common/fuzzing:proto_to_carbon_lib",
  46. "//explorer/syntax",
  47. "@com_google_googletest//:gtest",
  48. "@com_google_protobuf//:protobuf_headers",
  49. ],
  50. )
  51. cc_library(
  52. name = "fuzzer_util",
  53. testonly = 1,
  54. srcs = ["fuzzer_util.cpp"],
  55. hdrs = ["fuzzer_util.h"],
  56. deps = [
  57. "//common:check",
  58. "//common:error",
  59. "//common/fuzzing:carbon_cc_proto",
  60. "//common/fuzzing:proto_to_carbon_lib",
  61. "//explorer/ast",
  62. "//explorer/parse_and_execute",
  63. "@bazel_tools//tools/cpp/runfiles",
  64. "@com_google_protobuf//:protobuf_headers",
  65. "@llvm-project//llvm:Support",
  66. ],
  67. )
  68. cc_test(
  69. name = "fuzzer_util_test",
  70. srcs = ["fuzzer_util_test.cpp"],
  71. data = [
  72. "//explorer:standard_libraries",
  73. ],
  74. deps = [
  75. ":fuzzer_util",
  76. "//common:gtest_main",
  77. "//common/fuzzing:proto_to_carbon_lib",
  78. "@com_google_googletest//:gtest",
  79. "@com_google_protobuf//:protobuf_headers",
  80. "@llvm-project//llvm:Support",
  81. ],
  82. )
  83. cc_fuzz_test(
  84. name = "explorer_fuzzer",
  85. testonly = 1,
  86. srcs = ["explorer_fuzzer.cpp"],
  87. corpus = glob(["fuzzer_corpus/*"]),
  88. shard_count = 8,
  89. deps = [
  90. ":fuzzer_util",
  91. "//common:error",
  92. "@com_google_libprotobuf_mutator//:libprotobuf_mutator",
  93. "@llvm-project//llvm:Support",
  94. ],
  95. )