mirror of
https://github.com/sunnypilot/sunnypilot.git
synced 2026-02-18 15:23:57 +08:00
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
This commit is contained in:
4
.github/workflows/selfdrive_tests.yaml
vendored
4
.github/workflows/selfdrive_tests.yaml
vendored
@@ -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"
|
||||
|
||||
@@ -63,14 +63,13 @@ class TestSubMaster:
|
||||
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):
|
||||
|
||||
@@ -35,7 +35,7 @@ class TestLogmessaged:
|
||||
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
|
||||
@@ -45,7 +45,7 @@ class TestLogmessaged:
|
||||
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
|
||||
|
||||
@@ -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);
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user