mirror of
https://github.com/CopterExpress/clover.git
synced 2026-06-04 16:59:31 +00:00
Add ROS service for executing shell commands (#210)
* Add ROS service for executing shell commands * Show image version on index web page * Add test for exec service * Add shell node to clover.launch * Remake exec handling, consider exit code and exec failures
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
import rospy
|
||||
import pytest
|
||||
from mavros_msgs.msg import State
|
||||
from clover import srv
|
||||
|
||||
@pytest.fixture()
|
||||
def node():
|
||||
@@ -27,3 +28,19 @@ def test_simple_offboard_services_available():
|
||||
def test_web_video_server(node):
|
||||
import urllib2
|
||||
urllib2.urlopen("http://localhost:8080").read()
|
||||
|
||||
def test_shell(node):
|
||||
execute = rospy.ServiceProxy('exec', srv.Execute)
|
||||
execute.wait_for_service(5)
|
||||
|
||||
res = execute(cmd='echo foo')
|
||||
assert res.code == 0
|
||||
assert res.output == 'foo\n'
|
||||
|
||||
res = execute(cmd='foo')
|
||||
assert res.code == 32512
|
||||
assert res.output == ''
|
||||
|
||||
res = execute(cmd='ls foo')
|
||||
assert res.code == 512
|
||||
assert res.output == ''
|
||||
|
||||
Reference in New Issue
Block a user