mirror of
https://github.com/dragonpilot/dragonpilot.git
synced 2026-06-25 16:02:14 +08:00
CI: codecov for multiprocessing (#30432)
This commit is contained in:
@@ -213,6 +213,7 @@ jobs:
|
||||
run: |
|
||||
${{ env.RUN }} "CI=1 coverage run selfdrive/test/process_replay/test_processes.py -j$(nproc) && \
|
||||
chmod -R 777 /tmp/comma_download_cache && \
|
||||
coverage combine && \
|
||||
coverage xml"
|
||||
- name: Print diff
|
||||
id: print-diff
|
||||
@@ -282,6 +283,7 @@ jobs:
|
||||
run: |
|
||||
${{ env.RUN_CL }} "unset PYTHONWARNINGS && \
|
||||
ONNXCPU=1 CI=1 NO_NAV=1 coverage run selfdrive/test/process_replay/model_replay.py && \
|
||||
coverage combine && \
|
||||
coverage xml"
|
||||
- name: Run unit tests
|
||||
timeout-minutes: 4
|
||||
|
||||
@@ -199,3 +199,6 @@ flake8-implicit-str-concat.allow-multiline=false
|
||||
"system".msg = "Use openpilot.system"
|
||||
"third_party".msg = "Use openpilot.third_party"
|
||||
"tools".msg = "Use openpilot.tools"
|
||||
|
||||
[tool.coverage.run]
|
||||
concurrency = ["multiprocessing", "thread"]
|
||||
@@ -1,5 +1,6 @@
|
||||
#!/usr/bin/env python3
|
||||
import json
|
||||
import multiprocessing
|
||||
import os
|
||||
import requests
|
||||
import shutil
|
||||
@@ -12,7 +13,6 @@ from datetime import datetime, timedelta
|
||||
from parameterized import parameterized
|
||||
from typing import Optional
|
||||
|
||||
from multiprocessing import Process
|
||||
from pympler.tracker import SummaryTracker
|
||||
from unittest import mock
|
||||
from websocket import ABNF
|
||||
@@ -75,24 +75,25 @@ class TestAthenadMethods(unittest.TestCase):
|
||||
with self.assertRaises(TimeoutError) as _:
|
||||
dispatcher["getMessage"]("controlsState")
|
||||
|
||||
def send_deviceState():
|
||||
messaging.context = messaging.Context()
|
||||
pub_sock = messaging.pub_sock("deviceState")
|
||||
start = time.time()
|
||||
end_event = multiprocessing.Event()
|
||||
|
||||
while time.time() - start < 1:
|
||||
pub_sock = messaging.pub_sock("deviceState")
|
||||
|
||||
def send_deviceState():
|
||||
while not end_event.is_set():
|
||||
msg = messaging.new_message('deviceState')
|
||||
pub_sock.send(msg.to_bytes())
|
||||
time.sleep(0.01)
|
||||
|
||||
p = Process(target=send_deviceState)
|
||||
p = multiprocessing.Process(target=send_deviceState)
|
||||
p.start()
|
||||
time.sleep(0.1)
|
||||
try:
|
||||
deviceState = dispatcher["getMessage"]("deviceState")
|
||||
assert deviceState['deviceState']
|
||||
finally:
|
||||
p.terminate()
|
||||
end_event.set()
|
||||
p.join()
|
||||
|
||||
def test_listDataDirectory(self):
|
||||
route = '2021-03-29--13-32-47'
|
||||
|
||||
Reference in New Issue
Block a user