test onroad: explicit memory leak check (#28502)
old-commit-hash: 2f117e88b775a0b53a3ae99ae943caaa66f952f2
This commit is contained in:
@@ -262,7 +262,6 @@ class Controls:
|
||||
if self.sm['deviceState'].freeSpacePercent < 7 and not SIMULATION:
|
||||
# under 7% of space free no enable allowed
|
||||
self.events.add(EventName.outOfSpace)
|
||||
# TODO: make tici threshold the same
|
||||
if self.sm['deviceState'].memoryUsagePercent > 90 and not SIMULATION:
|
||||
self.events.add(EventName.lowMemory)
|
||||
|
||||
|
||||
@@ -113,6 +113,7 @@ class TestOnroad(unittest.TestCase):
|
||||
os.environ['TESTING_CLOSET'] = '1'
|
||||
if os.path.exists(ROOT):
|
||||
shutil.rmtree(ROOT)
|
||||
os.system("rm /dev/shm/*")
|
||||
|
||||
# Make sure athena isn't running
|
||||
os.system("pkill -9 -f athena")
|
||||
@@ -256,6 +257,14 @@ class TestOnroad(unittest.TestCase):
|
||||
|
||||
self.assertTrue(cpu_ok)
|
||||
|
||||
def test_memory_usage(self):
|
||||
mems = [m.deviceState.memoryUsagePercent for m in self.service_msgs['deviceState']]
|
||||
print("Memory usage: ", mems)
|
||||
|
||||
# check for big leaks. note that memory usage is
|
||||
# expected to go up while the MSGQ buffers fill up
|
||||
self.assertLessEqual(max(mems) - min(mems), 3.0)
|
||||
|
||||
def test_camera_processing_time(self):
|
||||
result = "\n"
|
||||
result += "------------------------------------------------\n"
|
||||
|
||||
Reference in New Issue
Block a user