BUILD 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  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_fail3",
  42. "generic_function_swap",
  43. "generic_function_tuple_map",
  44. "global_variable1",
  45. "global_variable2",
  46. "global_variable3",
  47. "global_variable4",
  48. "global_variable5",
  49. "global_variable6",
  50. "global_variable7",
  51. "global_variable8",
  52. "ignored_parameter",
  53. "if1",
  54. "if2",
  55. "if3",
  56. "invalid_char",
  57. "match_any_int",
  58. "match_int_default",
  59. "match_int",
  60. "match_placeholder",
  61. "match_type",
  62. "next",
  63. "pattern_init",
  64. "pattern_variable_fail",
  65. "placeholder_variable",
  66. "record1",
  67. "star",
  68. "struct1",
  69. "struct2",
  70. "struct3",
  71. "tuple_assign",
  72. "tuple_equality",
  73. "tuple_equality2",
  74. "tuple_equality3",
  75. "tuple_match",
  76. "tuple_match2",
  77. "tuple_match3",
  78. "tuple1",
  79. "tuple2",
  80. "tuple3",
  81. "tuple4",
  82. "tuple5",
  83. "type_compute",
  84. "type_compute2",
  85. "type_compute3",
  86. "while1",
  87. "zero",
  88. "experimental_continuation1",
  89. "experimental_continuation2",
  90. "experimental_continuation3",
  91. "experimental_continuation4",
  92. "experimental_continuation5",
  93. "experimental_continuation6",
  94. "experimental_continuation7",
  95. "experimental_continuation8",
  96. "experimental_continuation9",
  97. ]
  98. [golden_test(
  99. name = "%s_test" % e,
  100. cmd = "'$(location executable_semantics) $(location testdata/%s.carbon)'" % e,
  101. data = [
  102. ":executable_semantics",
  103. "testdata/%s.carbon" % e,
  104. ],
  105. env = {
  106. # TODO(#580): Remove this when leaks are fixed.
  107. "ASAN_OPTIONS": "detect_leaks=0",
  108. },
  109. golden = "testdata/%s.golden" % e,
  110. ) for e in EXAMPLES]
  111. # Test --trace by expecting golden output to be a *subset* of trace output. Note
  112. # the normal test must be used to update golden files.
  113. [golden_test(
  114. name = "%s_trace_test" % e,
  115. cmd = "'$(location executable_semantics) --trace " +
  116. "$(location testdata/%s.carbon)'" % e,
  117. data = [
  118. ":executable_semantics",
  119. "testdata/%s.carbon" % e,
  120. ],
  121. env = {
  122. # TODO(#580): Remove this when leaks are fixed.
  123. "ASAN_OPTIONS": "detect_leaks=0",
  124. },
  125. golden = "testdata/%s.golden" % e,
  126. golden_is_subset = True,
  127. ) for e in EXAMPLES]