BUILD 3.3 KB

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