BUILD 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  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_binaries//:defs.bzl", "bazel_binaries")
  5. load(
  6. "@rules_bazel_integration_test//bazel_integration_test:defs.bzl",
  7. "bazel_integration_tests",
  8. "integration_test_utils",
  9. )
  10. load("@rules_python//python:defs.bzl", "py_binary")
  11. load("//bazel/carbon_rules:defs.bzl", "carbon_binary")
  12. carbon_binary(
  13. name = "sieve",
  14. srcs = ["sieve.carbon"],
  15. )
  16. carbon_binary(
  17. name = "hello_world",
  18. srcs = ["hello_world.carbon"],
  19. )
  20. py_binary(
  21. name = "bazel_test_runner",
  22. testonly = True,
  23. srcs = ["bazel_test_runner.py"],
  24. data = ["//toolchain/install:install_data"],
  25. deps = [
  26. "@bazel_tools//tools/python/runfiles",
  27. "@rules_bazel_integration_test//bazel_integration_test/py:test_base",
  28. ],
  29. )
  30. bazel_example_files = [
  31. "bazel/BUILD",
  32. "bazel/MODULE.bazel",
  33. "bazel/example_lib.h",
  34. "bazel/example_lib.cpp",
  35. "bazel/example.cpp",
  36. ]
  37. bazel_integration_tests(
  38. name = "bazel_min_test",
  39. bazel_binaries = bazel_binaries,
  40. bazel_versions = bazel_binaries.versions.all,
  41. # Override the default tags which assume a much more expensive test.
  42. tags = [],
  43. test_runner = ":bazel_test_runner",
  44. workspace_files = bazel_example_files,
  45. workspace_path = "bazel",
  46. )
  47. bazel_integration_tests(
  48. name = "bazel_full_test",
  49. bazel_binaries = bazel_binaries,
  50. bazel_versions = bazel_binaries.versions.all,
  51. env = {"CARBON_BAZEL_TEST_FULL": ""},
  52. # Override the default tags -- while running these manually is good as the
  53. # full tests are very expensive, there isn't a reason to run them
  54. # _exclusively_ as well.
  55. tags = ["manual"],
  56. test_runner = ":bazel_test_runner",
  57. workspace_files = bazel_example_files,
  58. workspace_path = "bazel",
  59. )
  60. # Convenience test suites with a simple names to run all the different
  61. # configured Bazel versions of tests.
  62. test_suite(
  63. name = "bazel_min_tests",
  64. tests = integration_test_utils.bazel_integration_test_names(
  65. "bazel_min_test",
  66. bazel_binaries.versions.all,
  67. ),
  68. )
  69. test_suite(
  70. name = "bazel_full_tests",
  71. # Full tests are too expensive to run by default.
  72. tags = ["manual"],
  73. tests = integration_test_utils.bazel_integration_test_names(
  74. "bazel_full_test",
  75. bazel_binaries.versions.all,
  76. ),
  77. )