Run CI tests in parallel (#1962)

* run car model unit tests in parallel

* remove refs to deleted file

* run with coverage

* that wasn't necessary

* as builder

* need a new route for this one too
pull/1964/head
Adeeb Shihadeh 2020-08-02 00:30:09 -07:00 committed by GitHub
parent 58b167d75d
commit 9ee1cc9b82
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 9 additions and 17 deletions

View File

@ -1,3 +0,0 @@
[run]
concurrency=multiprocessing

View File

@ -37,7 +37,7 @@ jobs:
external/bin selfdrive/modeld/runners $TEST_DIR
# need these so docker copy won't fail
cp Pipfile Pipfile.lock .pylintrc .coveragerc-app .pre-commit-config.yaml $TEST_DIR
cp Pipfile Pipfile.lock .pylintrc .pre-commit-config.yaml $TEST_DIR
cd $TEST_DIR
mkdir laika laika_repo tools
- name: Build Docker image
@ -199,8 +199,8 @@ jobs:
run: |
$PERSIST "cd /tmp/openpilot && \
scons -j$(nproc) && \
coverage run --parallel-mode --concurrency=multiprocessing \
--rcfile=./.coveragerc-app selfdrive/test/test_models.py && \
coverage run --parallel-mode -m nose --processes=4 --process-timeout=60 \
selfdrive/test/test_models.py && \
coverage combine"
- name: Upload coverage to Codecov
run: |

View File

@ -81,7 +81,6 @@ RUN mkdir -p /tmp/openpilot
COPY SConstruct \
.pylintrc \
.pre-commit-config.yaml \
.coveragerc-app \
/tmp/openpilot/
COPY ./pyextra /tmp/openpilot/pyextra

View File

@ -1,6 +1,5 @@
from cereal import car
from selfdrive.car.volkswagen.values import CAR, BUTTON_STATES
from common.params import put_nonblocking
from selfdrive.car import STD_CARGO_KG, scale_rot_inertia, scale_tire_stiffness, gen_empty_fingerprint
from selfdrive.car.interfaces import CarInterfaceBase
@ -76,10 +75,11 @@ class CarInterface(CarInterfaceBase):
ret.canValid = self.cp.can_valid and self.cp_cam.can_valid
ret.steeringRateLimited = self.CC.steer_rate_limited if self.CC is not None else False
# TODO: add a field for this to carState, car interface code shouldn't write params
# Update the device metric configuration to match the car at first startup,
# or if there's been a change.
if self.CS.displayMetricUnits != self.displayMetricUnitsPrev:
put_nonblocking("IsMetric", "1" if self.CS.displayMetricUnits else "0")
#if self.CS.displayMetricUnits != self.displayMetricUnitsPrev:
# put_nonblocking("IsMetric", "1" if self.CS.displayMetricUnits else "0")
# Check for and process state-change events (button press or release) from
# the turn stalk switch or ACC steering wheel/control stalk buttons.

View File

@ -7,7 +7,6 @@ from collections import Counter
from parameterized import parameterized_class
from cereal import log, car
import cereal.messaging as messaging
from selfdrive.car.fingerprints import all_known_cars
from selfdrive.car.car_helpers import interfaces
from selfdrive.test.test_car_models import routes, non_tested_cars
@ -29,6 +28,7 @@ ignore_can_valid = [
"TOYOTA COROLLA 2017",
"LEXUS RX HYBRID 2017",
"TOYOTA AVALON 2016",
"HONDA PILOT 2019 ELITE",
]
@parameterized_class(('car_model'), [(car,) for car in all_known_cars()])
@ -99,14 +99,10 @@ class TestCarModel(unittest.TestCase):
can_invalid_cnt = 0
CC = car.CarControl.new_message()
for msg in self.can_msgs:
# filter out openpilot msgs
can = [m for m in msg.can if m.src < 128]
can_pkt = messaging.new_message('can', len(can))
can_pkt.can = can
CS = self.CI.update(CC, (can_pkt.to_bytes(),))
CS = self.CI.update(CC, (msg.as_builder().to_bytes(),))
self.CI.apply(CC)
can_invalid_cnt += not CS.canValid
if self.car_model not in ignore_can_valid:
self.assertLess(can_invalid_cnt, 50)