From 57582d8996c250a9f7626f2daba38671cbce024d Mon Sep 17 00:00:00 2001 From: Maxime Desroches Date: Wed, 6 Nov 2024 20:32:10 -0800 Subject: [PATCH 01/19] effect --- cereal/messaging/tests/test_pub_sub_master.py | 6 +++--- system/loggerd/tests/test_uploader.py | 12 ++++++------ tools/replay/tests/test_replay.cc | 12 +----------- 3 files changed, 10 insertions(+), 20 deletions(-) diff --git a/cereal/messaging/tests/test_pub_sub_master.py b/cereal/messaging/tests/test_pub_sub_master.py index 99965319eb03ed..c026fa7a664d7b 100644 --- a/cereal/messaging/tests/test_pub_sub_master.py +++ b/cereal/messaging/tests/test_pub_sub_master.py @@ -63,13 +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) + for _ in range(2): + timeout = random.randrange(1000, 3000) start_time = time.monotonic() sm.update(timeout) t = time.monotonic() - start_time assert t >= timeout/1000. - assert t < 5 + assert t < 3 assert not any(sm.updated.values()) def test_avg_frequency_checks(self): diff --git a/system/loggerd/tests/test_uploader.py b/system/loggerd/tests/test_uploader.py index fa716002635a08..a05a28ee4e6b6a 100644 --- a/system/loggerd/tests/test_uploader.py +++ b/system/loggerd/tests/test_uploader.py @@ -73,7 +73,7 @@ def test_upload(self): self.start_thread() # allow enough time that files could upload twice if there is a bug in the logic - time.sleep(5) + time.sleep(2) self.join_thread() exp_order = self.gen_order([self.seg_num], []) @@ -91,7 +91,7 @@ def test_upload_with_wrong_xattr(self): self.start_thread() # allow enough time that files could upload twice if there is a bug in the logic - time.sleep(5) + time.sleep(2) self.join_thread() exp_order = self.gen_order([self.seg_num], []) @@ -110,7 +110,7 @@ def test_upload_ignored(self): self.start_thread() # allow enough time that files could upload twice if there is a bug in the logic - time.sleep(5) + time.sleep(2) self.join_thread() exp_order = self.gen_order([self.seg_num], []) @@ -137,7 +137,7 @@ def test_upload_files_in_create_order(self): self.start_thread() # allow enough time that files could upload twice if there is a bug in the logic - time.sleep(5) + time.sleep(2) self.join_thread() assert len(log_handler.upload_ignored) == 0, "Some files were ignored" @@ -155,7 +155,7 @@ def test_no_upload_with_lock_file(self): f_paths = self.gen_files(lock=True, boot=False) # allow enough time that files should have been uploaded if they would be uploaded - time.sleep(5) + time.sleep(2) self.join_thread() for f_path in f_paths: @@ -168,7 +168,7 @@ def test_no_upload_with_xattr(self): self.start_thread() # allow enough time that files could upload twice if there is a bug in the logic - time.sleep(5) + time.sleep(2) self.join_thread() assert len(log_handler.upload_order) == 0, "File uploaded again" diff --git a/tools/replay/tests/test_replay.cc b/tools/replay/tests/test_replay.cc index d350df570ad33e..e4d8c3e5f0faa4 100644 --- a/tools/replay/tests/test_replay.cc +++ b/tools/replay/tests/test_replay.cc @@ -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); From eb5dba8cc1b84e78e96d80dc2bfb3615d22c0ada Mon Sep 17 00:00:00 2001 From: Maxime Desroches Date: Wed, 6 Nov 2024 20:47:46 -0800 Subject: [PATCH 02/19] test --- .github/workflows/selfdrive_tests.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/selfdrive_tests.yaml b/.github/workflows/selfdrive_tests.yaml index d82b450abd19ba..b4f376895764ee 100644 --- a/.github/workflows/selfdrive_tests.yaml +++ b/.github/workflows/selfdrive_tests.yaml @@ -27,7 +27,7 @@ env: RUN: docker run --shm-size 2G -v $PWD:/tmp/openpilot -w /tmp/openpilot -e CI=1 -e PYTHONWARNINGS=error -e FILEREADER_CACHE=1 -e PYTHONPATH=/tmp/openpilot -e NUM_JOBS -e JOB_ID -e GITHUB_ACTION -e GITHUB_REF -e GITHUB_HEAD_REF -e GITHUB_SHA -e GITHUB_REPOSITORY -e GITHUB_RUN_ID -v $GITHUB_WORKSPACE/.ci_cache/scons_cache:/tmp/scons_cache -v $GITHUB_WORKSPACE/.ci_cache/comma_download_cache:/tmp/comma_download_cache -v $GITHUB_WORKSPACE/.ci_cache/openpilot_cache:/tmp/openpilot_cache $BASE_IMAGE /bin/bash -c - PYTEST: pytest --continue-on-collection-errors --cov --cov-report=xml --cov-append --durations=0 --durations-min=5 --hypothesis-seed 0 -n logical + PYTEST: pytest --continue-on-collection-errors --cov --cov-report=xml --cov-append --durations=0 --durations-min=1 --hypothesis-seed 0 -n logical jobs: build_release: From 5677a3e6c9474e59403d0038a86f3d7c2ff5a074 Mon Sep 17 00:00:00 2001 From: Maxime Desroches Date: Wed, 6 Nov 2024 20:59:23 -0800 Subject: [PATCH 03/19] no --- selfdrive/locationd/test/test_locationd_scenarios.py | 1 - 1 file changed, 1 deletion(-) diff --git a/selfdrive/locationd/test/test_locationd_scenarios.py b/selfdrive/locationd/test/test_locationd_scenarios.py index 166d715c347475..363472818df322 100644 --- a/selfdrive/locationd/test/test_locationd_scenarios.py +++ b/selfdrive/locationd/test/test_locationd_scenarios.py @@ -73,7 +73,6 @@ def run_scenarios(scenario, logs): return get_select_fields_data(logs), get_select_fields_data(replayed_logs) -@pytest.mark.xdist_group("test_locationd_scenarios") @pytest.mark.shared_download_cache class TestLocationdScenarios: """ From 15254981c7498f10b2b12dbe6ec82f096b7bf07e Mon Sep 17 00:00:00 2001 From: Maxime Desroches Date: Wed, 6 Nov 2024 21:03:01 -0800 Subject: [PATCH 04/19] yes --- selfdrive/locationd/test/test_locationd_scenarios.py | 1 + 1 file changed, 1 insertion(+) diff --git a/selfdrive/locationd/test/test_locationd_scenarios.py b/selfdrive/locationd/test/test_locationd_scenarios.py index 363472818df322..166d715c347475 100644 --- a/selfdrive/locationd/test/test_locationd_scenarios.py +++ b/selfdrive/locationd/test/test_locationd_scenarios.py @@ -73,6 +73,7 @@ def run_scenarios(scenario, logs): return get_select_fields_data(logs), get_select_fields_data(replayed_logs) +@pytest.mark.xdist_group("test_locationd_scenarios") @pytest.mark.shared_download_cache class TestLocationdScenarios: """ From efd6383e1d9b2c4373e85e6cdbbb771c37657246 Mon Sep 17 00:00:00 2001 From: Maxime Desroches Date: Wed, 6 Nov 2024 21:09:08 -0800 Subject: [PATCH 05/19] try some caching --- .github/workflows/selfdrive_tests.yaml | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/.github/workflows/selfdrive_tests.yaml b/.github/workflows/selfdrive_tests.yaml index b4f376895764ee..b97803f1f1df94 100644 --- a/.github/workflows/selfdrive_tests.yaml +++ b/.github/workflows/selfdrive_tests.yaml @@ -170,6 +170,12 @@ jobs: - uses: ./.github/workflows/setup-with-retry with: docker_hub_pat: ${{ secrets.DOCKER_HUB_PAT }} + - name: Cache routes + id: dependency-cache + uses: ./.github/workflows/auto-cache + with: + path: .ci_cache/comma_download_cache + key: unit_tests - 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)" @@ -180,7 +186,8 @@ jobs: $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" + pytest ./selfdrive/ui/tests/test_translations.py && \ + chmod -R 777 /tmp/comma_download_cache" - name: "Upload coverage to Codecov" uses: codecov/codecov-action@v4 with: From f31336875a4da7dfda4e3889159f72064fefbe6a Mon Sep 17 00:00:00 2001 From: Maxime Desroches Date: Wed, 6 Nov 2024 21:25:10 -0800 Subject: [PATCH 06/19] try --- cereal/messaging/tests/test_pub_sub_master.py | 15 +++++++-------- system/tests/test_logmessaged.py | 4 ++-- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/cereal/messaging/tests/test_pub_sub_master.py b/cereal/messaging/tests/test_pub_sub_master.py index c026fa7a664d7b..e9bc7a85cb3ba3 100644 --- a/cereal/messaging/tests/test_pub_sub_master.py +++ b/cereal/messaging/tests/test_pub_sub_master.py @@ -63,14 +63,13 @@ def test_update(self): def test_update_timeout(self): sock = random_sock() sm = messaging.SubMaster([sock,]) - for _ in range(2): - 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()) + 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): diff --git a/system/tests/test_logmessaged.py b/system/tests/test_logmessaged.py index 3baf5300c0c13e..03c13437bcc872 100644 --- a/system/tests/test_logmessaged.py +++ b/system/tests/test_logmessaged.py @@ -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 @@ -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 From 279d5a46ef08a2807305faa28181dfe9436162a6 Mon Sep 17 00:00:00 2001 From: Maxime Desroches Date: Wed, 6 Nov 2024 21:36:06 -0800 Subject: [PATCH 07/19] 1 --- system/loggerd/tests/test_deleter.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/system/loggerd/tests/test_deleter.py b/system/loggerd/tests/test_deleter.py index 6222ea253ba0db..235dc40a14a9a8 100644 --- a/system/loggerd/tests/test_deleter.py +++ b/system/loggerd/tests/test_deleter.py @@ -99,7 +99,7 @@ def test_no_delete_when_available_space(self): self.start_thread() start_time = time.monotonic() - while f_path.exists() and time.monotonic() - start_time < 2: + while f_path.exists() and time.monotonic() - start_time < 1: time.sleep(0.01) self.join_thread() @@ -110,7 +110,7 @@ def test_no_delete_with_lock_file(self): self.start_thread() start_time = time.monotonic() - while f_path.exists() and time.monotonic() - start_time < 2: + while f_path.exists() and time.monotonic() - start_time < 1: time.sleep(0.01) self.join_thread() From 0833e2e86250a462c1efa57cd622f5b8b1b96bf6 Mon Sep 17 00:00:00 2001 From: Maxime Desroches Date: Wed, 6 Nov 2024 21:37:12 -0800 Subject: [PATCH 08/19] try more 1 --- system/loggerd/tests/test_uploader.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/system/loggerd/tests/test_uploader.py b/system/loggerd/tests/test_uploader.py index a05a28ee4e6b6a..e23661ce7a9d44 100644 --- a/system/loggerd/tests/test_uploader.py +++ b/system/loggerd/tests/test_uploader.py @@ -73,7 +73,7 @@ def test_upload(self): self.start_thread() # allow enough time that files could upload twice if there is a bug in the logic - time.sleep(2) + time.sleep(1) self.join_thread() exp_order = self.gen_order([self.seg_num], []) @@ -91,7 +91,7 @@ def test_upload_with_wrong_xattr(self): self.start_thread() # allow enough time that files could upload twice if there is a bug in the logic - time.sleep(2) + time.sleep(1) self.join_thread() exp_order = self.gen_order([self.seg_num], []) @@ -110,7 +110,7 @@ def test_upload_ignored(self): self.start_thread() # allow enough time that files could upload twice if there is a bug in the logic - time.sleep(2) + time.sleep(1) self.join_thread() exp_order = self.gen_order([self.seg_num], []) @@ -137,7 +137,7 @@ def test_upload_files_in_create_order(self): self.start_thread() # allow enough time that files could upload twice if there is a bug in the logic - time.sleep(2) + time.sleep(1) self.join_thread() assert len(log_handler.upload_ignored) == 0, "Some files were ignored" @@ -155,7 +155,7 @@ def test_no_upload_with_lock_file(self): f_paths = self.gen_files(lock=True, boot=False) # allow enough time that files should have been uploaded if they would be uploaded - time.sleep(2) + time.sleep(1) self.join_thread() for f_path in f_paths: @@ -168,7 +168,7 @@ def test_no_upload_with_xattr(self): self.start_thread() # allow enough time that files could upload twice if there is a bug in the logic - time.sleep(2) + time.sleep(1) self.join_thread() assert len(log_handler.upload_order) == 0, "File uploaded again" From 1afc9ba2bbed4b7bb5782769df74d80deacb260c Mon Sep 17 00:00:00 2001 From: Maxime Desroches Date: Wed, 6 Nov 2024 21:45:16 -0800 Subject: [PATCH 09/19] just for fun --- selfdrive/car/tests/test_car_interfaces.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/selfdrive/car/tests/test_car_interfaces.py b/selfdrive/car/tests/test_car_interfaces.py index 4370ea141ba7d5..4a0f2c885187b8 100644 --- a/selfdrive/car/tests/test_car_interfaces.py +++ b/selfdrive/car/tests/test_car_interfaces.py @@ -23,7 +23,7 @@ ALL_REQUESTS = {tuple(r.request) for config in FW_QUERY_CONFIGS.values() for r in config.requests} -MAX_EXAMPLES = int(os.environ.get('MAX_EXAMPLES', '60')) +MAX_EXAMPLES = int(os.environ.get('MAX_EXAMPLES', '10')) class TestCarInterfaces: From f227dd447b90fe3fae755636612358c211330c7b Mon Sep 17 00:00:00 2001 From: Maxime Desroches Date: Wed, 6 Nov 2024 21:50:26 -0800 Subject: [PATCH 10/19] 50 maybe???? --- selfdrive/car/tests/test_car_interfaces.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/selfdrive/car/tests/test_car_interfaces.py b/selfdrive/car/tests/test_car_interfaces.py index 4a0f2c885187b8..77be16c90df0da 100644 --- a/selfdrive/car/tests/test_car_interfaces.py +++ b/selfdrive/car/tests/test_car_interfaces.py @@ -23,7 +23,7 @@ ALL_REQUESTS = {tuple(r.request) for config in FW_QUERY_CONFIGS.values() for r in config.requests} -MAX_EXAMPLES = int(os.environ.get('MAX_EXAMPLES', '10')) +MAX_EXAMPLES = int(os.environ.get('MAX_EXAMPLES', '50')) class TestCarInterfaces: From 943030d42a078de460f4ea640d30e414cf3f3efd Mon Sep 17 00:00:00 2001 From: Maxime Desroches Date: Thu, 7 Nov 2024 10:56:26 -0800 Subject: [PATCH 11/19] all for nothing --- .github/workflows/selfdrive_tests.yaml | 2 +- selfdrive/car/tests/test_car_interfaces.py | 2 +- system/loggerd/tests/test_deleter.py | 4 ++-- system/loggerd/tests/test_uploader.py | 12 ++++++------ system/tests/test_logmessaged.py | 4 ++-- tools/replay/tests/test_replay.cc | 12 +++++++++++- 6 files changed, 23 insertions(+), 13 deletions(-) diff --git a/.github/workflows/selfdrive_tests.yaml b/.github/workflows/selfdrive_tests.yaml index b97803f1f1df94..e9b1f8afa6d630 100644 --- a/.github/workflows/selfdrive_tests.yaml +++ b/.github/workflows/selfdrive_tests.yaml @@ -183,7 +183,7 @@ jobs: timeout-minutes: 15 run: | ${{ env.RUN }} "source selfdrive/test/setup_xvfb.sh && \ - $PYTEST --timeout 60 -m 'not slow' && \ + MAX_EXAMPLES=10 $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 && \ diff --git a/selfdrive/car/tests/test_car_interfaces.py b/selfdrive/car/tests/test_car_interfaces.py index 77be16c90df0da..4370ea141ba7d5 100644 --- a/selfdrive/car/tests/test_car_interfaces.py +++ b/selfdrive/car/tests/test_car_interfaces.py @@ -23,7 +23,7 @@ ALL_REQUESTS = {tuple(r.request) for config in FW_QUERY_CONFIGS.values() for r in config.requests} -MAX_EXAMPLES = int(os.environ.get('MAX_EXAMPLES', '50')) +MAX_EXAMPLES = int(os.environ.get('MAX_EXAMPLES', '60')) class TestCarInterfaces: diff --git a/system/loggerd/tests/test_deleter.py b/system/loggerd/tests/test_deleter.py index 235dc40a14a9a8..6222ea253ba0db 100644 --- a/system/loggerd/tests/test_deleter.py +++ b/system/loggerd/tests/test_deleter.py @@ -99,7 +99,7 @@ def test_no_delete_when_available_space(self): self.start_thread() start_time = time.monotonic() - while f_path.exists() and time.monotonic() - start_time < 1: + while f_path.exists() and time.monotonic() - start_time < 2: time.sleep(0.01) self.join_thread() @@ -110,7 +110,7 @@ def test_no_delete_with_lock_file(self): self.start_thread() start_time = time.monotonic() - while f_path.exists() and time.monotonic() - start_time < 1: + while f_path.exists() and time.monotonic() - start_time < 2: time.sleep(0.01) self.join_thread() diff --git a/system/loggerd/tests/test_uploader.py b/system/loggerd/tests/test_uploader.py index e23661ce7a9d44..fa716002635a08 100644 --- a/system/loggerd/tests/test_uploader.py +++ b/system/loggerd/tests/test_uploader.py @@ -73,7 +73,7 @@ def test_upload(self): self.start_thread() # allow enough time that files could upload twice if there is a bug in the logic - time.sleep(1) + time.sleep(5) self.join_thread() exp_order = self.gen_order([self.seg_num], []) @@ -91,7 +91,7 @@ def test_upload_with_wrong_xattr(self): self.start_thread() # allow enough time that files could upload twice if there is a bug in the logic - time.sleep(1) + time.sleep(5) self.join_thread() exp_order = self.gen_order([self.seg_num], []) @@ -110,7 +110,7 @@ def test_upload_ignored(self): self.start_thread() # allow enough time that files could upload twice if there is a bug in the logic - time.sleep(1) + time.sleep(5) self.join_thread() exp_order = self.gen_order([self.seg_num], []) @@ -137,7 +137,7 @@ def test_upload_files_in_create_order(self): self.start_thread() # allow enough time that files could upload twice if there is a bug in the logic - time.sleep(1) + time.sleep(5) self.join_thread() assert len(log_handler.upload_ignored) == 0, "Some files were ignored" @@ -155,7 +155,7 @@ def test_no_upload_with_lock_file(self): f_paths = self.gen_files(lock=True, boot=False) # allow enough time that files should have been uploaded if they would be uploaded - time.sleep(1) + time.sleep(5) self.join_thread() for f_path in f_paths: @@ -168,7 +168,7 @@ def test_no_upload_with_xattr(self): self.start_thread() # allow enough time that files could upload twice if there is a bug in the logic - time.sleep(1) + time.sleep(5) self.join_thread() assert len(log_handler.upload_order) == 0, "File uploaded again" diff --git a/system/tests/test_logmessaged.py b/system/tests/test_logmessaged.py index 03c13437bcc872..3baf5300c0c13e 100644 --- a/system/tests/test_logmessaged.py +++ b/system/tests/test_logmessaged.py @@ -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(1) + time.sleep(3) m = messaging.drain_sock(self.sock) assert len(m) == len(msgs) assert len(self._get_log_files()) >= 1 @@ -45,7 +45,7 @@ def test_big_log(self): msg = "a"*3*1024*1024 for _ in range(n): cloudlog.info(msg) - time.sleep(1) + time.sleep(3) msgs = messaging.drain_sock(self.sock) assert len(msgs) == 0 diff --git a/tools/replay/tests/test_replay.cc b/tools/replay/tests/test_replay.cc index e4d8c3e5f0faa4..d350df570ad33e 100644 --- a/tools/replay/tests/test_replay.cc +++ b/tools/replay/tests/test_replay.cc @@ -136,7 +136,7 @@ std::string download_demo_route() { } -TEST_CASE("Getting route") { +TEST_CASE("Local route") { std::string data_dir = download_demo_route(); auto flags = GENERATE(0, REPLAY_FLAG_QCAMERA); @@ -148,6 +148,16 @@ TEST_CASE("Getting 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); From ff3d8eab5cd97de05a55f5ace60de3cbb829ba27 Mon Sep 17 00:00:00 2001 From: Maxime Desroches Date: Thu, 7 Nov 2024 11:01:56 -0800 Subject: [PATCH 12/19] fix --- .github/workflows/selfdrive_tests.yaml | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/.github/workflows/selfdrive_tests.yaml b/.github/workflows/selfdrive_tests.yaml index e9b1f8afa6d630..11bb5f3ac0ce72 100644 --- a/.github/workflows/selfdrive_tests.yaml +++ b/.github/workflows/selfdrive_tests.yaml @@ -170,12 +170,6 @@ jobs: - uses: ./.github/workflows/setup-with-retry with: docker_hub_pat: ${{ secrets.DOCKER_HUB_PAT }} - - name: Cache routes - id: dependency-cache - uses: ./.github/workflows/auto-cache - with: - path: .ci_cache/comma_download_cache - key: unit_tests - 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)" @@ -183,11 +177,10 @@ jobs: timeout-minutes: 15 run: | ${{ env.RUN }} "source selfdrive/test/setup_xvfb.sh && \ - MAX_EXAMPLES=10 $PYTEST --timeout 60 -m 'not slow' && \ + MAX_EXAMPLES=5 $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 && \ - chmod -R 777 /tmp/comma_download_cache" + pytest ./selfdrive/ui/tests/test_translations.py" - name: "Upload coverage to Codecov" uses: codecov/codecov-action@v4 with: From 3b3f0681794704a7ef488d89f89100d862a73c5f Mon Sep 17 00:00:00 2001 From: Maxime Desroches Date: Thu, 7 Nov 2024 11:07:24 -0800 Subject: [PATCH 13/19] add back --- tools/replay/tests/test_replay.cc | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/tools/replay/tests/test_replay.cc b/tools/replay/tests/test_replay.cc index d350df570ad33e..e4d8c3e5f0faa4 100644 --- a/tools/replay/tests/test_replay.cc +++ b/tools/replay/tests/test_replay.cc @@ -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); From 2ff02049f2c4aca6690f4242955f4ea5b3b623d7 Mon Sep 17 00:00:00 2001 From: Maxime Desroches Date: Thu, 7 Nov 2024 11:12:20 -0800 Subject: [PATCH 14/19] back --- system/tests/test_logmessaged.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/system/tests/test_logmessaged.py b/system/tests/test_logmessaged.py index 3baf5300c0c13e..03c13437bcc872 100644 --- a/system/tests/test_logmessaged.py +++ b/system/tests/test_logmessaged.py @@ -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 @@ -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 From 66f8b32bd151b8d58728fcb3f73a540cf96794a1 Mon Sep 17 00:00:00 2001 From: Maxime Desroches Date: Thu, 7 Nov 2024 11:17:23 -0800 Subject: [PATCH 15/19] timeout --- .github/workflows/selfdrive_tests.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/selfdrive_tests.yaml b/.github/workflows/selfdrive_tests.yaml index 11bb5f3ac0ce72..4b6297fba889c2 100644 --- a/.github/workflows/selfdrive_tests.yaml +++ b/.github/workflows/selfdrive_tests.yaml @@ -174,7 +174,7 @@ 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 && \ MAX_EXAMPLES=5 $PYTEST --timeout 60 -m 'not slow' && \ From e83df4729563f3ebff0dee67c28f0f65683034b7 Mon Sep 17 00:00:00 2001 From: Maxime Desroches Date: Thu, 7 Nov 2024 11:40:07 -0800 Subject: [PATCH 16/19] clean --- .github/workflows/selfdrive_tests.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/selfdrive_tests.yaml b/.github/workflows/selfdrive_tests.yaml index 4b6297fba889c2..d6b199da24a14d 100644 --- a/.github/workflows/selfdrive_tests.yaml +++ b/.github/workflows/selfdrive_tests.yaml @@ -27,7 +27,7 @@ env: RUN: docker run --shm-size 2G -v $PWD:/tmp/openpilot -w /tmp/openpilot -e CI=1 -e PYTHONWARNINGS=error -e FILEREADER_CACHE=1 -e PYTHONPATH=/tmp/openpilot -e NUM_JOBS -e JOB_ID -e GITHUB_ACTION -e GITHUB_REF -e GITHUB_HEAD_REF -e GITHUB_SHA -e GITHUB_REPOSITORY -e GITHUB_RUN_ID -v $GITHUB_WORKSPACE/.ci_cache/scons_cache:/tmp/scons_cache -v $GITHUB_WORKSPACE/.ci_cache/comma_download_cache:/tmp/comma_download_cache -v $GITHUB_WORKSPACE/.ci_cache/openpilot_cache:/tmp/openpilot_cache $BASE_IMAGE /bin/bash -c - PYTEST: pytest --continue-on-collection-errors --cov --cov-report=xml --cov-append --durations=0 --durations-min=1 --hypothesis-seed 0 -n logical + PYTEST: pytest --continue-on-collection-errors --cov --cov-report=xml --cov-append --durations=0 --durations-min=5 --hypothesis-seed 0 -n logical jobs: build_release: From 0a2b00b5de65ec119cd47ded5b2fd80cd9d3fa44 Mon Sep 17 00:00:00 2001 From: Maxime Desroches Date: Thu, 7 Nov 2024 11:44:58 -0800 Subject: [PATCH 17/19] try --- selfdrive/locationd/test/test_locationd_scenarios.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/selfdrive/locationd/test/test_locationd_scenarios.py b/selfdrive/locationd/test/test_locationd_scenarios.py index 166d715c347475..4270af1a19bb49 100644 --- a/selfdrive/locationd/test/test_locationd_scenarios.py +++ b/selfdrive/locationd/test/test_locationd_scenarios.py @@ -73,7 +73,7 @@ def run_scenarios(scenario, logs): return get_select_fields_data(logs), get_select_fields_data(replayed_logs) -@pytest.mark.xdist_group("test_locationd_scenarios") +#@pytest.mark.xdist_group("test_locationd_scenarios") @pytest.mark.shared_download_cache class TestLocationdScenarios: """ From fa9bbc2a16ca11133529533337c596cc5d7653ce Mon Sep 17 00:00:00 2001 From: Maxime Desroches Date: Thu, 7 Nov 2024 11:47:08 -0800 Subject: [PATCH 18/19] no --- selfdrive/locationd/test/test_locationd_scenarios.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/selfdrive/locationd/test/test_locationd_scenarios.py b/selfdrive/locationd/test/test_locationd_scenarios.py index 4270af1a19bb49..166d715c347475 100644 --- a/selfdrive/locationd/test/test_locationd_scenarios.py +++ b/selfdrive/locationd/test/test_locationd_scenarios.py @@ -73,7 +73,7 @@ def run_scenarios(scenario, logs): return get_select_fields_data(logs), get_select_fields_data(replayed_logs) -#@pytest.mark.xdist_group("test_locationd_scenarios") +@pytest.mark.xdist_group("test_locationd_scenarios") @pytest.mark.shared_download_cache class TestLocationdScenarios: """ From 26ff3de2e1754126898765c76fc9715378dc726a Mon Sep 17 00:00:00 2001 From: Maxime Desroches Date: Thu, 7 Nov 2024 13:03:53 -0800 Subject: [PATCH 19/19] less --- .github/workflows/selfdrive_tests.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/selfdrive_tests.yaml b/.github/workflows/selfdrive_tests.yaml index d6b199da24a14d..a63a8d2df37534 100644 --- a/.github/workflows/selfdrive_tests.yaml +++ b/.github/workflows/selfdrive_tests.yaml @@ -177,7 +177,7 @@ jobs: timeout-minutes: 1 run: | ${{ env.RUN }} "source selfdrive/test/setup_xvfb.sh && \ - MAX_EXAMPLES=5 $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"