BUILD 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  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. #
  5. # Trivial, single-file testing libraries. More complex libraries should get
  6. # their own directory.
  7. load("@rules_cc//cc:defs.bzl", "cc_library", "cc_test")
  8. package(default_visibility = ["//visibility:public"])
  9. # This does extra initialization on top of googletest's gtest_main in order to
  10. # provide stack traces on unexpected exits, because we normally rely on LLVM
  11. # code for that.
  12. #
  13. # This replaces "@googletest//:gtest_main";
  14. # "@googletest//:gtest" should still be used directly.
  15. cc_library(
  16. name = "gtest_main",
  17. testonly = 1,
  18. srcs = ["gtest_main.cpp"],
  19. hdrs = ["gtest_main.h"],
  20. deps = [
  21. "//common:check",
  22. "//common:exe_path",
  23. "//common:init_llvm",
  24. "@googletest//:gtest",
  25. "@llvm-project//llvm:Support",
  26. ],
  27. )
  28. cc_test(
  29. name = "gtest_main_test",
  30. size = "small",
  31. srcs = ["gtest_main_test.cpp"],
  32. deps = [
  33. ":gtest_main",
  34. "@googletest//:gtest",
  35. "@llvm-project//llvm:Support",
  36. ],
  37. )
  38. cc_library(
  39. name = "test_raw_ostream",
  40. testonly = 1,
  41. hdrs = ["test_raw_ostream.h"],
  42. deps = [
  43. "//common:ostream",
  44. "@googletest//:gtest",
  45. "@llvm-project//llvm:Support",
  46. ],
  47. )
  48. cc_test(
  49. name = "test_raw_ostream_test",
  50. size = "small",
  51. srcs = ["test_raw_ostream_test.cpp"],
  52. deps = [
  53. ":test_raw_ostream",
  54. "//testing/base:gtest_main",
  55. "@googletest//:gtest",
  56. ],
  57. )