Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: make test build more robust #213

Merged
merged 4 commits into from
Apr 4, 2024
Merged

ci: make test build more robust #213

merged 4 commits into from
Apr 4, 2024

Conversation

arighi
Copy link
Contributor

@arighi arighi commented Apr 4, 2024

Always use custom linux headers to prevent potential build failures and also use --jobs=1 during the build to prevent overloading the system during the CI run.

Andrea Righi added 4 commits April 4, 2024 10:53
If we try to cross-build scx on builders with older versions of system's
linux headers (such as those provided by linux-libc-headers in older
releases of Ubuntu), we may hit build failures, due to the different
kernel ABI, such as:

 error: invalid use of undefined type ‘struct btf_enum64’

To address this, introduce a new build option called "kernel_headers"
that allows to specify a custom path for the kernel headers required
during the build process.

Signed-off-by: Andrea Righi <[email protected]>
During the build meson attempts to distribute the workload of multiple
sub-projects across all available CPUs and parallelize each build within
those projects, resulting in an NxN task generation.

This process could potentially overload the CI systems, leading to
potential failures (see for example issue #202).

To mitigate this, always use --jobs=1 during the CI run, which
serializes the build of sub-projects and restricts the level of
parallelization to N.

Signed-off-by: Andrea Righi <[email protected]>
- run: meson setup build -Dkernel=$(pwd)/linux
- run: meson compile -C build
- run: meson setup build -Dkernel=$(pwd)/linux -Dkernel_headers=./linux/usr/include
- run: meson compile -C build --jobs=1
Copy link
Contributor

Choose a reason for hiding this comment

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

Just out of curiosity, why do we want to avoid overloading the system during a CI run given that all it's doing is building + testing?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

At the moment this is not critical, but in the future, if we add more Rust components, they'll be all built in parallel by meson in a N^2 way (where N is the amount of CPUs), so there's the risk that at some point we may hit OOM conditions.

The issue is that meson will try to parallelize the sub-projects spawning N tasks, each task will run cargo that is not aware of meson, so it'll also try to spawn N tasks, causing a massive NxN parallel build workload... serializing each cargo run would still build the Rust components in parallel, but limited to N tasks.

@arighi arighi merged commit bc1b0e9 into main Apr 4, 2024
1 check passed
@arighi arighi deleted the fix-ci-build branch April 4, 2024 15:34
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