BUILD 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  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/testing:golden_test.bzl", "golden_test")
  5. load("test_list.bzl", "TEST_LIST")
  6. cc_binary(
  7. name = "executable_semantics",
  8. srcs = ["main.cpp"],
  9. deps = [
  10. "//executable_semantics/common:tracing_flag",
  11. "//executable_semantics/syntax",
  12. "@llvm-project//llvm:Support",
  13. ],
  14. )
  15. [golden_test(
  16. name = "%s_test" % e,
  17. cmd = "'$(location executable_semantics) $(location testdata/%s.carbon)'" % e,
  18. data = [
  19. ":executable_semantics",
  20. "testdata/%s.carbon" % e,
  21. ],
  22. golden = "testdata/%s.golden" % e,
  23. ) for e in TEST_LIST]
  24. # Convenience suite for running golden tests.
  25. test_suite(
  26. name = "golden_tests",
  27. tests = [":%s_test" % e for e in TEST_LIST],
  28. )
  29. # Test --trace by expecting golden output to be a *subset* of trace output. Note
  30. # the normal test must be used to update golden files.
  31. [golden_test(
  32. name = "%s_trace_test" % e,
  33. cmd = "'$(location executable_semantics) --trace " +
  34. "$(location testdata/%s.carbon)'" % e,
  35. data = [
  36. ":executable_semantics",
  37. "testdata/%s.carbon" % e,
  38. ],
  39. golden = "testdata/%s.golden" % e,
  40. golden_is_subset = True,
  41. ) for e in TEST_LIST]
  42. # Convenience suite for running trace tests.
  43. test_suite(
  44. name = "trace_tests",
  45. tests = [":%s_trace_test" % e for e in TEST_LIST],
  46. )