Skip to content
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
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ env:

before_script:
- sudo apt-get -qq update
- sudo apt-get install -y libeigen3-dev libcppunit-dev python-sip-dev
- sudo apt-get install -y libeigen3-dev libcppunit-dev python-sip-dev python-psutil
#build orocos_kdl
- cd orocos_kdl
- mkdir build
Expand Down
2 changes: 2 additions & 0 deletions python_orocos_kdl/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
<run_depend>orocos_kdl</run_depend>
<run_depend>python-sip</run_depend>

<test_depend>python-psutil</test_depend>

<export>
<build_type>cmake</build_type>
</export>
Expand Down
33 changes: 31 additions & 2 deletions python_orocos_kdl/tests/kinfamtest.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,14 @@
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA


import gc
import random
import unittest
from PyKDL import *
from math import *
import random

import psutil
from PyKDL import *


class KinfamTestFunctions(unittest.TestCase):

Expand Down Expand Up @@ -143,12 +147,37 @@ def testFkPosAndIkPos(self):
self.assertEqual(q,q_solved)


class KinfamTestTree(unittest.TestCase):

def setUp(self):
self.tree = Tree()
self.tree.addSegment(Segment(Joint(Joint.RotZ),
Frame(Vector(0.0, 0.0, 0.0))), "foo")
self.tree.addSegment(Segment(Joint(Joint.None),
Frame(Vector(0.0, 0.0, 0.0))), "bar")

def testTreeGetChainMemLeak(self):
""" test for the memory leak in Tree.getChain described in issue #211 """
process = psutil.Process()
self.tree.getChain("foo", "bar")
gc.collect()
mem_before = process.memory_info().vms
# needs at least 2000 iterations on my system to cause a detectable
# difference in memory usage
for _ in xrange(10000):
self.tree.getChain("foo", "bar")
gc.collect()
mem_after = process.memory_info().vms
self.assertEqual(mem_before, mem_after)


def suite():
suite = unittest.TestSuite()
suite.addTest(KinfamTestFunctions('testFkPosAndJac'))
suite.addTest(KinfamTestFunctions('testFkVelAndJac'))
suite.addTest(KinfamTestFunctions('testFkVelAndIkVel'))
suite.addTest(KinfamTestFunctions('testFkPosAndIkPos'))
suite.addTest(KinfamTestTree('testTreeGetChainMemLeak'))
return suite


Expand Down