Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test_onroad: use zstd compression #33100

Merged
merged 9 commits into from
Jul 27, 2024
Merged
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
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
Loading