mirror of
https://github.com/firestar5683/StarPilot.git
synced 2026-10-04 13:24:13 +08:00
Reserve output while a saved demo is playing
This commit is contained in:
@@ -100,7 +100,8 @@ def playback_process_active(proc=Path('/proc')):
|
||||
if not path.name.isdigit():continue
|
||||
try:cmd=(path/'cmdline').read_bytes().replace(b'\0',b' ')
|
||||
except OSError:continue
|
||||
if any(name in cmd for name in (b'/prototype/app.py',b'/prototype/stored_score.py')):return True
|
||||
if any(name in cmd for name in (b'/prototype/app.py',b'/prototype/stored_score.py',b'/prototype/native_prepared_showcase.py')):return True
|
||||
if b'/prototype/mac_showcase.py' in cmd and b'--audio-worker' in cmd:return True
|
||||
except OSError:return True
|
||||
return False
|
||||
|
||||
|
||||
@@ -69,5 +69,15 @@ class SavedDemoTests(unittest.TestCase):
|
||||
self.assertEqual(self.stops,[])
|
||||
with self.assertRaises(ValueError):self.service.start(self.request)
|
||||
|
||||
def test_prepared_playback_reserves_output_from_calibration(self):
|
||||
from operator_output import playback_process_active
|
||||
proc=self.root/'proc';child=proc/'45';child.mkdir(parents=True)
|
||||
for command in (b'python\0/data/roadscore/prototype/native_prepared_showcase.py\0--demo',
|
||||
b'python\0/data/roadscore/prototype/mac_showcase.py\0--audio-worker'):
|
||||
(child/'cmdline').write_bytes(command)
|
||||
self.assertTrue(playback_process_active(proc))
|
||||
(child/'cmdline').write_bytes(b'python\0/data/roadscore/prototype/worker_service.py')
|
||||
self.assertFalse(playback_process_active(proc))
|
||||
|
||||
|
||||
if __name__=='__main__':unittest.main()
|
||||
|
||||
Reference in New Issue
Block a user