BUILD 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  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. # TODO(https://github.com/carbon-language/carbon-lang/issues/266):
  5. # Migrate bison/flex usage to a more hermetic bazel build.
  6. load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library")
  7. load("//bazel/testing:golden_test.bzl", "golden_test")
  8. load("test_list.bzl", "TEST_LIST")
  9. cc_binary(
  10. name = "executable_semantics",
  11. srcs = ["main.cpp"],
  12. deps = [
  13. "//executable_semantics/common:tracing_flag",
  14. "//executable_semantics/syntax",
  15. "@llvm-project//llvm:Support",
  16. ],
  17. )
  18. [golden_test(
  19. name = "%s_test" % e,
  20. cmd = "'$(location executable_semantics) $(location testdata/%s.carbon)'" % e,
  21. data = [
  22. ":executable_semantics",
  23. "testdata/%s.carbon" % e,
  24. ],
  25. env = {
  26. # TODO(#580): Remove this when leaks are fixed.
  27. "ASAN_OPTIONS": "detect_leaks=0",
  28. },
  29. golden = "testdata/%s.golden" % e,
  30. ) for e in TEST_LIST]
  31. # Convenience suite for running golden tests.
  32. test_suite(
  33. name = "golden_tests",
  34. tests = [":%s_test" % e for e in TEST_LIST],
  35. )
  36. # Test --trace by expecting golden output to be a *subset* of trace output. Note
  37. # the normal test must be used to update golden files.
  38. [golden_test(
  39. name = "%s_trace_test" % e,
  40. cmd = "'$(location executable_semantics) --trace " +
  41. "$(location testdata/%s.carbon)'" % e,
  42. data = [
  43. ":executable_semantics",
  44. "testdata/%s.carbon" % e,
  45. ],
  46. env = {
  47. # TODO(#580): Remove this when leaks are fixed.
  48. "ASAN_OPTIONS": "detect_leaks=0",
  49. },
  50. golden = "testdata/%s.golden" % e,
  51. golden_is_subset = True,
  52. ) for e in TEST_LIST]
  53. # Convenience suite for running trace tests.
  54. test_suite(
  55. name = "trace_tests",
  56. tests = [":%s_trace_test" % e for e in TEST_LIST],
  57. )