-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
external_data: Add stub of Bazel structure for isolated and meta-testing. #7713
external_data: Add stub of Bazel structure for isolated and meta-testing. #7713
Conversation
The end goal (pre-Girder) is here: https://github.com/EricCousineau-TRI/drake/tree/30c757eb9c003fc57ffddaca59632e633622cdf4/tools/external_data/workspace/test/workspaces +@jwnimmer-tri for feature review, please. Review status: 0 of 28 files reviewed at latest revision, all discussions resolved. Comments from Reviewable |
e8185a2
to
112a4c5
Compare
Note that Review status: 0 of 28 files reviewed at latest revision, all discussions resolved. Comments from Reviewable |
5630ee4
to
0c94752
Compare
Related #7259. I did some hack-and-slash for |
Review status: 0 of 28 files reviewed at latest revision, 1 unresolved discussion. tools/external_data/BUILD.bazel, line 27 at r1 (raw file):
BTW This is more like isolated testing rather than meta testing. Comments from Reviewable |
Review status: 0 of 28 files reviewed at latest revision, 2 unresolved discussions. tools/external_data/BUILD.bazel, line 16 at r1 (raw file):
Ultimately, it'd be a lot nicer if I could somehow bind Unfortunately, I will add that as a comment here, once I give CI a chance to complete these tests. Comments from Reviewable |
@drake-jenkins-bot mac-sierra-clang-bazel-experimental please. |
This all seems very confusing. I am not even understanding what the end goal or game is, and the links above didn't help me. I guess in the first place, why do we need to Review status: 0 of 28 files reviewed at latest revision, 2 unresolved discussions. Comments from Reviewable |
Sorry about that! The end-goal of this PR is to support automated testing of Bazel-based workflows here:
The reason to place this code in a nested workspace is to drastically simplify the process of automating these tests in a clean, Bazel-friendly process. Drake would make it harder to make reproducible, isolated tests to ensure that the user / developer experience goes as desired. From my standpoint, w.r.t. the functionality contained in this module, there is very little to gain by having it next to Drake or pull in dependencies from it; the linting is done by Drake itself (per the latest push), and things like installation seems like a moot point, since this is purely a development tool. Review status: 0 of 25 files reviewed at latest revision, 2 unresolved discussions. Comments from Reviewable |
d4c5d86
to
e93489f
Compare
Per f2f with @jwnimmer-tri, I will try merging Review status: 0 of 24 files reviewed at latest revision, 2 unresolved discussions. Comments from Reviewable |
2ea52b5
to
9777844
Compare
@jwnimmer-tri I've tried out the more hermitic structure, folding the workspace into Drake, and got it to work... But I strongly dislike this setup because I feel like we're trading maintainability for consistency. Because Bazel has no apparent ease for introspection (e.g. "give me all Skylark files that are needed to make this I'd prefer to keep it as it previously was (with the mid-level workspace - but with directory names a little more clearly named), with a mention of why it is broken up. If there are issues with importing the external data macros with it as a local repo in Drake, I'll gladly take the responsibility of solving that problem myself if it comes up. Review status: 0 of 24 files reviewed at latest revision, 3 unresolved discussions. tools/external_data/README.md, line 15 at r2 (raw file):
This is out of date; will update once a direction is confirmed for Bazel structure. Comments from Reviewable |
9777844
to
3840cb5
Compare
(And I'd still like to maintain linting on the individual test files, as there will be some non-trivial code in there - so I do want some consistency, just not at the bazel Review status: 0 of 24 files reviewed at latest revision, 3 unresolved discussions. Comments from Reviewable |
It that "more hermetic structure" pushed to this PR (or is there a link)? I will definitely look tonight. If I'm understanding correctly: I think we are on the same page that all files that are required by the test project (i.e., all data used by the test) has to be explicitly listed (or globbed) -- that we can't rely on the "its containing directory got symlinked in as part of a filegroup" trick? And thus the question is, depending on how the external_data tool and workspace and dependencies are phrased, either more or less of Drake's skylark code and tools end up being dependencies of external_data (and thus its tests), and thus affect the magnitude of how much data we need to list as prereqs of the test? Is that approximately right? Comments from Reviewable |
Yup, the "more hermetic structure" is in r3 (3840cb5).
Yup! Very succinctly stated. Review status: 0 of 24 files reviewed at latest revision, 3 unresolved discussions, some commit checks failed. Comments from Reviewable |
FYI I'm still exploring this locally and gaining understanding. There are a few facets that I plan to write up. I don't have a conclusion yet but working on it actively and should have an answer soonish. One note so far... I can foresee that #7259 work would come into play because it expands the list of files required to be present in order to parse Drake's WORKSPACE file (from the test case). Right now the WORKSPACE directly lists many e.g. github_archive entries; but with my work, each of those will be broken out into a helper file. So rather than the ~3 workspace entries we have to glob up right now, we'd need all ~50 entries, since load statements are never lazily evaluated. Comments from Reviewable |
Here is a condensed version of my thoughts. Probably we should discuss live as a next step. So I've thought about about acceptance criteria for what would be satisfactory. Within these, there are likely several designs that could all work.
At the scale of r3 (the list of
So what's going on here is that In terms of maintainability, the I'll also note that I think the choice of sub-workspace and choices of whether to use add_lint_tests within external_data's implementation, are distinct choices? I think we could omit the sub-workspace, but still do the linting out-of-package (by exporting external_data's files as all_files) so that there are no load-time dependencies from external_data on the lint infrastructure? (We could even put the linting within
This is true, but can be worked around. The test cases shouldn't use Review status: 0 of 24 files reviewed at latest revision, 7 unresolved discussions, some commit checks failed. tools/external_data/BUILD.bazel, line 9 at r3 (raw file):
FYI This one isn't necessary. tools/external_data/workspace_test.bzl, line 31 at r3 (raw file):
I'm not certain, but I think tools/external_data/workspace_writeable_test.sh, line 24 at r3 (raw file):
FYI tools/external_data/test/workspaces/bazel_pkg_test/WORKSPACE, line 7 at r3 (raw file):
FYI I'd have to add some prints to be sure, but this seems wrong? Is this using the copy of (a fraction of) Drake that's been copied into our test case's tempdir? A possibly clearer approach would be to have the test runner codegen a Comments from Reviewable |
Very brief brain dump from live discussion:
Review status: 0 of 24 files reviewed at latest revision, 7 unresolved discussions, some commit checks failed. Comments from Reviewable |
c4d8707
to
cf3700b
Compare
94f0e9b
to
0abd57a
Compare
Review status: 7 of 19 files reviewed at latest revision, 21 unresolved discussions. a discussion (no related file): Previously, jwnimmer-tri (Jeremy Nimmer) wrote…
I'd prefer have tools/external_data/expose_all_files.bzl, line 6 at r4 (raw file): Previously, jwnimmer-tri (Jeremy Nimmer) wrote…
Done. tools/external_data/expose_all_files.bzl, line 30 at r4 (raw file): Previously, jwnimmer-tri (Jeremy Nimmer) wrote…
Done. tools/external_data/expose_all_files.bzl, line 46 at r4 (raw file): Previously, jwnimmer-tri (Jeremy Nimmer) wrote…
Done. tools/external_data/expose_all_files.bzl, line 59 at r4 (raw file): Previously, jwnimmer-tri (Jeremy Nimmer) wrote…
Done. tools/external_data/README.md, line 5 at r4 (raw file): Previously, jwnimmer-tri (Jeremy Nimmer) wrote…
Done. tools/external_data/README.md, line 27 at r4 (raw file): Previously, jwnimmer-tri (Jeremy Nimmer) wrote…
Done. Trimmed down file list, separated out consumer / developer info. tools/external_data/test/BUILD.bazel, line 11 at r4 (raw file): Previously, jwnimmer-tri (Jeremy Nimmer) wrote…
Done. tools/external_data/test/external_data_workspace_test.bzl, line 39 at r4 (raw file): Previously, jwnimmer-tri (Jeremy Nimmer) wrote…
Done. tools/external_data/test/external_data_workspace_test.bzl, line 41 at r4 (raw file): Previously, jwnimmer-tri (Jeremy Nimmer) wrote…
Done. tools/external_data/test/external_data_workspace_test.bzl, line 59 at r4 (raw file): Previously, jwnimmer-tri (Jeremy Nimmer) wrote…
Done. tools/external_data/test/external_data_workspace_test.sh, line 1 at r4 (raw file): Previously, jwnimmer-tri (Jeremy Nimmer) wrote…
Done. tools/external_data/test/external_data_workspace_test.sh, line 2 at r4 (raw file): Previously, jwnimmer-tri (Jeremy Nimmer) wrote…
Done. tools/external_data/test/remove_bazel_symlinks.sh, line 3 at r4 (raw file): Previously, jwnimmer-tri (Jeremy Nimmer) wrote…
Done. I'd prefer to keep this in tools/external_data/test/remove_bazel_symlinks.sh, line 4 at r4 (raw file): Previously, jwnimmer-tri (Jeremy Nimmer) wrote…
Done. tools/external_data/test/workspace_test.bzl, line 13 at r4 (raw file): Previously, jwnimmer-tri (Jeremy Nimmer) wrote…
Done. tools/external_data/test/workspace_test.bzl, line 18 at r4 (raw file): Previously, jwnimmer-tri (Jeremy Nimmer) wrote…
Done. Ultimately, it'd be nice to have something like tools/external_data/test/workspace_test.sh, line 35 at r4 (raw file): Previously, jwnimmer-tri (Jeremy Nimmer) wrote…
Done. Removed shell quoting from tools/external_data/test/external_data_pkg_test/BUILD.bazel, line 9 at r4 (raw file): Previously, jwnimmer-tri (Jeremy Nimmer) wrote…
OK I just wanted to have an actual (stub) test in the package; however, this will be 100% removed once the other tests come into play. tools/external_data/test/external_data_pkg_test/WORKSPACE, line 7 at r4 (raw file): Previously, jwnimmer-tri (Jeremy Nimmer) wrote…
Tried out a different iteration; same functionality, but more purposeful (and less tools/workspace/test_repositories.bzl, line 4 at r4 (raw file): Previously, jwnimmer-tri (Jeremy Nimmer) wrote…
Done. Not at all attached to this setup; just wanted to see if I could stabilize Comments from Reviewable |
Reviewed 1 of 46 files at r2, 2 of 37 files at r4, 12 of 15 files at r5. tools/external_data/expose_all_files.bzl, line 46 at r4 (raw file): Previously, EricCousineau-TRI wrote…
The comment here is good, but I'm not seeing the comment at the other location (so that editors there are reminded to also fix this copy). tools/external_data/test/remove_bazel_symlinks.sh, line 3 at r4 (raw file): Previously, EricCousineau-TRI wrote…
OK Aha! I had misread the tools/external_data/test/workspace_test.sh, line 35 at r4 (raw file): Previously, EricCousineau-TRI wrote…
I believe that having the (Personally, I would just change this to ((Or maybe I've misunderstood how things work; I didn't actually run any experiments.)) tools/external_data/test/workspace_test.sh, line 14 at r5 (raw file):
FYI Consider tools/external_data/test/external_data_pkg_test/drake_path.bzl, line 2 at r5 (raw file):
If I'm understanding correctly, this file needs a disclaimer comment that it is not part of the code under test, but rather is always overwritten during test execution -- except when the developer is doing their own manual testing gymnastics. As it stands, a developer would think that this code is in play during their test exection. Comments from Reviewable |
Reviewed 1 of 15 files at r5. a discussion (no related file): Previously, EricCousineau-TRI wrote…
I can live with that, but the python variable name tools/external_data/README.md, line 5 at r4 (raw file): Previously, EricCousineau-TRI wrote…
OK I see, so the Python support library and cli binary code should go into Comments from Reviewable |
0abd57a
to
9b93fde
Compare
Review status: 13 of 19 files reviewed at latest revision, 6 unresolved discussions. a discussion (no related file): Previously, jwnimmer-tri (Jeremy Nimmer) wrote…
Done. Renamed to tools/external_data/expose_all_files.bzl, line 46 at r4 (raw file): Previously, jwnimmer-tri (Jeremy Nimmer) wrote…
Done. tools/external_data/README.md, line 5 at r4 (raw file): Previously, jwnimmer-tri (Jeremy Nimmer) wrote…
Yup! tools/external_data/test/workspace_test.sh, line 35 at r4 (raw file): Previously, jwnimmer-tri (Jeremy Nimmer) wrote…
Done. tools/external_data/test/workspace_test.sh, line 14 at r5 (raw file): Previously, jwnimmer-tri (Jeremy Nimmer) wrote…
OK I'd prefer to keep this as-is, unless it creates issues in the future. tools/external_data/test/external_data_pkg_test/drake_path.bzl, line 2 at r5 (raw file): Previously, jwnimmer-tri (Jeremy Nimmer) wrote…
Done. Comments from Reviewable |
9b93fde
to
1a70122
Compare
LGTM though I will wait to post the emoji in case @sammy-tri review encounters any major revisions. Reviewed 6 of 6 files at r6. tools/external_data/test/external_data_workspace_test.sh, line 25 at r6 (raw file):
BTW Should this also be Comments from Reviewable |
1a70122
to
5d00049
Compare
Review status: 16 of 19 files reviewed at latest revision, 1 unresolved discussion. tools/external_data/test/external_data_workspace_test.sh, line 25 at r6 (raw file): Previously, jwnimmer-tri (Jeremy Nimmer) wrote…
Done. Oops! Thanks for catching that! Comments from Reviewable |
Reviewed 3 of 3 files at r7. Comments from Reviewable |
5d00049
to
1de2e6c
Compare
Reviewed 1 of 1 files at r8. Comments from Reviewable |
Pinging @sammy-tri for the second review. Review status: all files reviewed at latest revision, all discussions resolved. Comments from Reviewable |
First pass complete Reviewed 5 of 46 files at r2, 6 of 37 files at r4, 7 of 15 files at r5, 3 of 6 files at r6, 2 of 3 files at r7, 1 of 1 files at r8. tools/external_data/test/remove_bazel_symlinks.sh, line 1 at r8 (raw file):
I can't figure out where this is called from? Comments from Reviewable |
Review status: all files reviewed at latest revision, 1 unresolved discussion. tools/external_data/test/remove_bazel_symlinks.sh, line 1 at r8 (raw file): Previously, sammy-tri (Sam Creasey) wrote…
Sorry, this is purely a utility script (only ran by the user if they ran Comments from Reviewable |
Review status: all files reviewed at latest revision, 1 unresolved discussion. tools/external_data/test/remove_bazel_symlinks.sh, line 1 at r8 (raw file): Previously, EricCousineau-TRI wrote…
I think documentation should be adequate (though I do worry a bit about bitrot if it's never invoked). Comments from Reviewable |
1de2e6c
to
9d218a5
Compare
Review status: all files reviewed at latest revision, 1 unresolved discussion. tools/external_data/test/remove_bazel_symlinks.sh, line 1 at r8 (raw file): Previously, sammy-tri (Sam Creasey) wrote…
Done. Went ahead and removed it for the time being. Comments from Reviewable |
Reviewed 1 of 46 files at r2, 1 of 37 files at r4, 1 of 1 files at r9. Comments from Reviewable |
Reviewed 1 of 46 files at r2, 1 of 37 files at r4, 1 of 1 files at r9. Comments from Reviewable |
Hmm, did we test this on macOS yet? Probably worth a spin, if not. |
@drake-jenkins-bot mac-sierra-clang-bazel-experimental please I'll fire it off. If you think we don't need it, you can merge anyway. |
Testing on Mac is an excellent idea! (given how finicky Bazel sandboxes are there :( ) |
This change is