diff options
author | 2018-05-23 03:53:01 -0700 | |
---|---|---|
committer | 2018-05-23 03:54:03 -0700 | |
commit | 259c67d9dd0b173fb4cc5830d29ce6004e67ff84 (patch) | |
tree | fd3dcecade6f147b6de612b6bc6b0cb94798f20f /src/test/shell | |
parent | 174dc5159cb3736ca017598d6f8cec5f1bd44114 (diff) |
RepositoryResolvedEvent: only record the explicitly set original attributes
Prune down the list of attributes to the explicitly set ones when reporting
the original attributes. The attribute list also contains attributes implicitly
added from default values, but the original attributes are intended to record
the original way the rule was invoked from the WORKSPACE file.
Change-Id: I918656159850a52e9afc9f045701b0ea065f4125
PiperOrigin-RevId: 197702283
Diffstat (limited to 'src/test/shell')
-rwxr-xr-x | src/test/shell/bazel/workspace_resolved_test.sh | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/src/test/shell/bazel/workspace_resolved_test.sh b/src/test/shell/bazel/workspace_resolved_test.sh index 01a33dd501..d4de82e107 100755 --- a/src/test/shell/bazel/workspace_resolved_test.sh +++ b/src/test/shell/bazel/workspace_resolved_test.sh @@ -56,6 +56,7 @@ EOF # Verify that bazel can read the generated repo.bzl file and that it contains # the expected information cd .. + echo; cat repo.bzl; echo; echo mkdir analysisrepo mv repo.bzl analysisrepo cd analysisrepo @@ -69,12 +70,19 @@ load("//:repo.bzl", "resolved") cmd = "echo %s > $@" % entry["repositories"][0]["attributes"]["extra_arg"], ) for entry in resolved if entry["original_rule_class"] == "//:rule.bzl%trivial_rule" ] + +[ genrule( + name = "origcount", + outs = ["origcount.txt"], + cmd = "echo %s > $@" % len(entry["original_attributes"]) + ) for entry in resolved if entry["original_rule_class"] == "//:rule.bzl%trivial_rule" +] EOF - cat BUILD - bazel build //:out || fail "Expected success" + bazel build :out :origcount || fail "Expected success" grep "foobar" `bazel info bazel-genfiles`/out.txt \ || fail "Did not find the expected value" - + [ $(cat `bazel info bazel-genfiles`/origcount.txt) -eq 2 ] \ + || fail "Not the correct number of original attributes" } run_suite "workspace_resolved_test tests" |