Files
agnos-builder/userspace/usr/comma/tests/test_sounds.py
T
Adeeb Shihadeh 3668cf59c6 fix rare sound init failure (#138)
* test

* executable

* wait for sound card

* check that too

* update

---------

Co-authored-by: Comma Device <device@comma.ai>
2023-05-11 21:54:10 -07:00

31 lines
788 B
Python
Executable File

#!/usr/bin/env python3
import os
import time
import subprocess
good = """
Starting Sound...
[INFO] Bringing adsp out of reset
subsys4
waiting for sound card to come online
sound card online
sound.service: Succeeded.
Finished Sound.
""".strip()
if __name__ == "__main__":
time.sleep(3)
log = subprocess.check_output("journalctl -o cat -u sound", shell=True, encoding='utf8').strip()
passed = log == good
with open('/data/tmp/sound_log', 'a') as f:
f.write(f"{passed}\n")
os.system("journalctl -u sound.service -o short-monotonic >> /data/tmp/sound_service_log")
os.system("sudo su -c 'tail /data/tmp/sound_log > /dev/console'")
os.system("sudo su -c 'wc -l /data/tmp/sound_log > /dev/console'")
os.sync()
if passed:
time.sleep(2)
os.system("sudo reboot")