mirror of
https://github.com/mikecarper/MeshCore.git
synced 2026-09-16 06:32:35 +00:00
Apply due radio2 settings by requested start time and expire every old temporary window before starting its successor. Anchor temporary deadlines to command acceptance so idle time before a command cannot shorten the new lease. Keep failed radio2 saves in their original order and retry without rewriting their scheduled timestamps. Give repeater persistence its own backoff and cache the next actionable deadline, preventing repeated writes while allowing temporary windows to start and expire on time. Exercise all 24 slot insertion orders with punctual and delayed servicing, plus adjacent windows, storage failures, command-time anchoring, and timer rollover.
29 lines
1.3 KiB
Python
29 lines
1.3 KiB
Python
"""Run the production shared profile command parser and persistence with a memory FS."""
|
|
from pathlib import Path
|
|
import shutil
|
|
import subprocess
|
|
import tempfile
|
|
import unittest
|
|
|
|
ROOT = Path(__file__).resolve().parents[1]
|
|
|
|
class RadioProfileCLITest(unittest.TestCase):
|
|
def test_commands_persistence_and_timers(self):
|
|
compiler = shutil.which('g++') or shutil.which('clang++')
|
|
self.assertIsNotNone(compiler)
|
|
with tempfile.TemporaryDirectory() as work:
|
|
exe = Path(work) / 'profiles.exe'
|
|
subprocess.run([compiler, '-std=c++17', '-Wall', '-Wextra',
|
|
'-I', str(ROOT/'test/fixtures/radio_profiles/mocks'),
|
|
'-I', str(ROOT/'test/mocks'), '-I', str(ROOT/'src'),
|
|
str(ROOT/'src/helpers/RadioProfileCLI.cpp'),
|
|
str(ROOT/'test/fixtures/radio_profiles/cli_test.cpp'),
|
|
'-o', str(exe)], check=True, capture_output=True, text=True)
|
|
for scenario in (None, 'permanent_order', 'temporary_boundary', 'lease_creation',
|
|
'save_failure', 'schedule_permutations', 'storage_isolation'):
|
|
with self.subTest(scenario=scenario or 'commands_persistence_and_timers'):
|
|
subprocess.run([str(exe)] + ([scenario] if scenario else []), check=True)
|
|
|
|
if __name__ == '__main__':
|
|
unittest.main()
|