test-rtshell-setup.py
Go to the documentation of this file.
00001 #!/usr/bin/env python
00002 
00003 PKG = 'openrtm_tools'
00004 NAME = 'test-rthsell-setup'
00005 
00006 import unittest, os, sys
00007 import subprocess
00008 from subprocess import call, check_output, Popen, PIPE, STDOUT
00009 
00010 class TestOpenrtmTools(unittest.TestCase):
00011 
00012     def run_rt_command(self, command):
00013         pkg_path = check_output("rospack find openrtm_tools", shell=True).rstrip()
00014         script = os.path.join(pkg_path, "scripts/rtshell-setup.sh")
00015         self.assertTrue(os.path.exists(script))
00016         try:
00017             check_output("bash -c 'source %s; RTCTREE_NAMESERVERS=localhost:2809 %s'"%(script, command), shell=True, stderr=subprocess.STDOUT)
00018         except subprocess.CalledProcessError, (e):
00019             self.assertTrue(False, 'subprocess.CalledProcessError: cmd:%s returncode:%s output:%s' % (e.cmd, e.returncode, e.output))
00020         self.assertTrue(True) # ok rtls works
00021 
00022     def test_rtls(self):
00023         self.run_rt_command('rtls')
00024 
00025     def test_rtprint(self):
00026         self.run_rt_command('rtprint -n1 localhost:2809/SequenceOutComponent0.rtc:Float')
00027         self.run_rt_command('rtprint -n1 localhost:2809/SequenceOutComponent0.rtc:FloatSeq')
00028 
00029     def test_rtcat(self):
00030         self.run_rt_command('rtcat localhost:2809/SequenceOutComponent0.rtc')
00031 
00032 #unittest.main()
00033 if __name__ == '__main__':
00034     import rostest
00035     rostest.run(PKG, NAME, TestOpenrtmTools, sys.argv)


openrtm_tools
Author(s): Kei Okada
autogenerated on Mon Oct 6 2014 07:17:55