-
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
Test installed drake bazel macro #7774
Test installed drake bazel macro #7774
Conversation
@m-chaturvedi There was a bug in the resource finding process. This PR should solve your Shambala issue. |
I was hoping to wait to alter the install tree's layout until we've settled the questions like #7586 about whether we are going to put back the "drake" folder -- I would prefer not to thrash our users if we're just going to undo it again in a few weeks. I don't think the current install is defective? The intent was that it operates the same as it used to before the rename. If there is some problem, please write up the bug report (inline in this PR discussion is fine) so that I can understand the problem. I didn't immediately see any open issue on Shambhala that related to this. Review status: 0 of 4 files reviewed at latest revision, all discussions resolved. Comments from Reviewable |
With master, if one tries to run an example, such as
Review status: 0 of 4 files reviewed at latest revision, all discussions resolved. Comments from Reviewable |
Oh, I see what happened. In I can see now how this PR fixes the (remaining) paths to match with the de-duplicated My question is whether we either (1) go the route of this PR by updating the non- I will give it some further thought. Review status: 0 of 4 files reviewed at latest revision, all discussions resolved. Comments from Reviewable |
Ok. Personally I have no preference over one or the other solution, although the double drake folder does seem redundant. Review status: 0 of 4 files reviewed at latest revision, all discussions resolved. Comments from Reviewable |
OK So I think this PR is in the right direction; we'll drop the duplication and square everything up to that new convention. At a minimum, this PR needs a regression test that fails without the fixes and passes with them -- running the kuka thing from the install directory, or something? Or a simpler (new?) example program with the same failure mode would be OK also. Longer term, we are gaining more and more "test the install" tests which is great, but I'm wondering now if we should be collecting or consolidating them a bit for clarity / conciseness / efficiency, such as all declared in the same subdirectory -- at least, all of them that depend on the monolithic For this PR review, I also need to take a fine comb and think about any other modalities or documentation we might have missed in terms of de-duplicating the data install directory. I will work on that. Review status: 0 of 4 files reviewed at latest revision, all discussions resolved. Comments from Reviewable |
Would it be hard to remove the appending of |
@EricCousineau-TRI I'm not sure what you're asking specifically? This PR changes the install tree (1) to be internally consistent with the various items installed and (2) to have only one |
LGTM pending the open discussions. Reviewed 4 of 4 files at r1. a discussion (no related file): a discussion (no related file): common/BUILD.bazel, line 396 at r1 (raw file):
For consistency, this should have one less drake. (Possibly it could move to common/find_resource.cc, line 239 at r1 (raw file):
This code-paragraph break got lost. Comments from Reviewable |
Posted my qualms as a BTW; namely was frustrated with how complicated / opaque this mechanism is. Review status: all files reviewed at latest revision, 5 unresolved discussions. common/find_resource.cc, line 247 at r1 (raw file):
FYI The usage of Is there any reason that this cannot simpler (less Drake-specific), so that the logic is much simpler? I understand that these changes are probably out-of-scope for this PR, so I would be happy to make this a separate issue, and change this myself (if there are no strong reasons for having this design currently as-is). Comments from Reviewable |
To add another minor comment, it does seem like On initialization, it should check for "the one true directory", and only use that directory. Given that my comments don't really contribute much to this PR, I will create a separate issue - sorry for the noise! |
88e929a
to
a0a9c8e
Compare
Review status: 0 of 11 files reviewed at latest revision, 5 unresolved discussions. a discussion (no related file): Previously, jwnimmer-tri (Jeremy Nimmer) wrote…
A test that fails is difficult (and that is why this bug was introduced without any test failing) because of the sentinel that is in the root directory. If the detection of the sentinel fails in the install directory, it will detect the sentinel in the source tree, and find the data from there. common/BUILD.bazel, line 396 at r1 (raw file): Previously, jwnimmer-tri (Jeremy Nimmer) wrote…
Done. common/find_resource.cc, line 239 at r1 (raw file): Previously, jwnimmer-tri (Jeremy Nimmer) wrote…
Done. common/find_resource.cc, line 247 at r1 (raw file): Previously, EricCousineau-TRI wrote…
I overall agree with this statement. I added a comment in issue #7821 , but this should be treated in a different PR. Comments from Reviewable |
I added a new macro to easily test executables after installation. It only requires to install Review status: 0 of 11 files reviewed at latest revision, 4 unresolved discussions. Comments from Reviewable |
Review status: 0 of 11 files reviewed at latest revision, 4 unresolved discussions. common/BUILD.bazel, line 396 at r1 (raw file): Previously, fbudin69500 (Francois Budin) wrote…
Done. Comments from Reviewable |
Checkpoint. I will look at the new test-provider infrastructure a bit later on. Reviewed 3 of 5 files at r3, 2 of 2 files at r4, 1 of 6 files at r5. a discussion (no related file): Previously, fbudin69500 (Francois Budin) wrote…
Isn't that why we remove the non-installed copies (
cwd=/ seems like a cute hack for the same effect.) Now that this PR uses that helper for, e.g., resource_tool_installed_test , is it good enough?
Aside: In any case, it turns out that writing test data into bindings/pydrake/test/common_install_test.py, line 36 at r5 (raw file):
Comment that this is to avoid finding files through the "look in pardir" heuristic, since we want to exercise the tools/install/install.bzl, line 280 at r5 (raw file):
BTW punc tools/skylark/drake_install_and_test.bzl, line 22 at r5 (raw file):
Unclear why this is here (probably just needs a comment). Comments from Reviewable |
Review status: 6 of 11 files reviewed at latest revision, 4 unresolved discussions, some commit checks failed. a discussion (no related file): Previously, jwnimmer-tri (Jeremy Nimmer) wrote…
I wrote that previous comment before thinking about changing the current working directory, so my previous comment is now irrelevant. Comments from Reviewable |
a discussion (no related file): Previously, fbudin69500 (Francois Budin) wrote…
That's weird, because for me the current directory when tests are run (the runfiles) live under Comments from Reviewable |
Review status: 6 of 11 files reviewed at latest revision, 3 unresolved discussions, some commit checks failed. bindings/pydrake/test/common_install_test.py, line 36 at r5 (raw file): Previously, jwnimmer-tri (Jeremy Nimmer) wrote…
Or maybe -- comment here as to why, and then since everything uses Comments from Reviewable |
Reviewed 2 of 6 files at r5. examples/BUILD.bazel, line 72 at r5 (raw file):
This infrastructure uses Bazel "providers" to locate the requested tests. This is cute because then far-flung install rules can consolidate their tests into a single runtime case, to avoid repeatedly running the install (which is I/O intensive and thus slow on CI). The downside is that a developer might write a "test_commands" stanza that gets completely ignored, if no depending-on label like this one happens to say Proposal : To remove the possibility for user error, it seems like examples/kuka_iiwa_arm/BUILD.bazel, line 20 at r5 (raw file):
BTW Unused? examples/kuka_iiwa_arm/BUILD.bazel, line 227 at r5 (raw file):
So the brevity is cute, but I feel like we are quickly going to exceed what this is capable of (for example, passing command-line arguments). The details of test cases are usually spelled out in test code, not BUILD rules; the BUILD rules usually just enumerate them. Proposal: Is there some way here we could pass the label for a test script file, instead of just a keyword? The file could still have some way to reuse the "run" and "runAndKill" primitives (maybe through an import), but then we can use the full power of Python to phrase the tests, instead of threading it through providers and codegen. tools/install/install_tests.py.in, line 1 at r5 (raw file):
The The easy change is that the (Depending on how the "test_commands" discussion above gets solved (citing test code, instead of keyword primitives, to enumerate test cases), this runner might change substantially anyway, I guess.) tools/skylark/drake_install_and_test.bzl, line 3 at r5 (raw file):
I think it might make more sense for this (FYI We could also drop tools/skylark/drake_install_and_test.bzl, line 9 at r5 (raw file):
This doc will need to be expanded so that readers can understand what it's doing. Calling out tools/skylark/drake_install_and_test.bzl, line 12 at r5 (raw file):
One macro that creates multiple rules is in general confusing to readers (names appear out of nowhere). Would you consider removing the Comments from Reviewable |
a0a9c8e
to
83a8e2e
Compare
Reviewed 1 of 6 files at r5, 1 of 15 files at r6, 18 of 19 files at r7, 10 of 10 files at r8, 6 of 7 files at r9, 13 of 13 files at r10. Comments from Reviewable |
FYI For some of the merge conflicts, if you've rewritten test cases using the |
a7ba439
to
8b22487
Compare
I updated to Review status: 9 of 20 files reviewed at latest revision, 7 unresolved discussions. common/test/resource_tool_installed_test.py, line 19 at r9 (raw file): Previously, jwnimmer-tri (Jeremy Nimmer) wrote…
Done. common/test/resource_tool_installed_test.py, line 22 at r9 (raw file): Previously, jwnimmer-tri (Jeremy Nimmer) wrote…
Done. tools/install/install.bzl, line 93 at r10 (raw file): Previously, jwnimmer-tri (Jeremy Nimmer) wrote…
Done. tools/install/install.bzl, line 401 at r10 (raw file): Previously, jwnimmer-tri (Jeremy Nimmer) wrote…
tools/install/install.bzl, line 542 at r10 (raw file): Previously, jwnimmer-tri (Jeremy Nimmer) wrote…
Done. tools/install/install.bzl, line 765 at r10 (raw file): Previously, jwnimmer-tri (Jeremy Nimmer) wrote…
Done. tools/install/test/install_tests.py, line 26 at r10 (raw file): Previously, jwnimmer-tri (Jeremy Nimmer) wrote…
hum, I don't know why it ended up there. It was not my plan. I moved it before the cmds. Comments from Reviewable |
Final replies posted. I think after those are resolved and CI is happy, this is ready for a fresh set of reviewer eyes. I think tagging Soonho for Thursday's platform review of this PR would be good.
Yup, I am fine with this on an ongoing basis; I don't think it needs a follow-up PR. Reviewed 1 of 13 files at r10, 11 of 12 files at r11. examples/kuka_iiwa_arm/test/kuka_simulation_installed_test.py, line 4 at r11 (raw file):
BTW This blank line is unconventional? tools/install/install.bzl, line 395 at r11 (raw file):
BTW tools/install/test/install_tests.py, line 24 at r11 (raw file):
I am a bit frightened of this -- its a short-circuit that doesn't run any install tests. I guess its used for the lighter-weight I am not actually sure what the purpose of tools/install/test/install_tests.py, line 37 at r11 (raw file):
This file only has one assertion (the listdir cross-check). I think perhaps the Comments from Reviewable |
Reviewed 1 of 13 files at r10, 11 of 12 files at r11. Comments from Reviewable |
8b22487
to
cbb98a2
Compare
Review status: 14 of 20 files reviewed at latest revision, 4 unresolved discussions. examples/kuka_iiwa_arm/test/kuka_simulation_installed_test.py, line 4 at r11 (raw file): Previously, jwnimmer-tri (Jeremy Nimmer) wrote…
Done. tools/install/install.bzl, line 395 at r11 (raw file): Previously, jwnimmer-tri (Jeremy Nimmer) wrote…
Good catch. It was corrected to tools/install/test/install_tests.py, line 24 at r11 (raw file): Previously, jwnimmer-tri (Jeremy Nimmer) wrote…
The purpose of tools/install/test/install_tests.py, line 37 at r11 (raw file): Previously, jwnimmer-tri (Jeremy Nimmer) wrote…
I simplified this test. Comments from Reviewable |
Reviewed 1 of 13 files at r10, 7 of 7 files at r12. Comments from Reviewable |
LGTM. +@ggould-tri for platform review per schedule, please. Reviewed 1 of 13 files at r10, 7 of 7 files at r12. Comments from Reviewable |
pending minor discussions below. Reviewed 1 of 19 files at r7, 4 of 10 files at r8, 4 of 13 files at r11, 6 of 8 files at r12. common/test/resource_tool_installed_test.py, line 63 at r12 (raw file):
This comment isn't really intuitive about what's going on. Better "use examples/kuka_iiwa_arm/test/iiwa_wsg_simulation_installed_test.py, line 14 at r12 (raw file):
Since you don't visibly set examples/kuka_iiwa_arm/test/kuka_simulation_installed_test.py, line 13 at r12 (raw file):
Same comment as above except here you actually deleted the relevant tools/install/install.bzl, line 282 at r12 (raw file):
BTW This comment just recites the function name and adds no information. Mention the return value and/or parameters, or omit it? tools/install/install.bzl, line 399 at r12 (raw file):
For some reason I find this line completely hilarious. tools/install/install_test_helper.py, line 101 at r12 (raw file):
FYI Capitalize. Comments from Reviewable |
Review status: all files reviewed at latest revision, 6 unresolved discussions. tools/install/install.bzl, line 399 at r12 (raw file): Previously, ggould-tri wrote…
Actually, I think this is vestigial and should be removed now? Comments from Reviewable |
cbb98a2
to
ee28597
Compare
Review status: 14 of 20 files reviewed at latest revision, 6 unresolved discussions. common/test/resource_tool_installed_test.py, line 63 at r12 (raw file): Previously, ggould-tri wrote…
Done. examples/kuka_iiwa_arm/test/iiwa_wsg_simulation_installed_test.py, line 14 at r12 (raw file): Previously, ggould-tri wrote…
Done. examples/kuka_iiwa_arm/test/kuka_simulation_installed_test.py, line 13 at r12 (raw file): Previously, ggould-tri wrote…
Done. tools/install/install.bzl, line 282 at r12 (raw file): Previously, ggould-tri wrote…
Done. tools/install/install.bzl, line 399 at r12 (raw file): Previously, jwnimmer-tri (Jeremy Nimmer) wrote…
tools/install/install_test_helper.py, line 101 at r12 (raw file): Previously, ggould-tri wrote…
Done. Comments from Reviewable |
Reviewed 6 of 6 files at r13. Comments from Reviewable |
Reviewed 1 of 19 files at r7, 1 of 10 files at r8, 1 of 13 files at r10, 1 of 12 files at r11, 6 of 6 files at r13. Comments from Reviewable |
Reviewed 6 of 6 files at r13. Comments from Reviewable |
`install_test()` is a wrapper macro that creates a Python script that is run during the testing phase. The Python script installs `drake` and runs the targets that are listed in `install_tests` in install rules. The Python script that is created will allow to test multiple targets in the install tree without having to install drake multiple times. `install_test()` should be called only once, in `//:*`. All the install tests that have been created in all the `install()` commands in the source tree will be integrated in the Python script that is generated. The targets can either be executables that are installed, or any executable or scripts that is designed to test drake features in the install tree. The Python install_test_helper file (`tools/install/install_test_helper.py`) has been improved to easily create Python scripts that run commands from the install directory. This is convenient when trying to test an executable in the install tree that is run with parameters, or an executable that needs to be killed because it never stops running.
ee28597
to
e494938
Compare
Reviewed 13 of 13 files at r14. Comments from Reviewable |
@jwnimmer-tri We are just waiting on the official Reviewable stamp of approval from you. Anything else needed here? |
Now that the resources have been moved one directory up in drake's install
folder, we need to also move the resource sentinel.
This change is