Skip to content

Commit

Permalink
test_onroad: use zstd compression (commaai#33100)
Browse files Browse the repository at this point in the history
* use zstd in test_onroad

* debug

* now leans towards 0.4 instead of 0.5

* 5x runs

* better

* more

* Update selfdrive/test/test_onroad.py

* revert Jenkinsfile

* and this
  • Loading branch information
sshane authored Jul 27, 2024
1 parent 7dec7c3 commit 4caecf2
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions selfdrive/test/test_onroad.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import bz2
import math
import json
import os
Expand All @@ -9,6 +8,7 @@
import subprocess
import time
import numpy as np
import zstd
from collections import Counter, defaultdict
from functools import cached_property
from pathlib import Path
Expand All @@ -20,9 +20,10 @@
from openpilot.common.timeout import Timeout
from openpilot.common.params import Params
from openpilot.selfdrive.controls.lib.events import EVENTS, ET
from openpilot.system.hardware import HARDWARE
from openpilot.selfdrive.test.helpers import set_params_enabled, release_only
from openpilot.system.hardware import HARDWARE
from openpilot.system.hardware.hw import Paths
from openpilot.system.loggerd.uploader import LOG_COMPRESSION_LEVEL
from openpilot.tools.lib.logreader import LogReader

"""
Expand Down Expand Up @@ -166,10 +167,10 @@ def setup_class(cls):
cls.log_sizes = {}
for f in cls.log_path.iterdir():
assert f.is_file()
cls.log_sizes[f] = f.stat().st_size / 1e6
cls.log_sizes[f] = f.stat().st_size / 1e6
if f.name in ("qlog", "rlog"):
with open(f, 'rb') as ff:
cls.log_sizes[f] = len(bz2.compress(ff.read())) / 1e6
cls.log_sizes[f] = len(zstd.compress(ff.read(), LOG_COMPRESSION_LEVEL)) / 1e6


@cached_property
Expand Down Expand Up @@ -206,7 +207,7 @@ def test_log_sizes(self):
if f.name == "qcamera.ts":
assert 2.15 < sz < 2.35
elif f.name == "qlog":
assert 0.4 < sz < 0.6
assert 0.4 < sz < 0.5
elif f.name == "rlog":
assert 5 < sz < 50
elif f.name.endswith('.hevc'):
Expand Down

0 comments on commit 4caecf2

Please sign in to comment.