Skip to content

Speed up Ubuntu 24.04 valgrind with pytest-split (2h -> 40min) - #4

Merged
radarhere merged 5 commits into
radarhere:ubuntu_valgrindfrom
hugovk:ubuntu_valgrind-split
Jul 8, 2026
Merged

Speed up Ubuntu 24.04 valgrind with pytest-split (2h -> 40min)#4
radarhere merged 5 commits into
radarhere:ubuntu_valgrindfrom
hugovk:ubuntu_valgrind-split

Conversation

@hugovk

@hugovk hugovk commented Jul 2, 2026

Copy link
Copy Markdown

Updates PR python-pillow#272.

Ubuntu 24.04 valgrind takes between 1h43m and 2h02m.

We can use pytest-split to share out the tests between four jobs, which takes the waiting time down to around 42 minutes.

Normally we might use pytest-xdist, but that doesn't mix well with valgrind.

By default, pytest-split shares out the tests evenly. But if you provide a .test_durations JSON file of times from a previous run, it will share out to balance by time taken.

We don't need to keep this file always up-to-date. New tests without times will be shared out between the jobs, and it won't make too much difference.

Also, refactor the CI a bit for this job. It has a first job that builds the Docker image and then uploads to GitHub artifacts. Then the four parallel jobs start, download this image, and run their quarter of tests. Finally, if they all pass, a final job publishes the Docker image.

Comment thread .github/workflows/build.yml Outdated
hugovk and others added 2 commits July 6, 2026 15:00
Co-authored-by: Andrew Murray <3112309+radarhere@users.noreply.github.com>

- name: Build image
run: |
cd ubuntu-24.04-noble-amd64-valgrind && make update

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why doesn't this have sudo chmod a+w like

cd "${{ matrix.image }}" && sudo chmod a+w . && make update

?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That other job had already run sudo chown -R 1001 "$(pwd)" which is the UID the tests run with inside the container. We don't need a matching chmod here, we're only building the image.

@radarhere
radarhere merged commit 17df2c5 into radarhere:ubuntu_valgrind Jul 8, 2026
24 checks passed
@hugovk
hugovk deleted the ubuntu_valgrind-split branch July 9, 2026 07:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants