|
@@ -13,6 +13,40 @@ import diagnose_mod_ui
|
|
|
|
|
|
|
|
|
|
|
|
|
class DiagnoseModUiTests(unittest.TestCase):
|
|
class DiagnoseModUiTests(unittest.TestCase):
|
|
|
|
|
+ def test_expected_board_links_cover_all_boundary_and_voice_cables(self):
|
|
|
|
|
+ links = diagnose_mod_ui.load_mod_ui_board_links(
|
|
|
|
|
+ ROOT / "config" / "desired-state.yaml"
|
|
|
|
|
+ )
|
|
|
|
|
+ self.assertEqual(
|
|
|
|
|
+ links,
|
|
|
|
|
+ (
|
|
|
|
|
+ ("/graph/capture_1", "/graph/rigforge_nam/input"),
|
|
|
|
|
+ ("/graph/rigforge_ir/out", "/graph/playback_1"),
|
|
|
|
|
+ ("/graph/capture_2", "/graph/playback_2"),
|
|
|
|
|
+ ("/graph/capture_4", "/graph/playback_4"),
|
|
|
|
|
+ (
|
|
|
|
|
+ "/graph/capture_3",
|
|
|
|
|
+ "/graph/rigforge_voice_high_pass/in",
|
|
|
|
|
+ ),
|
|
|
|
|
+ (
|
|
|
|
|
+ "/graph/rigforge_voice_high_pass/out",
|
|
|
|
|
+ "/graph/rigforge_voice_compressor/in",
|
|
|
|
|
+ ),
|
|
|
|
|
+ (
|
|
|
|
|
+ "/graph/rigforge_voice_compressor/out",
|
|
|
|
|
+ "/graph/rigforge_voice_de_esser/in",
|
|
|
|
|
+ ),
|
|
|
|
|
+ (
|
|
|
|
|
+ "/graph/rigforge_voice_de_esser/out",
|
|
|
|
|
+ "/graph/rigforge_voice_reverb/input_l",
|
|
|
|
|
+ ),
|
|
|
|
|
+ (
|
|
|
|
|
+ "/graph/rigforge_voice_reverb/output_l",
|
|
|
|
|
+ "/graph/playback_3",
|
|
|
|
|
+ ),
|
|
|
|
|
+ ),
|
|
|
|
|
+ )
|
|
|
|
|
+
|
|
|
def setUp(self):
|
|
def setUp(self):
|
|
|
self.temp = tempfile.TemporaryDirectory()
|
|
self.temp = tempfile.TemporaryDirectory()
|
|
|
self.addCleanup(self.temp.cleanup)
|
|
self.addCleanup(self.temp.cleanup)
|
|
@@ -20,8 +54,10 @@ class DiagnoseModUiTests(unittest.TestCase):
|
|
|
self.state_path = self.root / "state.yaml"
|
|
self.state_path = self.root / "state.yaml"
|
|
|
self.last_state = self.root / ".local" / "share" / "rigforge" / "mod-ui" / "last.json"
|
|
self.last_state = self.root / ".local" / "share" / "rigforge" / "mod-ui" / "last.json"
|
|
|
self.last_state.parent.mkdir(parents=True)
|
|
self.last_state.parent.mkdir(parents=True)
|
|
|
|
|
+ self.board = self.root / "rigforge.pedalboard"
|
|
|
|
|
+ self.board.mkdir()
|
|
|
self.last_state.write_text(
|
|
self.last_state.write_text(
|
|
|
- json.dumps({"pedalboard": "/tmp/rigforge.pedalboard"}),
|
|
|
|
|
|
|
+ json.dumps({"pedalboard": str(self.board)}),
|
|
|
encoding="utf-8",
|
|
encoding="utf-8",
|
|
|
)
|
|
)
|
|
|
self.state_path.write_text(
|
|
self.state_path.write_text(
|
|
@@ -43,12 +79,15 @@ class DiagnoseModUiTests(unittest.TestCase):
|
|
|
patch.object(
|
|
patch.object(
|
|
|
diagnose_mod_ui,
|
|
diagnose_mod_ui,
|
|
|
"load_mod_ui_board_links",
|
|
"load_mod_ui_board_links",
|
|
|
- return_value=(("/graph/a/out", "/graph/b/in"),),
|
|
|
|
|
|
|
+ return_value=(("/graph/capture_1", "/graph/rigforge_nam/input"),),
|
|
|
),
|
|
),
|
|
|
patch.object(
|
|
patch.object(
|
|
|
diagnose_mod_ui,
|
|
diagnose_mod_ui,
|
|
|
"_resolve_host_alias",
|
|
"_resolve_host_alias",
|
|
|
- side_effect=lambda port: port,
|
|
|
|
|
|
|
+ side_effect=lambda port: {
|
|
|
|
|
+ "/graph/capture_1": "source:out",
|
|
|
|
|
+ "/graph/rigforge_nam/input": "sink:in",
|
|
|
|
|
+ }.get(port),
|
|
|
),
|
|
),
|
|
|
):
|
|
):
|
|
|
status, messages = diagnose_mod_ui.inspect_runtime(
|
|
status, messages = diagnose_mod_ui.inspect_runtime(
|
|
@@ -63,7 +102,12 @@ class DiagnoseModUiTests(unittest.TestCase):
|
|
|
|
|
|
|
|
self.assertEqual(status, 1)
|
|
self.assertEqual(status, 1)
|
|
|
self.assertTrue(any("1 plugins, 1 connections" in message for message in messages))
|
|
self.assertTrue(any("1 plugins, 1 connections" in message for message in messages))
|
|
|
- self.assertTrue(any("ERROR: Missing declared pedalboard PipeWire links" in message for message in messages))
|
|
|
|
|
|
|
+ self.assertTrue(
|
|
|
|
|
+ any(
|
|
|
|
|
+ "ERROR: Missing declared pedalboard PipeWire links" in message
|
|
|
|
|
+ for message in messages
|
|
|
|
|
+ )
|
|
|
|
|
+ )
|
|
|
|
|
|
|
|
def test_succeeds_when_bundle_and_all_declared_links_are_present(self):
|
|
def test_succeeds_when_bundle_and_all_declared_links_are_present(self):
|
|
|
info = {
|
|
info = {
|
|
@@ -77,12 +121,15 @@ class DiagnoseModUiTests(unittest.TestCase):
|
|
|
patch.object(
|
|
patch.object(
|
|
|
diagnose_mod_ui,
|
|
diagnose_mod_ui,
|
|
|
"load_mod_ui_board_links",
|
|
"load_mod_ui_board_links",
|
|
|
- return_value=(("source:out", "sink:in"),),
|
|
|
|
|
|
|
+ return_value=(("/graph/capture_1", "/graph/rigforge_nam/input"),),
|
|
|
),
|
|
),
|
|
|
patch.object(
|
|
patch.object(
|
|
|
diagnose_mod_ui,
|
|
diagnose_mod_ui,
|
|
|
"_resolve_host_alias",
|
|
"_resolve_host_alias",
|
|
|
- side_effect=lambda port: port,
|
|
|
|
|
|
|
+ side_effect=lambda port: {
|
|
|
|
|
+ "/graph/capture_1": "source:out",
|
|
|
|
|
+ "/graph/rigforge_nam/input": "sink:in",
|
|
|
|
|
+ }.get(port),
|
|
|
),
|
|
),
|
|
|
):
|
|
):
|
|
|
status, messages = diagnose_mod_ui.inspect_runtime(
|
|
status, messages = diagnose_mod_ui.inspect_runtime(
|
|
@@ -96,7 +143,9 @@ class DiagnoseModUiTests(unittest.TestCase):
|
|
|
)
|
|
)
|
|
|
|
|
|
|
|
self.assertEqual(status, 0)
|
|
self.assertEqual(status, 0)
|
|
|
- self.assertTrue(any("All 1 declared voice-chain links" in message for message in messages))
|
|
|
|
|
|
|
+ self.assertTrue(
|
|
|
|
|
+ any("All 1 declared pedalboard links" in message for message in messages)
|
|
|
|
|
+ )
|
|
|
|
|
|
|
|
def test_empty_last_state_falls_back_to_active_mod_ui_api(self):
|
|
def test_empty_last_state_falls_back_to_active_mod_ui_api(self):
|
|
|
self.last_state.write_text(json.dumps({"pedalboard": ""}), encoding="utf-8")
|
|
self.last_state.write_text(json.dumps({"pedalboard": ""}), encoding="utf-8")
|
|
@@ -111,9 +160,16 @@ class DiagnoseModUiTests(unittest.TestCase):
|
|
|
patch.object(
|
|
patch.object(
|
|
|
diagnose_mod_ui,
|
|
diagnose_mod_ui,
|
|
|
"load_mod_ui_board_links",
|
|
"load_mod_ui_board_links",
|
|
|
- return_value=(("source:out", "sink:in"),),
|
|
|
|
|
|
|
+ return_value=(("/graph/capture_1", "/graph/rigforge_nam/input"),),
|
|
|
|
|
+ ),
|
|
|
|
|
+ patch.object(
|
|
|
|
|
+ diagnose_mod_ui,
|
|
|
|
|
+ "_resolve_host_alias",
|
|
|
|
|
+ side_effect=lambda port: {
|
|
|
|
|
+ "/graph/capture_1": "source:out",
|
|
|
|
|
+ "/graph/rigforge_nam/input": "sink:in",
|
|
|
|
|
+ }.get(port),
|
|
|
),
|
|
),
|
|
|
- patch.object(diagnose_mod_ui, "_resolve_host_alias", side_effect=lambda port: port),
|
|
|
|
|
):
|
|
):
|
|
|
status, messages = diagnose_mod_ui.inspect_runtime(
|
|
status, messages = diagnose_mod_ui.inspect_runtime(
|
|
|
self.state_path,
|
|
self.state_path,
|
|
@@ -128,6 +184,88 @@ class DiagnoseModUiTests(unittest.TestCase):
|
|
|
self.assertEqual(status, 0)
|
|
self.assertEqual(status, 0)
|
|
|
self.assertTrue(any("Active pedalboard reported by mod-ui API" in m for m in messages))
|
|
self.assertTrue(any("Active pedalboard reported by mod-ui API" in m for m in messages))
|
|
|
|
|
|
|
|
|
|
+ def test_empty_saved_bundle_directory_uses_active_board_info(self):
|
|
|
|
|
+ bundle = self.root / "empty.pedalboard"
|
|
|
|
|
+ if bundle.exists():
|
|
|
|
|
+ bundle.rmdir()
|
|
|
|
|
+ bundle.mkdir()
|
|
|
|
|
+ self.last_state.write_text(
|
|
|
|
|
+ json.dumps({"pedalboard": str(bundle)}),
|
|
|
|
|
+ encoding="utf-8",
|
|
|
|
|
+ )
|
|
|
|
|
+ info = {
|
|
|
|
|
+ "title": "Rigforge",
|
|
|
|
|
+ "plugins": [{"uri": "urn:test"}],
|
|
|
|
|
+ "connections": [{"source": "a", "target": "b"}],
|
|
|
|
|
+ }
|
|
|
|
|
+ with (
|
|
|
|
|
+ patch.object(diagnose_mod_ui.Path, "home", return_value=self.root),
|
|
|
|
|
+ patch.object(diagnose_mod_ui, "fetch_pedalboard_info", side_effect=RuntimeError("invalid empty bundle")),
|
|
|
|
|
+ patch.object(diagnose_mod_ui, "fetch_active_pedalboard_info", return_value=info),
|
|
|
|
|
+ patch.object(
|
|
|
|
|
+ diagnose_mod_ui,
|
|
|
|
|
+ "load_mod_ui_board_links",
|
|
|
|
|
+ return_value=(("/graph/capture_1", "/graph/rigforge_nam/input"),),
|
|
|
|
|
+ ),
|
|
|
|
|
+ patch.object(
|
|
|
|
|
+ diagnose_mod_ui,
|
|
|
|
|
+ "_resolve_host_alias",
|
|
|
|
|
+ side_effect=lambda port: {
|
|
|
|
|
+ "/graph/capture_1": "source:out",
|
|
|
|
|
+ "/graph/rigforge_nam/input": "sink:in",
|
|
|
|
|
+ }.get(port),
|
|
|
|
|
+ ),
|
|
|
|
|
+ ):
|
|
|
|
|
+ status, messages = diagnose_mod_ui.inspect_runtime(
|
|
|
|
|
+ self.state_path,
|
|
|
|
|
+ "127.0.0.1",
|
|
|
|
|
+ 8888,
|
|
|
|
|
+ runner=lambda *_args, **_kwargs: SimpleNamespace(
|
|
|
|
|
+ returncode=0,
|
|
|
|
|
+ stdout="source:out\n |-> sink:in\n",
|
|
|
|
|
+ ),
|
|
|
|
|
+ )
|
|
|
|
|
+
|
|
|
|
|
+ self.assertEqual(status, 0)
|
|
|
|
|
+ self.assertTrue(
|
|
|
|
|
+ any("Active pedalboard reported by mod-ui API" in message for message in messages)
|
|
|
|
|
+ )
|
|
|
|
|
+
|
|
|
|
|
+ def test_missing_selected_board_falls_back_to_active_mod_ui_api(self):
|
|
|
|
|
+ self.last_state.write_text(
|
|
|
|
|
+ json.dumps({"pedalboard": "/missing/selected-board.pedalboard"}),
|
|
|
|
|
+ encoding="utf-8",
|
|
|
|
|
+ )
|
|
|
|
|
+ info = {
|
|
|
|
|
+ "title": "Rigforge",
|
|
|
|
|
+ "bundlepath": "/runtime/active-board.pedalboard",
|
|
|
|
|
+ "plugins": [{"uri": "urn:test"}],
|
|
|
|
|
+ "connections": [],
|
|
|
|
|
+ }
|
|
|
|
|
+ with (
|
|
|
|
|
+ patch.object(diagnose_mod_ui.Path, "home", return_value=self.root),
|
|
|
|
|
+ patch.object(diagnose_mod_ui, "fetch_active_pedalboard_info", return_value=info),
|
|
|
|
|
+ patch.object(
|
|
|
|
|
+ diagnose_mod_ui,
|
|
|
|
|
+ "load_mod_ui_board_links",
|
|
|
|
|
+ return_value=(),
|
|
|
|
|
+ ),
|
|
|
|
|
+ ):
|
|
|
|
|
+ status, messages = diagnose_mod_ui.inspect_runtime(
|
|
|
|
|
+ self.state_path,
|
|
|
|
|
+ "127.0.0.1",
|
|
|
|
|
+ 8888,
|
|
|
|
|
+ runner=lambda *_args, **_kwargs: SimpleNamespace(
|
|
|
|
|
+ returncode=0,
|
|
|
|
|
+ stdout="",
|
|
|
|
|
+ ),
|
|
|
|
|
+ )
|
|
|
|
|
+
|
|
|
|
|
+ self.assertEqual(status, 0)
|
|
|
|
|
+ self.assertTrue(
|
|
|
|
|
+ any("Active pedalboard reported by mod-ui API: /runtime/active-board.pedalboard" in m for m in messages)
|
|
|
|
|
+ )
|
|
|
|
|
+
|
|
|
def test_resolves_guitar_capture_to_nam_audio_port(self):
|
|
def test_resolves_guitar_capture_to_nam_audio_port(self):
|
|
|
self.assertEqual(
|
|
self.assertEqual(
|
|
|
diagnose_mod_ui._resolve_host_alias("/graph/capture_1"),
|
|
diagnose_mod_ui._resolve_host_alias("/graph/capture_1"),
|
|
@@ -137,6 +275,18 @@ class DiagnoseModUiTests(unittest.TestCase):
|
|
|
diagnose_mod_ui._resolve_host_alias("/graph/rigforge_nam/input"),
|
|
diagnose_mod_ui._resolve_host_alias("/graph/rigforge_nam/input"),
|
|
|
"effect_0:input",
|
|
"effect_0:input",
|
|
|
)
|
|
)
|
|
|
|
|
+ self.assertEqual(
|
|
|
|
|
+ diagnose_mod_ui._resolve_host_alias(
|
|
|
|
|
+ "/graph/rigforge_voice_reverb/input_l"
|
|
|
|
|
+ ),
|
|
|
|
|
+ "effect_5:lv2_audio_in_1",
|
|
|
|
|
+ )
|
|
|
|
|
+ self.assertEqual(
|
|
|
|
|
+ diagnose_mod_ui._resolve_host_alias(
|
|
|
|
|
+ "/graph/rigforge_voice_reverb/output_l"
|
|
|
|
|
+ ),
|
|
|
|
|
+ "effect_5:lv2_audio_out_1",
|
|
|
|
|
+ )
|
|
|
|
|
|
|
|
|
|
|
|
|
if __name__ == "__main__":
|
|
if __name__ == "__main__":
|