BUILD 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  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. cc_binary(
  9. name = "executable_semantics",
  10. srcs = ["main.cpp"],
  11. deps = [
  12. "//executable_semantics/syntax",
  13. "@llvm-project//llvm:Support",
  14. ],
  15. )
  16. cc_library(
  17. name = "tracing_flag",
  18. srcs = ["tracing_flag.cpp"],
  19. hdrs = ["tracing_flag.h"],
  20. visibility = ["//executable_semantics:__subpackages__"],
  21. )
  22. EXAMPLES = [
  23. "assignment_copy1",
  24. "assignment_copy2",
  25. "block1",
  26. "block2",
  27. "break1",
  28. "choice1",
  29. "continue1",
  30. "fun_named_params",
  31. "fun_named_params2",
  32. "fun_recur",
  33. "fun1",
  34. "fun2",
  35. "fun3",
  36. "fun4",
  37. "fun5",
  38. "fun6_fail_type",
  39. "funptr1",
  40. "global_variable1",
  41. "global_variable2",
  42. "global_variable3",
  43. "global_variable4",
  44. "global_variable5",
  45. "global_variable6",
  46. "global_variable7",
  47. "global_variable8",
  48. "ignored_parameter",
  49. "if1",
  50. "if2",
  51. "if3",
  52. "invalid_char",
  53. "match_any_int",
  54. "match_int_default",
  55. "match_int",
  56. "match_placeholder",
  57. "match_type",
  58. "next",
  59. "pattern_init",
  60. "pattern_variable_fail",
  61. "placeholder_variable",
  62. "record1",
  63. "star",
  64. "struct1",
  65. "struct2",
  66. "struct3",
  67. "tuple_assign",
  68. "tuple_equality",
  69. "tuple_equality2",
  70. "tuple_equality3",
  71. "tuple_match",
  72. "tuple_match2",
  73. "tuple_match3",
  74. "tuple1",
  75. "tuple2",
  76. "tuple3",
  77. "tuple4",
  78. "tuple5",
  79. "type_compute",
  80. "type_compute2",
  81. "type_compute3",
  82. "while1",
  83. "zero",
  84. "experimental_continuation1",
  85. "experimental_continuation2",
  86. "experimental_continuation3",
  87. "experimental_continuation4",
  88. "experimental_continuation5",
  89. "experimental_continuation6",
  90. "experimental_continuation7",
  91. "experimental_continuation8",
  92. "experimental_continuation9",
  93. ]
  94. [golden_test(
  95. name = "%s_test" % e,
  96. cmd = "'$(location executable_semantics) $(location testdata/%s.carbon)'" % e,
  97. data = [
  98. ":executable_semantics",
  99. "testdata/%s.carbon" % e,
  100. ],
  101. golden = "testdata/%s.golden" % e,
  102. ) for e in EXAMPLES]
  103. # Test --trace by expecting golden output to be a *subset* of trace output. Note
  104. # the normal test must be used to update golden files.
  105. [golden_test(
  106. name = "%s_trace_test" % e,
  107. cmd = "'$(location executable_semantics) --trace " +
  108. "$(location testdata/%s.carbon)'" % e,
  109. data = [
  110. ":executable_semantics",
  111. "testdata/%s.carbon" % e,
  112. ],
  113. golden = "testdata/%s.golden" % e,
  114. golden_is_subset = True,
  115. ) for e in EXAMPLES]