Skip to content

Commit ce571da

Browse files
authored
Test suite clean up (#3385)
* Split apart test suite into those run on different numbers of ranks. Testing is now using MPI 'on the outside' which should allow us to stop relying on MPICH. * Various fixes for parallel tests now they are not run in isolation. * Added `firedrake-run-split-tests` script which other packages may wish to use.
1 parent 35c088d commit ce571da

31 files changed

+1706
-184
lines changed

.github/workflows/build-mac.yml

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,14 +46,16 @@ jobs:
4646
--venv-name firedrake_venv \
4747
--disable-ssh \
4848
|| (cat firedrake-install.log && /bin/false)
49+
- name: Install test dependencies
50+
run: |
51+
. ../firedrake_venv/bin/activate
52+
python -m pip install pytest-timeout
53+
4954
- name: Run smoke tests
5055
run: |
5156
. ../firedrake_venv/bin/activate
52-
python -m pytest -v tests/firedrake/regression/ -k "poisson_strong or stokes_mini or dg_advection"
53-
# also test for 'problem libraries' (spatialindex and libsupermesh)
54-
python -m pytest -v tests/firedrake/regression/test_locate_cell.py
55-
python -m pytest -v tests/firedrake/supermesh/test_assemble_mixed_mass_matrix.py
56-
timeout-minutes: 30
57+
make check CHECK_PYTEST_ARGS="--timeout 60"
58+
timeout-minutes: 10
5759
- name: Post-run cleanup
5860
if: ${{ always() }}
5961
run: |

.github/workflows/build.yml

Lines changed: 73 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,14 @@ env:
2121
RELEASE_TAG: latest
2222

2323
jobs:
24-
build:
25-
name: "Build Firedrake"
26-
# Run on our self-hosted machines
24+
test:
25+
name: "Run Firedrake tests (Linux)"
2726
runs-on: [self-hosted, Linux]
2827
container:
2928
image: firedrakeproject/firedrake-env:latest
3029
strategy:
31-
# Don't immediately kill real if complex fails and vice versa.
30+
# We want to know all of the tests which fail, so don't kill real if
31+
# complex fails and vice-versa
3232
fail-fast: false
3333
matrix:
3434
include:
@@ -47,13 +47,16 @@ jobs:
4747
OPENBLAS_NUM_THREADS: 1
4848
COMPLEX: ${{ matrix.complex }}
4949
RDMAV_FORK_SAFE: 1
50+
EXTRA_PYTEST_ARGS: --splitting-algorithm least_duration --timeout=1800 --timeout-method=thread -o faulthandler_timeout=1860 tests/firedrake
5051
steps:
5152
- uses: actions/checkout@v4
53+
5254
- name: Cleanup
5355
if: ${{ always() }}
5456
run: |
5557
cd ..
5658
rm -rf firedrake_venv
59+
5760
- name: Build Firedrake
5861
run: |
5962
cd ..
@@ -85,58 +88,105 @@ jobs:
8588
--install gadopt \
8689
--install asQ \
8790
|| (cat firedrake-install.log && /bin/false)
91+
8892
- name: Install test dependencies
93+
id: build
8994
run: |
95+
sudo apt update
96+
sudo apt -y install parallel
9097
. ../firedrake_venv/bin/activate
9198
python "$(which firedrake-clean)"
92-
python -m pip install \
93-
pytest-xdist pytest-timeout ipympl
99+
python -m pip install pytest-timeout ipympl pytest-split
94100
python -m pip list
95-
- name: Test Firedrake
101+
102+
- name: Run tests (nprocs = 1)
96103
run: |
97104
. ../firedrake_venv/bin/activate
98-
echo OMP_NUM_THREADS is "$OMP_NUM_THREADS"
99-
echo OPENBLAS_NUM_THREADS is "$OPENBLAS_NUM_THREADS"
100-
python -m pytest -v tests/firedrake/test_0init.py
101-
python -m pytest \
102-
--durations=200 \
103-
--timeout=1800 \
104-
--timeout-method=thread \
105-
-o faulthandler_timeout=1860 \
106-
-n 12 --dist worksteal \
107-
--junit-xml=firedrake.xml \
108-
-sv tests/firedrake
109-
timeout-minutes: 120
105+
firedrake-run-split-tests 1 12 "$EXTRA_PYTEST_ARGS --junit-xml=firedrake1_{#}.xml"
106+
107+
- name: Run tests (nprocs = 2)
108+
# Run even if earlier tests failed
109+
if: ${{ success() || steps.build.conclusion == 'success' }}
110+
run: |
111+
. ../firedrake_venv/bin/activate
112+
firedrake-run-split-tests 2 6 "$EXTRA_PYTEST_ARGS --junit-xml=firedrake2_{#}.xml"
113+
114+
- name: Run tests (nprocs = 3)
115+
if: ${{ success() || steps.build.conclusion == 'success' }}
116+
run: |
117+
. ../firedrake_venv/bin/activate
118+
firedrake-run-split-tests 3 4 "$EXTRA_PYTEST_ARGS --junit-xml=firedrake3_{#}.xml"
119+
120+
- name: Run tests (nprocs = 4)
121+
if: ${{ success() || steps.build.conclusion == 'success' }}
122+
run: |
123+
. ../firedrake_venv/bin/activate
124+
firedrake-run-split-tests 4 3 "$EXTRA_PYTEST_ARGS --junit-xml=firedrake4_{#}.xml"
125+
126+
- name: Run tests (nprocs = 5)
127+
if: ${{ success() || steps.build.conclusion == 'success' }}
128+
run: |
129+
. ../firedrake_venv/bin/activate
130+
firedrake-run-split-tests 5 2 "$EXTRA_PYTEST_ARGS --junit-xml=firedrake5_{#}.xml"
131+
132+
- name: Run tests (nprocs = 6)
133+
if: ${{ success() || steps.build.conclusion == 'success' }}
134+
run: |
135+
. ../firedrake_venv/bin/activate
136+
firedrake-run-split-tests 6 2 "$EXTRA_PYTEST_ARGS --junit-xml=firedrake6_{#}.xml"
137+
138+
- name: Run tests (nprocs = 7)
139+
if: ${{ success() || steps.build.conclusion == 'success' }}
140+
run: |
141+
. ../firedrake_venv/bin/activate
142+
firedrake-run-split-tests 7 1 "$EXTRA_PYTEST_ARGS --junit-xml=firedrake7_{#}.xml"
143+
144+
- name: Run tests (nprocs = 8)
145+
if: ${{ success() || steps.build.conclusion == 'success' }}
146+
run: |
147+
. ../firedrake_venv/bin/activate
148+
firedrake-run-split-tests 8 1 "$EXTRA_PYTEST_ARGS --junit-xml=firedrake8_{#}.xml"
149+
110150
- name: Publish Test Report
111151
uses: mikepenz/action-junit-report@v5.0.0-a02
112152
# To avoid permissions issues do not run with forked repos
113153
# (see https://github.com/mikepenz/action-junit-report/issues/23)
114154
if: ${{ always() && (github.ref != 'refs/heads/master') && (github.event.pull_request.head.repo.full_name == github.repository) }}
115155
with:
116-
report_paths: '/__w/firedrake/firedrake/firedrake.xml'
156+
report_paths: 'firedrake*.xml'
117157
comment: true
118158
check_name: "Firedrake ${{ matrix.scalar-type }}"
119159
updateComment: true
120160
flaky_summary: true
161+
162+
- name: Upload log files
163+
uses: actions/upload-artifact@v4
164+
with:
165+
name: firedrake-logs-${{ matrix.scalar-type }}
166+
path: pytest_*.log
167+
121168
- name: Test pyadjoint
122169
if: ${{ matrix.scalar-type == 'real' }}
123170
run: |
124171
. ../firedrake_venv/bin/activate
125172
cd ../firedrake_venv/src/pyadjoint
126173
python -m pytest \
174+
--strict-markers \
127175
--durations=200 \
128176
--timeout=600 \
129177
--timeout-method=thread \
130178
-o faulthandler_timeout=660 \
131179
-n 12 --dist worksteal \
132180
-sv tests/firedrake_adjoint
133181
timeout-minutes: 30
182+
134183
- name: Cleanup
135184
# Belt and braces: clean up before and after the run.
136185
if: ${{ always() }}
137186
run: |
138187
cd ..
139188
rm -rf firedrake_venv
189+
140190
docker_tag:
141191
name: "Set the Docker release tag"
142192
runs-on: [self-hosted, Linux]
@@ -153,14 +203,15 @@ jobs:
153203
echo The release tag is "$RELEASE_TAG"
154204
outputs:
155205
tag: ${{ env.RELEASE_TAG }}
206+
156207
docker:
157208
name: "Build Docker containers"
158209
# Only run on master, but always generate firedrake-env image,
159210
# even if build fails (see docker.yml)
160211
if: ${{ (github.ref == 'refs/heads/master') && always() }}
161-
needs: [build, docker_tag]
212+
needs: [test, docker_tag]
162213
uses: ./.github/workflows/docker.yml
163214
with:
164215
tag: ${{ needs.docker_tag.outputs.tag }}
165-
status: ${{ needs.build.result }}
216+
status: ${{ needs.test.result }}
166217
secrets: inherit

.github/workflows/pip-mac.yml

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ jobs:
2323
# Only run this action if we are pushing to master or the PR is labelled "macOS"
2424
if: ${{ (github.ref == 'refs/heads/master') || contains(github.event.pull_request.labels.*.name, 'macOS') }}
2525
env:
26+
FIREDRAKE_CI_TESTS: 1
2627
OMP_NUM_THREADS: 1
2728
OPENBLAS_NUM_THREADS: 1
2829
steps:
@@ -98,12 +99,8 @@ jobs:
9899
run: |
99100
source pip_venv/bin/activate
100101
cd pip_venv/src/firedrake
101-
python -m pytest --timeout=1800 -v tests/firedrake/regression \
102-
-k "poisson_strong or stokes_mini or dg_advection"
103-
# also test for 'problem libraries' (spatialindex and libsupermesh)
104-
python -m pytest -v tests/firedrake/regression/test_locate_cell.py
105-
python -m pytest -v tests/firedrake/supermesh/test_assemble_mixed_mass_matrix.py
106-
timeout-minutes: 30
102+
make check CHECK_PYTEST_ARGS="--timeout 60"
103+
timeout-minutes: 10
107104

108105
- name: Cleanup (post)
109106
if: ${{ always() }}

.github/workflows/pip.yml

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -83,16 +83,8 @@ jobs:
8383
run: |
8484
source pip_venv/bin/activate
8585
cd pip_venv/src/firedrake
86-
pytest -v tests/firedrake/test_0init.py
87-
pytest \
88-
--durations=200 \
89-
--timeout=1800 \
90-
--timeout-method=thread \
91-
-o faulthandler_timeout=1860 \
92-
-n 12 --dist worksteal \
93-
--junit-xml=firedrake.xml \
94-
-sv tests/firedrake/regression -k "poisson_strong or stokes_mini or dg_advection"
95-
timeout-minutes: 120
86+
make check CHECK_PYTEST_ARGS="--timeout 60"
87+
timeout-minutes: 10
9688

9789
- name: Publish Test Report
9890
uses: mikepenz/action-junit-report@v5.0.0-a02

0 commit comments

Comments
 (0)