ci: faster unit_tests (#33953)

* effect

* test

* no

* yes

* try some caching

* try

* 1

* try more 1

* just for fun

* 50 maybe????

* all for nothing

* fix

* add back

* back

* timeout

* clean

* try

* no

* less
pull/33960/head
Maxime Desroches 6 months ago committed by GitHub
parent f2a1cce42b
commit 4f9794097b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 4
      .github/workflows/selfdrive_tests.yaml
  2. 15
      cereal/messaging/tests/test_pub_sub_master.py
  3. 4
      system/tests/test_logmessaged.py
  4. 12
      tools/replay/tests/test_replay.cc

@ -174,10 +174,10 @@ jobs:
timeout-minutes: ${{ ((steps.restore-scons-cache.outputs.cache-hit == 'true') && 10 || 30) }} # allow more time when we missed the scons cache 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)" run: ${{ env.RUN }} "scons -j$(nproc)"
- name: Run unit tests - name: Run unit tests
timeout-minutes: 15 timeout-minutes: 1
run: | run: |
${{ env.RUN }} "source selfdrive/test/setup_xvfb.sh && \ ${{ env.RUN }} "source selfdrive/test/setup_xvfb.sh && \
$PYTEST --timeout 60 -m 'not slow' && \ MAX_EXAMPLES=1 $PYTEST --timeout 60 -m 'not slow' && \
./selfdrive/ui/tests/create_test_translations.sh && \ ./selfdrive/ui/tests/create_test_translations.sh && \
QT_QPA_PLATFORM=offscreen ./selfdrive/ui/tests/test_translations && \ QT_QPA_PLATFORM=offscreen ./selfdrive/ui/tests/test_translations && \
pytest ./selfdrive/ui/tests/test_translations.py" pytest ./selfdrive/ui/tests/test_translations.py"

@ -63,14 +63,13 @@ class TestSubMaster:
def test_update_timeout(self): def test_update_timeout(self):
sock = random_sock() sock = random_sock()
sm = messaging.SubMaster([sock,]) sm = messaging.SubMaster([sock,])
for _ in range(5): timeout = random.randrange(1000, 3000)
timeout = random.randrange(1000, 5000) start_time = time.monotonic()
start_time = time.monotonic() sm.update(timeout)
sm.update(timeout) t = time.monotonic() - start_time
t = time.monotonic() - start_time assert t >= timeout/1000.
assert t >= timeout/1000. assert t < 3
assert t < 5 assert not any(sm.updated.values())
assert not any(sm.updated.values())
def test_avg_frequency_checks(self): def test_avg_frequency_checks(self):
for poll in (True, False): for poll in (True, False):

@ -35,7 +35,7 @@ class TestLogmessaged:
msgs = [f"abc {i}" for i in range(10)] msgs = [f"abc {i}" for i in range(10)]
for m in msgs: for m in msgs:
cloudlog.error(m) cloudlog.error(m)
time.sleep(3) time.sleep(1)
m = messaging.drain_sock(self.sock) m = messaging.drain_sock(self.sock)
assert len(m) == len(msgs) assert len(m) == len(msgs)
assert len(self._get_log_files()) >= 1 assert len(self._get_log_files()) >= 1
@ -45,7 +45,7 @@ class TestLogmessaged:
msg = "a"*3*1024*1024 msg = "a"*3*1024*1024
for _ in range(n): for _ in range(n):
cloudlog.info(msg) cloudlog.info(msg)
time.sleep(3) time.sleep(1)
msgs = messaging.drain_sock(self.sock) msgs = messaging.drain_sock(self.sock)
assert len(msgs) == 0 assert len(msgs) == 0

@ -136,7 +136,7 @@ std::string download_demo_route() {
} }
TEST_CASE("Local route") { TEST_CASE("Getting route") {
std::string data_dir = download_demo_route(); std::string data_dir = download_demo_route();
auto flags = GENERATE(0, REPLAY_FLAG_QCAMERA); auto flags = GENERATE(0, REPLAY_FLAG_QCAMERA);
@ -148,16 +148,6 @@ TEST_CASE("Local route") {
} }
} }
TEST_CASE("Remote route") {
auto flags = GENERATE(0, REPLAY_FLAG_QCAMERA);
Route route(DEMO_ROUTE);
REQUIRE(route.load());
REQUIRE(route.segments().size() == 13);
for (int i = 0; i < TEST_REPLAY_SEGMENTS; ++i) {
read_segment(i, route.at(i), flags);
}
}
TEST_CASE("seek_to") { TEST_CASE("seek_to") {
QEventLoop loop; QEventLoop loop;
int seek_to = util::random_int(0, 2 * 59); int seek_to = util::random_int(0, 2 * 59);

Loading…
Cancel
Save