-
Notifications
You must be signed in to change notification settings - Fork 145
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
Add test actions #178
Add test actions #178
Conversation
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.
Left some comments. Thanks @ivanpauno!
@@ -12,12 +12,8 @@ | |||
# See the License for the specific language governing permissions and | |||
# limitations under the License. | |||
|
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.
@ivanpauno please update the copyright year.
__all__ = [ | ||
'actions', | ||
] | ||
|
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.
@ivanpauno I'm not sure we want all to behave like this (see here). Maybe we should add the class defined below and the output
module as well?
@@ -0,0 +1,48 @@ | |||
# Copyright 2018 Open Source Robotics Foundation, Inc. |
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.
@ivanpauno 2018
-> 2019
:param: path the path of the test to be executed. | ||
""" | ||
cmd = [FindExecutable(name='python3'), '-m pytest', path] | ||
super().__init__(cmd=cmd, shell=True, **kwargs) |
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.
@ivanpauno I think that using FindExecutable
precludes the need for shell=True
.
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.
It fails without shell=True
# Setup a timer to send us a SIGKILL if the test locks | ||
sigkill_timer = TimerAction(period=self.__timeout, actions=[ | ||
EmitEvent(event=SignalProcess( | ||
signal_number=signal.SIGKILL, |
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.
@ivanpauno maybe we could send a SIGINT
instead? It's slightly more polite :)
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.
Sounds good, but maybe it should be escalated to SIGKILL after an extra timeout. WDYT?
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.
That's ExecuteProcess
action behavior upon shutdown already. Maybe we could try to reuse its __shutdown_process()
method somehow?
launch_testing/CMakeLists.txt
Outdated
|
||
ament_python_install_package(${PROJECT_NAME}) | ||
|
||
add_executable(locking dummy_tests/locking.cpp) |
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.
@ivanpauno consider relocating your dummy applications below test/
.
from launch_testing.actions import GTest | ||
|
||
|
||
def test_gtest(): |
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.
@ivanpauno consider adding tests for real googletest
and pytest
instances, here and below respectively.
16982aa
to
cea2cb2
Compare
@wjwwood I'm having a problem here, in a test that is locking forever. How to repro:
Outputs:
|
cea2cb2
to
8e6b6c1
Compare
Those timers do need to hold up shutdown, but not all timers need to do so (see: #181), but I haven't had time to fully review this, so I can't speak to how you're reusing the parts of execute process, though I'm a bit curious why you're not inheriting from it if you're both running a subprocess and wanting it to be killed gracefully (with escalating signals). |
8e6b6c1
to
74cd5a7
Compare
Signed-off-by: ivanpauno <ivanpauno@ekumenlabs.com>
Signed-off-by: ivanpauno <ivanpauno@ekumenlabs.com>
Signed-off-by: ivanpauno <ivanpauno@ekumenlabs.com>
Signed-off-by: ivanpauno <ivanpauno@ekumenlabs.com>
Signed-off-by: ivanpauno <ivanpauno@ekumenlabs.com>
Signed-off-by: ivanpauno <ivanpauno@ekumenlabs.com>
Signed-off-by: ivanpauno <ivanpauno@ekumenlabs.com>
Signed-off-by: ivanpauno <ivanpauno@ekumenlabs.com>
Signed-off-by: ivanpauno <ivanpauno@ekumenlabs.com>
Signed-off-by: ivanpauno <ivanpauno@ekumenlabs.com>
Signed-off-by: ivanpauno <ivanpauno@ekumenlabs.com>
Signed-off-by: Michel Hidalgo <michel@ekumenlabs.com>
74cd5a7
to
0b2b07c
Compare
I've pushed changes, can't be a reviewer anymore.
@wjwwood the added
|
On a side note, may I ask you guys @mjcarroll @sloretz (and maybe @wjwwood if you feel like it) to review this? I've touched it, so I can't review it anymore. |
All the waiting occurs here: launch/launch/launch/launch_service.py Lines 230 to 237 in d5ace50
Do you see debug output for "still waiting on ..."? I'm not initially convinced by your bullet point scenario above that there is a race, but it's been a while since I've steeped myself in this code, so maybe. |
But that's if you've received a shutdown event. In the case described above, we were hoping the loop would trigger the shutdown itself once it detects it's idle: launch/launch/launch/launch_service.py Lines 210 to 214 in d5ace50
But it seems to be getting stuck in: launch/launch/launch/launch_service.py Lines 239 to 240 in d5ace50
|
@mjcarroll ping |
@mjcarroll can we get this one in? I need the test action concept for ApexAI/apex_rostest#19. Running CI just in case: |
Signed-off-by: Michel Hidalgo <michel@ekumenlabs.com>
…encies. Signed-off-by: Michel Hidalgo <michel@ekumenlabs.com>
And that's why running CI is important :) |
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.
I'm not super well-versed in this bit of code, but with green CI it LGTM.
Signed-off-by: Michel Hidalgo <michel@ekumenlabs.com>
Signed-off-by: Michel Hidalgo <michel@ekumenlabs.com>
5c96ac0
to
35551f6
Compare
Alright, CI is passing. Merging! Thanks for taking a look @mjcarroll ! |
Connected to #176. This pull request add two actions GTest and PyTest, to run tests.
I'm doing this over #167, as running the old test with the legacy API generated a run-time asyncio error ('event loop is closed'), because of bad test interaction.
Also migrated to ament_cmake package, in order to build the dummy cpp test (maybe it exists a better way of doing this).