Files
StarPilot/openpilot/common/tests/test_params_fork_lock.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

39 lines
1.5 KiB
Python

"""Exercise native inherited Params locks on the Linux host CI filesystem."""
from pathlib import Path
import subprocess
import sys
import tempfile
import unittest
ROOT = Path(__file__).resolve().parents[3]
BINARY = ROOT / "openpilot/common/tests/bin/test_params_fork_lock"
@unittest.skipUnless(sys.platform == "linux", "Linux fork/exec and /proc descriptor contract")
class TestParamsForkLock(unittest.TestCase):
def run_case(self, case):
self.assertTrue(BINARY.is_file(), "Build the native regression target with existing SCons host dependencies")
# Kernel-local /tmp is required: remote/macOS bind mounts can implement flock differently.
with tempfile.TemporaryDirectory(prefix="params-fork-lock-", dir="/tmp") as directory:
result = subprocess.run([str(BINARY), case, directory], cwd=ROOT,
capture_output=True, text=True, timeout=15, check=False)
self.assertEqual(result.returncode, 0, result.stdout + result.stderr)
def test_parent_releases_with_live_fork_child(self):
self.run_case("inherited_release")
def test_child_destructor_keeps_parent_exclusive(self):
self.run_case("child_destructor")
def test_exec_closes_lock_descriptor(self):
self.run_case("exec")
def test_competing_writer_exclusion_and_progress(self):
self.run_case("competitor")
def test_failed_lock_and_eintr_retry(self):
self.run_case("failures_eintr")
def test_real_params_async_batch_and_blocking_io(self):
self.run_case("params_semantics")