BUILD 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  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. srcs = ["ast_to_proto.cpp"],
  8. hdrs = ["ast_to_proto.h"],
  9. deps = [
  10. "//common/fuzzing:carbon_cc_proto",
  11. "//executable_semantics/ast",
  12. "//executable_semantics/ast:declaration",
  13. "//executable_semantics/ast:expression",
  14. "@llvm-project//llvm:Support",
  15. ],
  16. )
  17. cc_library(
  18. name = "fuzzer_util",
  19. srcs = ["fuzzer_util.cpp"],
  20. hdrs = ["fuzzer_util.h"],
  21. deps = [
  22. "//common:check",
  23. "//common/fuzzing:carbon_cc_proto",
  24. "//common/fuzzing:proto_to_carbon_lib",
  25. "@llvm-project//llvm:Support",
  26. ],
  27. )
  28. cc_test(
  29. name = "ast_to_proto_test",
  30. srcs = ["ast_to_proto_test.cpp"],
  31. args = [
  32. "$(locations //executable_semantics:standard_libraries)",
  33. "$(locations //executable_semantics/testdata:carbon_files)",
  34. ],
  35. data = [
  36. "//executable_semantics:standard_libraries",
  37. "//executable_semantics/testdata:carbon_files",
  38. ],
  39. deps = [
  40. ":ast_to_proto_lib",
  41. "//common/fuzzing:carbon_cc_proto",
  42. "//executable_semantics/syntax",
  43. "@com_google_googletest//:gtest",
  44. "@com_google_protobuf//:protobuf_headers",
  45. "@llvm-project//llvm:Support",
  46. ],
  47. )
  48. cc_binary(
  49. name = "fuzzverter",
  50. srcs = ["fuzzverter.cpp"],
  51. deps = [
  52. ":ast_to_proto_lib",
  53. ":fuzzer_util",
  54. "//common:error",
  55. "//common/fuzzing:carbon_cc_proto",
  56. "//executable_semantics/common:error",
  57. "//executable_semantics/common:nonnull",
  58. "//executable_semantics/syntax",
  59. "@com_google_protobuf//:protobuf_headers",
  60. "@llvm-project//llvm:Support",
  61. ],
  62. )
  63. cc_test(
  64. name = "proto_to_carbon_test",
  65. srcs = ["proto_to_carbon_test.cpp"],
  66. args = [
  67. "$(locations //executable_semantics:standard_libraries)",
  68. "$(locations //executable_semantics/testdata:carbon_files)",
  69. ],
  70. data = [
  71. "//executable_semantics:standard_libraries",
  72. "//executable_semantics/testdata:carbon_files",
  73. ],
  74. deps = [
  75. ":ast_to_proto_lib",
  76. "//common/fuzzing:carbon_cc_proto",
  77. "//common/fuzzing:proto_to_carbon_lib",
  78. "//executable_semantics/syntax",
  79. "@com_google_googletest//:gtest",
  80. "@com_google_protobuf//:protobuf_headers",
  81. "@llvm-project//llvm:Support",
  82. ],
  83. )
  84. # Needs `--config=proto-fuzzer` for `bazel build` / `bazel test`.
  85. cc_fuzz_test(
  86. name = "executable_semantics_fuzzer",
  87. size = "small",
  88. srcs = ["executable_semantics_fuzzer.cpp"],
  89. corpus = glob(["fuzzer_corpus/**"]),
  90. tags = ["manual"],
  91. deps = [
  92. ":fuzzer_util",
  93. "//common/fuzzing:carbon_cc_proto",
  94. "//executable_semantics/interpreter:exec_program",
  95. "//executable_semantics/syntax",
  96. "//executable_semantics/syntax:prelude",
  97. "@com_google_libprotobuf_mutator//:libprotobuf_mutator",
  98. "@com_google_protobuf//:protobuf_headers",
  99. "@llvm-project//llvm:Support",
  100. ],
  101. )