Skip to content

Commit

Permalink
ci: faster unit_tests (#33953)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
maxime-desroches authored Nov 7, 2024
1 parent f2a1cce commit 4f97940
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 23 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/selfdrive_tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
run: ${{ env.RUN }} "scons -j$(nproc)"
- name: Run unit tests
timeout-minutes: 15
timeout-minutes: 1
run: |
${{ 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 && \
QT_QPA_PLATFORM=offscreen ./selfdrive/ui/tests/test_translations && \
pytest ./selfdrive/ui/tests/test_translations.py"
Expand Down
15 changes: 7 additions & 8 deletions cereal/messaging/tests/test_pub_sub_master.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,14 +63,13 @@ def test_update(self):
def test_update_timeout(self):
sock = random_sock()
sm = messaging.SubMaster([sock,])
for _ in range(5):
timeout = random.randrange(1000, 5000)
start_time = time.monotonic()
sm.update(timeout)
t = time.monotonic() - start_time
assert t >= timeout/1000.
assert t < 5
assert not any(sm.updated.values())
timeout = random.randrange(1000, 3000)
start_time = time.monotonic()
sm.update(timeout)
t = time.monotonic() - start_time
assert t >= timeout/1000.
assert t < 3
assert not any(sm.updated.values())

def test_avg_frequency_checks(self):
for poll in (True, False):
Expand Down
4 changes: 2 additions & 2 deletions system/tests/test_logmessaged.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def test_simple_log(self):
msgs = [f"abc {i}" for i in range(10)]
for m in msgs:
cloudlog.error(m)
time.sleep(3)
time.sleep(1)
m = messaging.drain_sock(self.sock)
assert len(m) == len(msgs)
assert len(self._get_log_files()) >= 1
Expand All @@ -45,7 +45,7 @@ def test_big_log(self):
msg = "a"*3*1024*1024
for _ in range(n):
cloudlog.info(msg)
time.sleep(3)
time.sleep(1)

msgs = messaging.drain_sock(self.sock)
assert len(msgs) == 0
Expand Down
12 changes: 1 addition & 11 deletions tools/replay/tests/test_replay.cc
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ std::string download_demo_route() {
}


TEST_CASE("Local route") {
TEST_CASE("Getting route") {
std::string data_dir = download_demo_route();

auto flags = GENERATE(0, REPLAY_FLAG_QCAMERA);
Expand All @@ -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") {
QEventLoop loop;
int seek_to = util::random_int(0, 2 * 59);
Expand Down

0 comments on commit 4f97940

Please sign in to comment.