plotjuggler: add mac support (#23344)

* plotjuggler: add mac support

* fix test?

* update readme

* oops

* fix

* cleanup

* typo

* works

* little more

* fix test

* little faster
old-commit-hash: c26f294218
This commit is contained in:
Adeeb Shihadeh
2021-12-31 16:44:57 -08:00
committed by GitHub
parent d710eed2d9
commit 3b0d5834bd
4 changed files with 65 additions and 53 deletions

View File

@@ -7,27 +7,20 @@ import unittest
from common.basedir import BASEDIR
from common.timeout import Timeout
from selfdrive.test.openpilotci import get_url
from tools.plotjuggler.juggle import install
class TestPlotJuggler(unittest.TestCase):
def test_install(self):
exit_code = os.system(os.path.join(BASEDIR, "tools/plotjuggler/install.sh"))
self.assertEqual(exit_code, 0)
def test_demo(self):
install()
def test_run(self):
pj = os.path.join(BASEDIR, "tools/plotjuggler/juggle.py")
p = subprocess.Popen(f'QT_QPA_PLATFORM=offscreen {pj} --demo None 1 --qlog',
stderr=subprocess.PIPE, shell=True, start_new_session=True)
test_url = get_url("ffccc77938ddbc44|2021-01-04--16-55-41", 0)
# Launch PlotJuggler with the executable in the bin directory
os.environ["PLOTJUGGLER_PATH"] = f'{os.path.join(BASEDIR, "tools/plotjuggler/bin/plotjuggler")}'
p = subprocess.Popen(f'QT_QPA_PLATFORM=offscreen {os.path.join(BASEDIR, "tools/plotjuggler/juggle.py")} \
"{test_url}"', stderr=subprocess.PIPE, shell=True,
start_new_session=True)
# Wait max 60 seconds for the "Done reading Rlog data" signal from the plugin
# Wait for "Done reading Rlog data" signal from the plugin
output = "\n"
with Timeout(120, error_msg=output):
with Timeout(180, error_msg=output):
while output.splitlines()[-1] != "Done reading Rlog data":
output += p.stderr.readline().decode("utf-8")