Files
StarPilot/openpilot/starpilot/galaxy/tests/test_frpc_asset.py
T
firestar5683 80fbb4f6db Feature registration
Register vehicle controls, planner modes, UI actions and Galaxy services after their providers exist. Wire the shared runtime entrypoints and cover their combined behavior.

Co-authored-by: Adeeb Shihadeh <adeebshihadeh@gmail.com>
Co-authored-by: Daniel Koepping <elkoled@gmail.com>
Co-authored-by: Danny <dannyirwin31@yahoo.com>
Co-authored-by: DimitriChrysafis <Dimitri.chrysafis@gmail.com>
Co-authored-by: Dom <168790843+firestar5683@users.noreply.github.com>
Co-authored-by: Harald Schäfer <harald.the.engineer@gmail.com>
Co-authored-by: Kacper Rączy <gfw.kra@gmail.com>
Co-authored-by: Prabhaav Pillai <prabhaav@msu.edu>
Co-authored-by: dirwin31 <83434411+dirwin31@users.noreply.github.com>
Co-authored-by: firestarsdog <229254897+firestarsdog@users.noreply.github.com>
Co-authored-by: stef <19478336+stefpi@users.noreply.github.com>
Co-authored-by: whoisdomi <dcantu83@gmail.com>

Co-authored-by: Intelli <contact@intelli.software>
Co-authored-by: haraschax <6804392+haraschax@users.noreply.github.com>
Co-authored-by: prabhaavp <prabhaav@msu.edu>
2026-10-14 20:02:39 -05:00

29 lines
1.4 KiB
Python

import hashlib
from pathlib import Path
import tempfile
import unittest
from unittest.mock import patch
from openpilot.starpilot.galaxy import frpc_asset
class FrpcAssetTests(unittest.TestCase):
def test_bundled_linux_arm64_binary_matches_pinned_release(self):
with patch.object(frpc_asset.platform, 'system', return_value='Linux'), \
patch.object(frpc_asset.platform, 'machine', return_value='aarch64'):
self.assertEqual(frpc_asset.bundled_frpc_path(), str(frpc_asset.FRPC_BINARY))
self.assertEqual(hashlib.sha256(frpc_asset.FRPC_BINARY.read_bytes()).hexdigest(), frpc_asset.FRPC_BINARY_SHA256)
self.assertIn('Apache License', (frpc_asset.FRPC_BINARY.parent / 'LICENSE.frp').read_text())
def test_unsupported_platform_or_modified_binary_is_rejected(self):
with patch.object(frpc_asset.platform, 'system', return_value='Darwin'):
self.assertIsNone(frpc_asset.bundled_frpc_path())
with tempfile.TemporaryDirectory() as temporary:
altered = Path(temporary) / 'frpc_linux_arm64'
altered.write_bytes(b'not the pinned frpc')
altered.chmod(0o755)
with patch.object(frpc_asset.platform, 'system', return_value='Linux'), \
patch.object(frpc_asset.platform, 'machine', return_value='aarch64'), \
patch.object(frpc_asset, 'FRPC_BINARY', altered):
self.assertIsNone(frpc_asset.bundled_frpc_path())