BUILD 1.5 KB

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