BUILD 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  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. "match_any_int",
  53. "match_int_default",
  54. "match_int",
  55. "match_placeholder",
  56. "match_type",
  57. "next",
  58. "pattern_init",
  59. "pattern_variable_fail",
  60. "placeholder_variable",
  61. "record1",
  62. "star",
  63. "struct1",
  64. "struct2",
  65. "struct3",
  66. "tuple_assign",
  67. "tuple_equality",
  68. "tuple_equality2",
  69. "tuple_equality3",
  70. "tuple_match",
  71. "tuple_match2",
  72. "tuple_match3",
  73. "tuple1",
  74. "tuple2",
  75. "tuple3",
  76. "tuple4",
  77. "tuple5",
  78. "type_compute",
  79. "type_compute2",
  80. "type_compute3",
  81. "while1",
  82. "zero",
  83. "experimental_continuation1",
  84. "experimental_continuation2",
  85. "experimental_continuation3",
  86. "experimental_continuation4",
  87. "experimental_continuation5",
  88. "experimental_continuation6",
  89. "experimental_continuation7",
  90. "experimental_continuation8",
  91. "experimental_continuation9",
  92. ]
  93. [golden_test(
  94. name = "%s_test" % e,
  95. cmd = "'$(location executable_semantics) $(location testdata/%s.carbon)'" % e,
  96. data = [
  97. ":executable_semantics",
  98. "testdata/%s.carbon" % e,
  99. ],
  100. golden = "testdata/%s.golden" % e,
  101. ) for e in EXAMPLES]
  102. # Test --trace by expecting golden output to be a *subset* of trace output. Note
  103. # the normal test must be used to update golden files.
  104. [golden_test(
  105. name = "%s_trace_test" % e,
  106. cmd = "'$(location executable_semantics) --trace " +
  107. "$(location testdata/%s.carbon)'" % e,
  108. data = [
  109. ":executable_semantics",
  110. "testdata/%s.carbon" % e,
  111. ],
  112. golden = "testdata/%s.golden" % e,
  113. golden_is_subset = True,
  114. ) for e in EXAMPLES]