ci: faster sim test (#33888)

* sim

* no more
pull/33889/head
Maxime Desroches 6 months ago committed by GitHub
parent bce376f120
commit db98566084
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 20
      .github/workflows/selfdrive_tests.yaml
  2. 18
      .github/workflows/tools_tests.yaml
  3. 2
      tools/sim/bridge/metadrive/metadrive_world.py
  4. 5
      tools/sim/tests/test_metadrive_bridge.py
  5. 5
      tools/sim/tests/test_sim_bridge.py

@ -327,6 +327,26 @@ jobs:
comment_id: ${{ steps.fc.outputs.comment-id }} comment_id: ${{ steps.fc.outputs.comment-id }}
}) })
simulator_driving:
name: simulator driving
runs-on: ${{ ((github.repository == 'commaai/openpilot') &&
((github.event_name != 'pull_request') ||
(github.event.pull_request.head.repo.full_name == 'commaai/openpilot'))) && 'namespace-profile-amd64-8x16' || 'ubuntu-24.04' }}
steps:
- uses: actions/checkout@v4
with:
submodules: true
- uses: ./.github/workflows/setup-with-retry
- name: Build openpilot
run: |
${{ env.RUN }} "scons -j$(nproc)"
- name: Driving test
timeout-minutes: 1
run: |
${{ env.RUN }} "source selfdrive/test/setup_xvfb.sh && \
source selfdrive/test/setup_vsound.sh && \
CI=1 pytest tools/sim/tests/test_metadrive_bridge.py"
create_ui_report: create_ui_report:
# This job name needs to be the same as UI_JOB_NAME in ui_preview.yaml # This job name needs to be the same as UI_JOB_NAME in ui_preview.yaml
name: Create UI Report name: Create UI Report

@ -25,24 +25,6 @@ env:
jobs: jobs:
simulator_driving:
name: simulator driving
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- uses: actions/checkout@v4
with:
submodules: true
- uses: ./.github/workflows/setup-with-retry
- name: Build openpilot
run: |
${{ env.RUN }} "scons -j$(nproc)"
- name: Run bridge test
run: |
${{ env.RUN }} "source selfdrive/test/setup_xvfb.sh && \
source selfdrive/test/setup_vsound.sh && \
CI=1 pytest tools/sim/tests/test_metadrive_bridge.py"
devcontainer: devcontainer:
name: devcontainer name: devcontainer
runs-on: ubuntu-latest runs-on: ubuntu-latest

@ -105,7 +105,7 @@ class MetaDriveWorld(World):
if x_dist >= dist_threshold or y_dist >= dist_threshold: # position not the same during staying still, > threshold is considered moving if x_dist >= dist_threshold or y_dist >= dist_threshold: # position not the same during staying still, > threshold is considered moving
self.distance_moved += x_dist + y_dist self.distance_moved += x_dist + y_dist
time_check_threshold = 30 time_check_threshold = 15
current_time = time.monotonic() current_time = time.monotonic()
since_last_check = current_time - self.last_check_timestamp since_last_check = current_time - self.last_check_timestamp
if since_last_check >= time_check_threshold: if since_last_check >= time_check_threshold:

@ -12,10 +12,7 @@ from openpilot.tools.sim.tests.test_sim_bridge import TestSimBridgeBase
class TestMetaDriveBridge(TestSimBridgeBase): class TestMetaDriveBridge(TestSimBridgeBase):
@pytest.fixture(autouse=True) @pytest.fixture(autouse=True)
def setup_create_bridge(self, test_duration): def setup_create_bridge(self, test_duration):
# run bridge test for at least 60s, since not-moving check runs every 30s self.test_duration = 30
if test_duration < 60:
test_duration = 60
self.test_duration = test_duration
def create_bridge(self): def create_bridge(self):
return MetaDriveBridge(False, False, self.test_duration, True) return MetaDriveBridge(False, False, self.test_duration, True)

@ -89,7 +89,4 @@ class TestSimBridgeBase:
p.terminate() p.terminate()
for p in reversed(self.processes): for p in reversed(self.processes):
if isinstance(p, subprocess.Popen): p.kill()
p.wait(15)
else:
p.join(15)

Loading…
Cancel
Save