Fix golden tests to use the "target" Bazel configuration (#581)

In practice, this means that `executable_semantics` will be built and run using the configuration specified on the command line, rather than e.g. always using `-c opt`.

Also fix a bug exposed by this change.
This commit is contained in:
Geoff Romer
2021-06-16 16:33:19 -07:00
committed by GitHub
parent 07cee1b82a
commit 31f37f54fe
7 changed files with 103 additions and 58 deletions
+5 -10
View File
@@ -92,17 +92,12 @@ EXAMPLES = [
"experimental_continuation9",
]
[genrule(
name = "%s_out" % e,
srcs = ["testdata/%s.carbon" % e],
outs = ["testdata/%s.out" % e],
# Suppress command errors.
cmd = "$(location executable_semantics) $< > $@ 2>&1 || echo EXIT CODE: $$? >> $@",
tools = [":executable_semantics"],
) for e in EXAMPLES]
[golden_test(
name = "%s_test" % e,
cmd = "'$(location executable_semantics) $(location testdata/%s.carbon)'" % e,
data = [
":executable_semantics",
"testdata/%s.carbon" % e,
],
golden = "testdata/%s.golden" % e,
subject = "testdata/%s.out" % e,
) for e in EXAMPLES]
@@ -149,8 +149,8 @@ auto TypeCheckExp(const Expression* e, TypeEnv types, Env values,
return TCResult(new_e, t, types);
}
case ExpressionKind::Index: {
auto res = TypeCheckExp(e->GetFieldAccess().aggregate, types, values,
nullptr, TCContext::ValueContext);
auto res = TypeCheckExp(e->GetIndex().aggregate, types, values, nullptr,
TCContext::ValueContext);
auto t = res.type;
switch (t->tag) {
case ValKind::TupleV: {
+1 -1
View File
@@ -47,7 +47,7 @@ cc_test(
name = "paren_contents_test",
srcs = ["paren_contents_test.cpp"],
env = {
# FIXME: Remove this when leaks are fixed.
# TODO(#580): Remove this when leaks are fixed.
"ASAN_OPTIONS": "detect_leaks=0",
},
deps = [