From 9ee1cc9b828e8018fa37443d90dba95f8a032260 Mon Sep 17 00:00:00 2001 From: Adeeb Shihadeh Date: Sun, 2 Aug 2020 00:30:09 -0700 Subject: [PATCH] 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 --- .coveragerc-app | 3 --- .github/workflows/test.yaml | 6 +++--- Dockerfile.openpilot | 1 - selfdrive/car/volkswagen/interface.py | 6 +++--- selfdrive/test/test_models.py | 10 +++------- 5 files changed, 9 insertions(+), 17 deletions(-) delete mode 100644 .coveragerc-app diff --git a/.coveragerc-app b/.coveragerc-app deleted file mode 100644 index 18c81e3b48..0000000000 --- a/.coveragerc-app +++ /dev/null @@ -1,3 +0,0 @@ -[run] -concurrency=multiprocessing - diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index d9892b2663..02a3c11dde 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -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: | diff --git a/Dockerfile.openpilot b/Dockerfile.openpilot index e90eb47a24..4de954141f 100644 --- a/Dockerfile.openpilot +++ b/Dockerfile.openpilot @@ -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 diff --git a/selfdrive/car/volkswagen/interface.py b/selfdrive/car/volkswagen/interface.py index c7082b57ce..c041c6c44c 100644 --- a/selfdrive/car/volkswagen/interface.py +++ b/selfdrive/car/volkswagen/interface.py @@ -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. diff --git a/selfdrive/test/test_models.py b/selfdrive/test/test_models.py index a318fbd972..868b74f424 100755 --- a/selfdrive/test/test_models.py +++ b/selfdrive/test/test_models.py @@ -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)