BUILD 3.2 KB

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