BUILD 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  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/cc_rules:defs.bzl", "cc_library", "cc_test")
  5. load("rules.bzl", "file_test")
  6. package(default_visibility = ["//visibility:public"])
  7. cc_library(
  8. name = "autoupdate",
  9. testonly = 1,
  10. srcs = ["autoupdate.cpp"],
  11. hdrs = [
  12. "autoupdate.h",
  13. "line.h",
  14. ],
  15. deps = [
  16. "//common:check",
  17. "//common:ostream",
  18. "//common:raw_string_ostream",
  19. "//testing/base:file_helpers",
  20. "@abseil-cpp//absl/strings",
  21. "@abseil-cpp//absl/strings:string_view",
  22. "@llvm-project//llvm:Support",
  23. "@re2",
  24. ],
  25. )
  26. cc_library(
  27. name = "file_test_base",
  28. testonly = 1,
  29. srcs = [
  30. "file_test_base.cpp",
  31. "run_test.cpp",
  32. "run_test.h",
  33. "test_file.cpp",
  34. ],
  35. hdrs = [
  36. "file_test_base.h",
  37. "test_file.h",
  38. ],
  39. deps = [
  40. ":autoupdate",
  41. ":manifest",
  42. "//common:build_data",
  43. "//common:check",
  44. "//common:error",
  45. "//common:exe_path",
  46. "//common:find",
  47. "//common:init_llvm",
  48. "//common:ostream",
  49. "//common:pretty_stack_trace_function",
  50. "//common:raw_string_ostream",
  51. "//common:set",
  52. "//testing/base:file_helpers",
  53. "//testing/base:unified_diff_matcher",
  54. "@abseil-cpp//absl/flags:flag",
  55. "@abseil-cpp//absl/flags:parse",
  56. "@abseil-cpp//absl/strings",
  57. "@googletest//:gtest",
  58. "@llvm-project//llvm:Support",
  59. ],
  60. )
  61. cc_test(
  62. name = "test_file_test",
  63. size = "small",
  64. srcs = ["test_file_test.cpp"],
  65. deps = [
  66. ":file_test_base",
  67. ":manifest_impl",
  68. "//common:error_test_helpers",
  69. "//testing/base:file_helpers",
  70. "@googletest//:gtest",
  71. ],
  72. )
  73. file_test(
  74. name = "file_test_base_test",
  75. size = "small",
  76. srcs = ["file_test_base_test.cpp"],
  77. data = glob(["testdata/include_files/**"]),
  78. tests = glob(
  79. ["testdata/**"],
  80. exclude = ["testdata/include_files/**"],
  81. ),
  82. deps = [
  83. ":file_test_base",
  84. "//common:ostream",
  85. "@googletest//:gtest",
  86. "@llvm-project//llvm:Support",
  87. ],
  88. )
  89. # Note this is separate from the implementation; see the .h file.
  90. cc_library(
  91. name = "manifest",
  92. testonly = 1,
  93. hdrs = ["manifest.h"],
  94. deps = ["@llvm-project//llvm:Support"],
  95. )
  96. # Used through `file_test` in rules.bzl.
  97. cc_library(
  98. name = "manifest_impl",
  99. testonly = 1,
  100. srcs = ["manifest.cpp"],
  101. deps = [":manifest"],
  102. )