|
|
@ -1,8 +1,10 @@ |
|
|
|
#!/usr/bin/env python3 |
|
|
|
#!/usr/bin/env python3 |
|
|
|
|
|
|
|
import json |
|
|
|
import os |
|
|
|
import os |
|
|
|
import time |
|
|
|
|
|
|
|
import subprocess |
|
|
|
import subprocess |
|
|
|
|
|
|
|
import time |
|
|
|
import unittest |
|
|
|
import unittest |
|
|
|
|
|
|
|
from collections import Counter |
|
|
|
from pathlib import Path |
|
|
|
from pathlib import Path |
|
|
|
|
|
|
|
|
|
|
|
import cereal.messaging as messaging |
|
|
|
import cereal.messaging as messaging |
|
|
@ -128,6 +130,16 @@ class TestOnroad(unittest.TestCase): |
|
|
|
|
|
|
|
|
|
|
|
cls.lr = list(LogReader(os.path.join(str(cls.segments[1]), "rlog.bz2"))) |
|
|
|
cls.lr = list(LogReader(os.path.join(str(cls.segments[1]), "rlog.bz2"))) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def test_cloudlog_size(self): |
|
|
|
|
|
|
|
msgs = [m for m in self.lr if m.which() == 'logMessage'] |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
total_size = sum(len(m.as_builder().to_bytes()) for m in msgs) |
|
|
|
|
|
|
|
self.assertLess(total_size, 2.5e5) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
cnt = Counter([json.loads(m.logMessage)['filename'] for m in msgs]) |
|
|
|
|
|
|
|
big_logs = [f for f, n in cnt.most_common(3) if n / sum(cnt.values()) > 30.] |
|
|
|
|
|
|
|
self.assertEqual(len(big_logs), 0, f"Log spam: {big_logs}") |
|
|
|
|
|
|
|
|
|
|
|
def test_cpu_usage(self): |
|
|
|
def test_cpu_usage(self): |
|
|
|
proclogs = [m for m in self.lr if m.which() == 'procLog'] |
|
|
|
proclogs = [m for m in self.lr if m.which() == 'procLog'] |
|
|
|
self.assertGreater(len(proclogs), service_list['procLog'].frequency * 45, "insufficient samples") |
|
|
|
self.assertGreater(len(proclogs), service_list['procLog'].frequency * 45, "insufficient samples") |
|
|
|