Accept AGNOS 19.8.2

This commit is contained in:
firestar5683
2026-09-25 15:52:36 -05:00
parent ba901b5f55
commit 6cae0cebe7
3 changed files with 38 additions and 5 deletions
+1 -1
View File
@@ -25,7 +25,7 @@ if [ -z "$AGNOS_VERSION" ]; then
fi
if [ -z "$AGNOS_ACCEPTED_VERSIONS" ]; then
export AGNOS_ACCEPTED_VERSIONS="$AGNOS_VERSION"
export AGNOS_ACCEPTED_VERSIONS="19.8.1 19.8.2"
fi
export STAGING_ROOT="/data/safe_staging"
@@ -0,0 +1,30 @@
import ast
from pathlib import Path
from types import SimpleNamespace
import pytest
def load_handle_agnos_update(cur_version: str):
source_path = Path(__file__).parents[1] / "updated.py"
module = ast.parse(source_path.read_text())
function = next(node for node in module.body if isinstance(node, ast.FunctionDef) and node.name == "handle_agnos_update")
def fail(*_args, **_kwargs):
raise AssertionError("accepted AGNOS version attempted to update")
scope = {
"HARDWARE": SimpleNamespace(get_os_version=lambda: cur_version),
"OVERLAY_MERGED": "/unused",
"cloudlog": SimpleNamespace(info=lambda *_args, **_kwargs: None),
"run": lambda *_args, **_kwargs: "19.8.1\n19.8.1 19.8.2\n",
"set_consistent_flag": fail,
}
ast.fix_missing_locations(function)
exec(compile(ast.Module(body=[function], type_ignores=[]), str(source_path), "exec"), scope)
return scope["handle_agnos_update"]
@pytest.mark.parametrize("cur_version", ["19.8.1", "19.8.2"])
def test_accepted_agnos_version_is_not_reflashed(cur_version):
load_handle_agnos_update(cur_version)()
+7 -4
View File
@@ -247,11 +247,14 @@ def handle_agnos_update() -> None:
from openpilot.system.hardware.tici.agnos import flash_agnos_update, get_target_slot_number
cur_version = HARDWARE.get_os_version()
updated_version = run(["bash", "-c", r"unset AGNOS_VERSION && source launch_env.sh && \
echo -n $AGNOS_VERSION"], OVERLAY_MERGED).strip()
version_output = run(["bash", "-c", r'''unset AGNOS_VERSION AGNOS_ACCEPTED_VERSIONS
source launch_env.sh
printf '%s\n%s\n' "$AGNOS_VERSION" "${AGNOS_ACCEPTED_VERSIONS:-$AGNOS_VERSION}"'''], OVERLAY_MERGED)
updated_version, accepted_versions_raw = version_output.splitlines()[:2]
accepted_versions = set(accepted_versions_raw.split()) | {updated_version}
cloudlog.info(f"AGNOS version check: {cur_version} vs {updated_version}")
if cur_version == updated_version:
cloudlog.info(f"AGNOS version check: {cur_version} vs {sorted(accepted_versions)}")
if cur_version in accepted_versions:
return
# prevent an openpilot getting swapped in with a mismatched or partially downloaded agnos