From 4caecf21439eb65cedb25df589b140c9c09e26fc Mon Sep 17 00:00:00 2001 From: Shane Smiskol Date: Fri, 26 Jul 2024 21:14:06 -0700 Subject: [PATCH] test_onroad: use zstd compression (#33100) * 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 --- selfdrive/test/test_onroad.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/selfdrive/test/test_onroad.py b/selfdrive/test/test_onroad.py index 1e4669fb0a6b16..d78d2294ad276f 100644 --- a/selfdrive/test/test_onroad.py +++ b/selfdrive/test/test_onroad.py @@ -1,4 +1,3 @@ -import bz2 import math import json import os @@ -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 @@ -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 """ @@ -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 @@ -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'):