-
Notifications
You must be signed in to change notification settings - Fork 4.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ctexplain: make cquery parsing more robust #13212
Conversation
Specifically: - Handle labels with spaces - Handle targets with no fragment requirements. These were both inspired by real analyses. Testing: $ bazel test //tools/ctexplain:all Work towards bazelbuild#10613
if fragments_start == fragments_end - 1: | ||
fragments = tuple() | ||
else: | ||
fragments = tuple(line[fragments_start + 1:fragments_end].split(", ")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tuple(x.strip() for x in line[fragments_start + 1:fragments_end].split(","))
is a little more resilient to whitespace changes.
config_hash = tokens[1][1:-1] | ||
config_hash_start = line.find("(") | ||
config_hash_end = line.find(")", config_hash_start) | ||
fragments_start = line.find("[", config_hash_end) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
move under the else: condition below; after verifying not in null configuration
success = res[0] | ||
cts = res[2] | ||
self.assertTrue(success) | ||
self.assertEqual(len(cts), 1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
assertLen
success = res[0] | ||
cts = res[2] | ||
self.assertTrue(success) | ||
self.assertEqual(len(cts), 1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
assertLen
self.assertTrue(success) | ||
self.assertEqual(len(cts), 1) | ||
self.assertEqual(cts[0].label, '//testapp:alias_to_src') | ||
self.assertEqual(len(cts[0].transitive_fragments), 0) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
assertEmpty
Hi all, we're doing a clean up of old PRs and will be closing this one since it seems to have stalled. Please feel free to reopen if you’re still interested in pursuing this. |
Specifically:
These were both inspired by real analyses.
Testing:
$ bazel test //tools/ctexplain:all
Work towards #10613