Skip to content
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

Update samplerobot python unittest #912

Merged
merged 3 commits into from
Dec 17, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .travis.sh
Original file line number Diff line number Diff line change
Expand Up @@ -386,7 +386,12 @@ case $TEST_PACKAGE in
rostest $test_file && travis_time_end || export TMP_EXIT_STATUS=$?
if [ "$TMP_EXIT_STATUS" != 0 ]; then
export EXIT_STATUS=$TMP_EXIT_STATUS
# Print results of rostest-*.xml files
find ~/.ros/test_results -type f -iname "*`basename $test_file .test`.xml" -print -exec echo "=== {} ===" \; -exec cat {} \;
# Print results of each rosunit-*.xml file
# Get rosunit*.xml file path from rostest-*.xml file by usig awk and cut.
# Files are assumed to include "xxx results are in [/home/xxx/rosunit-yy.xml]"
cat $(find ~/.ros/test_results -type f -iname "*`basename $test_file .test`.xml" -print -exec echo "=== {} ===" \; -exec cat {} \; | grep "results are in" | awk -F'results are in ' '{print $2}' | cut -d\[ -f2 | cut -d\] -f1)
travis_time_end 31
fi
done
Expand Down
8 changes: 4 additions & 4 deletions sample/SampleRobot/samplerobot_sequence_player.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,19 +66,19 @@ def checkJointAngles (var_doc):
p = var_doc
else:
p = var_doc['pos']
ret = checkArrayEquality(rtm.readDataPort(hcf.sh.port("qOut")).data, p)
ret = checkArrayEquality(hcf.sh_svc.getCommand().jointRefs, p)
print " pos => ", ret

def checkJointAnglesBetween(from_doc, to_doc):
p0 = from_doc if isinstance(from_doc, list) else from_doc['pos']
p1 = to_doc if isinstance( to_doc, list) else to_doc['pos']
ret = checkArrayBetween(p0, rtm.readDataPort(hcf.sh.port("qOut")).data, p1)
ret = checkArrayBetween(p0, hcf.sh_svc.getCommand().jointRefs, p1)
print " pos => ", ret
assert(ret is True)

def checkZmp(var_doc):
zmp=rtm.readDataPort(hcf.sh.port("zmpOut")).data
ret = checkArrayEquality([zmp.x, zmp.y, zmp.z], var_doc['zmp'])
zmp=hcf.sh_svc.getCommand().zmp
ret = checkArrayEquality([zmp[0], zmp[1], zmp[2]], var_doc['zmp'])
print " zmp => ", ret
assert(ret is True)

Expand Down
9 changes: 5 additions & 4 deletions test/test-samplerobot-abc.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,15 @@
sys.path.append(os.path.join(check_output(['pkg-config', 'hrpsys-base', '--variable=prefix']).rstrip(),'share/hrpsys/samples/SampleRobot/')) # set path to SampleRobot

import samplerobot_auto_balancer
import unittest, rostest

if __name__ == '__main__':
samplerobot_auto_balancer.demo()
class TestSampleRobotAutoBalancer(unittest.TestCase):
def test_demo (self):
samplerobot_auto_balancer.demo()

## IGNORE ME: this code used for rostest
if [s for s in sys.argv if "--gtest_output=xml:" in s] :
import unittest, rostest
rostest.run('hrpsys', 'samplerobot_auto_balancer', unittest.TestCase, sys.argv)
rostest.run('hrpsys', 'samplerobot_auto_balancer', TestSampleRobotAutoBalancer, sys.argv)



Expand Down
9 changes: 5 additions & 4 deletions test/test-samplerobot-collision.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,15 @@
sys.path.append(os.path.join(check_output(['pkg-config', 'hrpsys-base', '--variable=prefix']).rstrip(),'share/hrpsys/samples/SampleRobot/')) # set path to SampleRobot

import samplerobot_collision_detector
import unittest, rostest

if __name__ == '__main__':
samplerobot_collision_detector.demo()
class TestSampleRobotCollisionDetector(unittest.TestCase):
def test_demo (self):
samplerobot_collision_detector.demo()

## IGNORE ME: this code used for rostest
if [s for s in sys.argv if "--gtest_output=xml:" in s] :
import unittest, rostest
rostest.run('hrpsys', 'samplerobot_collision_detector', unittest.TestCase, sys.argv)
rostest.run('hrpsys', 'samplerobot_collision_detector', TestSampleRobotCollisionDetector, sys.argv)



Expand Down
9 changes: 5 additions & 4 deletions test/test-samplerobot-datalogger.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,15 @@
sys.path.append(os.path.join(check_output(['pkg-config', 'hrpsys-base', '--variable=prefix']).rstrip(),'share/hrpsys/samples/SampleRobot/')) # set path to SampleRobot

import samplerobot_data_logger
import unittest, rostest

if __name__ == '__main__':
samplerobot_data_logger.demo()
class TestSampleRobotDataLogger(unittest.TestCase):
def test_demo (self):
samplerobot_data_logger.demo()

## IGNORE ME: this code used for rostest
if [s for s in sys.argv if "--gtest_output=xml:" in s] :
import unittest, rostest
rostest.run('hrpsys', 'samplerobot_data_logger', unittest.TestCase, sys.argv)
rostest.run('hrpsys', 'samplerobot_data_logger', TestSampleRobotDataLogger, sys.argv)



Expand Down
8 changes: 5 additions & 3 deletions test/test-samplerobot-el.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,16 @@
sys.path.append(os.path.join(check_output(['pkg-config', 'hrpsys-base', '--variable=prefix']).rstrip(),'share/hrpsys/samples/SampleRobot/')) # set path to SampleRobot

import samplerobot_soft_error_limiter
import unittest, rostest

if __name__ == '__main__':
samplerobot_soft_error_limiter.demo()
class TestSampleRobotSoftErrorLimiter(unittest.TestCase):
def test_demo (self):
samplerobot_soft_error_limiter.demo()

## IGNORE ME: this code used for rostest
if [s for s in sys.argv if "--gtest_output=xml:" in s] :
import unittest, rostest
rostest.run('hrpsys', 'samplerobot_soft_error_limiter', unittest.TestCase, sys.argv)
rostest.run('hrpsys', 'samplerobot_soft_error_limiter', TestSampleRobotSoftErrorLimiter, sys.argv)



Expand Down
9 changes: 5 additions & 4 deletions test/test-samplerobot-emergency.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,15 @@
sys.path.append(os.path.join(check_output(['pkg-config', 'hrpsys-base', '--variable=prefix']).rstrip(),'share/hrpsys/samples/SampleRobot/')) # set path to SampleRobot

import samplerobot_emergency_stopper
import unittest, rostest

if __name__ == '__main__':
samplerobot_emergency_stopper.demo()
class TestSampleRobotEmergencyStopper(unittest.TestCase):
def test_demo (self):
samplerobot_emergency_stopper.demo()

## IGNORE ME: this code used for rostest
if [s for s in sys.argv if "--gtest_output=xml:" in s] :
import unittest, rostest
rostest.run('hrpsys', 'samplerobot_emergency_stopper', unittest.TestCase, sys.argv)
rostest.run('hrpsys', 'samplerobot_emergency_stopper', TestSampleRobotEmergencyStopper, sys.argv)



Expand Down
9 changes: 5 additions & 4 deletions test/test-samplerobot-kf.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,15 @@
sys.path.append(os.path.join(check_output(['pkg-config', 'hrpsys-base', '--variable=prefix']).rstrip(),'share/hrpsys/samples/SampleRobot/')) # set path to SampleRobot

import samplerobot_kalman_filter
import unittest, rostest

if __name__ == '__main__':
samplerobot_kalman_filter.demo()
class TestSampleRobotKalmanFilter(unittest.TestCase):
def test_demo (self):
samplerobot_kalman_filter.demo()

## IGNORE ME: this code used for rostest
if [s for s in sys.argv if "--gtest_output=xml:" in s] :
import unittest, rostest
rostest.run('hrpsys', 'samplerobot_kalman_filter', unittest.TestCase, sys.argv)
rostest.run('hrpsys', 'samplerobot_kalman_filter', TestSampleRobotKalmanFilter, sys.argv)



Expand Down
9 changes: 5 additions & 4 deletions test/test-samplerobot-rmfo.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,15 @@
sys.path.append(os.path.join(check_output(['pkg-config', 'hrpsys-base', '--variable=prefix']).rstrip(),'share/hrpsys/samples/SampleRobot/')) # set path to SampleRobot

import samplerobot_remove_force_offset
import unittest, rostest

if __name__ == '__main__':
samplerobot_remove_force_offset.demo()
class TestSampleRobotRemoveForceOffset(unittest.TestCase):
def test_demo (self):
samplerobot_remove_force_offset.demo()

## IGNORE ME: this code used for rostest
if [s for s in sys.argv if "--gtest_output=xml:" in s] :
import unittest, rostest
rostest.run('hrpsys', 'samplerobot_remove_force_offset', unittest.TestCase, sys.argv)
rostest.run('hrpsys', 'samplerobot_remove_force_offset', TestSampleRobotRemoveForceOffset, sys.argv)



Expand Down
9 changes: 5 additions & 4 deletions test/test-samplerobot-sequence.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,15 @@
sys.path.append(os.path.join(check_output(['pkg-config', 'hrpsys-base', '--variable=prefix']).rstrip(),'share/hrpsys/samples/SampleRobot/')) # set path to SampleRobot

import samplerobot_sequence_player
import unittest, rostest

if __name__ == '__main__':
samplerobot_sequence_player.demo()
class TestSampleRobotSequencePlayer(unittest.TestCase):
def test_demo (self):
samplerobot_sequence_player.demo()

## IGNORE ME: this code used for rostest
if [s for s in sys.argv if "--gtest_output=xml:" in s] :
import unittest, rostest
rostest.run('hrpsys', 'samplerobot_sequence_player', unittest.TestCase, sys.argv)
rostest.run('hrpsys', 'samplerobot_sequence_player', TestSampleRobotSequencePlayer, sys.argv)



Expand Down
9 changes: 5 additions & 4 deletions test/test-samplerobot-st.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,15 @@
sys.path.append(os.path.join(check_output(['pkg-config', 'hrpsys-base', '--variable=prefix']).rstrip(),'share/hrpsys/samples/SampleRobot/')) # set path to SampleRobot

import samplerobot_stabilizer
import unittest, rostest

if __name__ == '__main__':
samplerobot_stabilizer.demo()
class TestSampleRobotStabilizer(unittest.TestCase):
def test_demo (self):
samplerobot_stabilizer.demo()

## IGNORE ME: this code used for rostest
if [s for s in sys.argv if "--gtest_output=xml:" in s] :
import unittest, rostest
rostest.run('hrpsys', 'samplerobot_stabilizer', unittest.TestCase, sys.argv)
rostest.run('hrpsys', 'samplerobot_stabilizer', TestSampleRobotStabilizer, sys.argv)



Expand Down