Skip to content

Commit

Permalink
CI: speedup unit test job (commaai#30995)
Browse files Browse the repository at this point in the history
* start

* mv to buildjet

* fix
  • Loading branch information
adeebshihadeh authored Jan 14, 2024
1 parent 3e601b5 commit e17e661
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 3 deletions.
6 changes: 5 additions & 1 deletion .github/workflows/selfdrive_tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -163,12 +163,16 @@ jobs:

unit_tests:
name: unit tests
runs-on: ubuntu-20.04
runs-on: ${{ ((github.repository == 'commaai/openpilot') &&
((github.event_name != 'pull_request') ||
(github.event.pull_request.head.repo.full_name == 'commaai/openpilot'))) && 'buildjet-8vcpu-ubuntu-2004' || 'ubuntu-20.04' }}
steps:
- uses: actions/checkout@v4
with:
submodules: true
- uses: ./.github/workflows/setup-with-retry
with:
docker_hub_pat: ${{ secrets.DOCKER_HUB_PAT }}
- name: Build openpilot
timeout-minutes: ${{ ((steps.restore-scons-cache.outputs.cache-hit == 'true') && 10 || 30) }} # allow more time when we missed the scons cache
run: ${{ env.RUN }} "scons -j$(nproc)"
Expand Down
4 changes: 3 additions & 1 deletion selfdrive/test/process_replay/test_fuzzy.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,15 @@
# that openpilot makes causing error with NaN, inf, int size, array indexing ...
# TODO: Make each one testable
NOT_TESTED = ['controlsd', 'plannerd', 'calibrationd', 'dmonitoringd', 'paramsd', 'dmonitoringmodeld', 'modeld']

TEST_CASES = [(cfg.proc_name, copy.deepcopy(cfg)) for cfg in pr.CONFIGS if cfg.proc_name not in NOT_TESTED]

class TestFuzzProcesses(unittest.TestCase):

# TODO: make this faster and increase examples
@parameterized.expand(TEST_CASES)
@given(st.data())
@settings(phases=[Phase.generate, Phase.target], max_examples=50, deadline=1000, suppress_health_check=[HealthCheck.too_slow, HealthCheck.data_too_large])
@settings(phases=[Phase.generate, Phase.target], max_examples=10, deadline=1000, suppress_health_check=[HealthCheck.too_slow, HealthCheck.data_too_large])
def test_fuzz_process(self, proc_name, cfg, data):
msgs = FuzzyGenerator.get_random_event_msg(data.draw, events=cfg.pubs, real_floats=True)
lr = [log.Event.new_message(**m).as_reader() for m in msgs]
Expand Down
2 changes: 2 additions & 0 deletions tools/lib/tests/test_logreader.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,12 +69,14 @@ def test_bad_ranges(self, segment_range):
sr = SegmentRange(segment_range)
parse_slice(sr)

@unittest.skip("this test is too slow for the minimal coverage it provides")
def test_modes(self):
qlog_len = len(list(LogReader(f"{TEST_ROUTE}/0", ReadMode.QLOG)))
rlog_len = len(list(LogReader(f"{TEST_ROUTE}/0", ReadMode.RLOG)))

self.assertLess(qlog_len * 6, rlog_len)

@unittest.skip("this test is too slow for the minimal coverage it provides")
def test_modes_from_name(self):
qlog_len = len(list(LogReader(f"{TEST_ROUTE}/0/q")))
rlog_len = len(list(LogReader(f"{TEST_ROUTE}/0/r")))
Expand Down
3 changes: 2 additions & 1 deletion tools/sim/tests/test_metadrive_bridge.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
#!/usr/bin/env python3
import pytest
import unittest

from openpilot.tools.sim.run_bridge import parse_args
from openpilot.tools.sim.bridge.metadrive.metadrive_bridge import MetaDriveBridge
from openpilot.tools.sim.tests.test_sim_bridge import TestSimBridgeBase


@pytest.mark.slow
class TestMetaDriveBridge(TestSimBridgeBase):
def create_bridge(self):
return MetaDriveBridge(parse_args([]))
Expand Down

0 comments on commit e17e661

Please sign in to comment.