BUILD 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  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("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library", "cc_test")
  5. load("//testing/fuzzing:rules.bzl", "cc_fuzz_test")
  6. cc_library(
  7. name = "ast_to_proto_lib",
  8. testonly = 1,
  9. srcs = ["ast_to_proto.cpp"],
  10. hdrs = ["ast_to_proto.h"],
  11. # Running clang-tidy is slow, and explorer is currently feature frozen, so
  12. # don't spend time linting it.
  13. tags = ["no-clang-tidy"],
  14. deps = [
  15. "//explorer/ast",
  16. "//testing/fuzzing:carbon_cc_proto",
  17. "@llvm-project//llvm:Support",
  18. ],
  19. )
  20. cc_binary(
  21. name = "ast_to_proto",
  22. testonly = 1,
  23. srcs = ["ast_to_proto_main.cpp"],
  24. # Running clang-tidy is slow, and explorer is currently feature frozen, so
  25. # don't spend time linting it.
  26. tags = ["no-clang-tidy"],
  27. deps = [
  28. ":ast_to_proto_lib",
  29. "//common:bazel_working_dir",
  30. "//common:error",
  31. "//explorer/ast",
  32. "//explorer/base:arena",
  33. "//explorer/syntax",
  34. "//testing/fuzzing:carbon_cc_proto",
  35. "@com_google_protobuf//:protobuf_headers",
  36. ],
  37. )
  38. cc_test(
  39. name = "ast_to_proto_test",
  40. size = "small",
  41. srcs = ["ast_to_proto_test.cpp"],
  42. args = [
  43. "$(locations //explorer:standard_libraries)",
  44. "$(locations //explorer:carbon_files)",
  45. ],
  46. data = [
  47. "//explorer:carbon_files",
  48. "//explorer:standard_libraries",
  49. ],
  50. # Running clang-tidy is slow, and explorer is currently feature frozen, so
  51. # don't spend time linting it.
  52. tags = ["no-clang-tidy"],
  53. deps = [
  54. ":ast_to_proto_lib",
  55. "//explorer/syntax",
  56. "//testing/base:test_raw_ostream",
  57. "//testing/fuzzing:carbon_cc_proto",
  58. "//testing/fuzzing:proto_to_carbon_lib",
  59. "@com_google_googletest//:gtest",
  60. "@com_google_protobuf//:protobuf_headers",
  61. ],
  62. )
  63. cc_library(
  64. name = "fuzzer_util",
  65. testonly = 1,
  66. srcs = ["fuzzer_util.cpp"],
  67. hdrs = ["fuzzer_util.h"],
  68. # Running clang-tidy is slow, and explorer is currently feature frozen, so
  69. # don't spend time linting it.
  70. tags = ["no-clang-tidy"],
  71. deps = [
  72. "//common:check",
  73. "//common:error",
  74. "//explorer/ast",
  75. "//explorer/parse_and_execute",
  76. "//testing/fuzzing:carbon_cc_proto",
  77. "//testing/fuzzing:proto_to_carbon_lib",
  78. "@bazel_tools//tools/cpp/runfiles",
  79. "@com_google_protobuf//:protobuf_headers",
  80. "@llvm-project//llvm:Support",
  81. ],
  82. )
  83. cc_test(
  84. name = "fuzzer_util_test",
  85. size = "small",
  86. srcs = ["fuzzer_util_test.cpp"],
  87. data = [
  88. "//explorer:standard_libraries",
  89. ],
  90. # Running clang-tidy is slow, and explorer is currently feature frozen, so
  91. # don't spend time linting it.
  92. tags = ["no-clang-tidy"],
  93. deps = [
  94. ":fuzzer_util",
  95. "//testing/base:gtest_main",
  96. "//testing/fuzzing:proto_to_carbon_lib",
  97. "@com_google_googletest//:gtest",
  98. "@com_google_protobuf//:protobuf_headers",
  99. "@llvm-project//llvm:Support",
  100. ],
  101. )
  102. cc_fuzz_test(
  103. name = "explorer_fuzzer",
  104. size = "small",
  105. srcs = ["explorer_fuzzer.cpp"],
  106. corpus = glob(["fuzzer_corpus/*"]),
  107. shard_count = 8,
  108. tags = [
  109. "no-clang-tidy",
  110. "proto-fuzzer",
  111. ],
  112. deps = [
  113. ":fuzzer_util",
  114. "//common:error",
  115. "@com_google_libprotobuf_mutator//:libprotobuf_mutator",
  116. "@llvm-project//llvm:Support",
  117. ],
  118. )