From 4fc243b998e3f7e32d47b21edb1a89526b4b484c Mon Sep 17 00:00:00 2001 From: Adeeb Shihadeh Date: Tue, 20 May 2025 10:18:47 -0700 Subject: [PATCH] CI: speed up MISRA mutation job (#2213) * CI: speed up MISRA mutation job * install first --- .github/workflows/test.yaml | 4 +++- tests/misra/test_mutation.py | 3 +++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 277cb3c3..da97fd20 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -73,5 +73,7 @@ jobs: - run: ./setup.sh - name: Build FW run: ${{ env.RUN }} "scons -j$(nproc)" + - name: tests/misra/install.sh + run: ${{ env.RUN }} "cd tests/misra && ./install.sh" - name: MISRA mutation tests - run: ${{ env.RUN }} "cd tests/misra && pytest -n8 test_mutation.py" + run: ${{ env.RUN }} "cd tests/misra && pytest -n2 test_mutation.py" diff --git a/tests/misra/test_mutation.py b/tests/misra/test_mutation.py index 8adaa87d..8996d8ae 100755 --- a/tests/misra/test_mutation.py +++ b/tests/misra/test_mutation.py @@ -64,6 +64,9 @@ assert len(files) > 70, all(d in files for d in ('board/main.c', 'board/stm32f4/ for p in patterns: mutations.append((random.choice(files), p, True)) +# TODO: remove sampling once test_misra.sh is faster +mutations = random.sample(mutations, 2) + @pytest.mark.parametrize("fn, patch, should_fail", mutations) def test_misra_mutation(fn, patch, should_fail): with tempfile.TemporaryDirectory() as tmp: