public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
* [tests/rust] main: rpm-rebuild/stratisd: limit paralellism
@ 2026-08-24 17:23 Jesus Checa Hidalgo
0 siblings, 0 replies; only message in thread
From: Jesus Checa Hidalgo @ 2026-08-24 17:23 UTC (permalink / raw)
To: git-commits
A new commit has been pushed.
Repo : tests/rust
Branch : main
Commit : 1ce23fd6bd0f20f4445482bc771d94a87285cbf0
Author : Jesus Checa Hidalgo <jchecahi@redhat.com>
Date : 2026-08-14T11:49:52+02:00
Stats : +39/-4 in 2 file(s)
URL : https://src.fedoraproject.org/tests/rust/c/1ce23fd6bd0f20f4445482bc771d94a87285cbf0?branch=main
Log:
rpm-rebuild/stratisd: limit paralellism
Newer versions of stratisd have an obscene memory consumption,
reaching peaks of >5GiB in some rustc calls. This commit adds
logic to calculate a ratio of MiB per core in the system running
the test, then apply that number of cores to RPM_BUILD_NCPUS.
Start using 4GiB for building stratisd.
Older versions (RHEL 9 and older) are not affected
---
diff --git a/tests/Sanity/rpm-rebuild/runtest.sh b/tests/Sanity/rpm-rebuild/runtest.sh
index f3537b0..261766f 100755
--- a/tests/Sanity/rpm-rebuild/runtest.sh
+++ b/tests/Sanity/rpm-rebuild/runtest.sh
@@ -2,6 +2,10 @@
# vim: dict+=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k
. /usr/share/beakerlib/beakerlib.sh || exit 1
+# Available environment variables to configure
+# PKG_TO_BUILD (mandatory): rpm packages to run rpmbuild on.
+# MB_PER_CPU (optional): How many MB of ram per number of cpus should have.
+
# Analyze build failure and determine if it's a resource issue or real failure
analyze_build_failure() {
local logfile="$1"
@@ -38,6 +42,25 @@ analyze_build_failure() {
fi
}
+function get_memory_limited_cores() {
+ # Return the number of cores in a way that each core has access to at least
+ # the specified MB of physical RAM (default 1024MB).
+ # Swap is not counted to avoid severe performance degradation.
+ local mb_ram="$(free -m | awk '/Mem:/ {print $2}')"
+ local cores="$(nproc)"
+ local mb_per_core="${1:-1024}"
+
+ local max_cores=$((mb_ram / mb_per_core))
+
+ if [ "$max_cores" -le "0" ]; then
+ echo "1"
+ elif [ "$max_cores" -lt "$cores" ]; then
+ echo "$max_cores"
+ else
+ echo "$cores"
+ fi
+}
+
PACKAGE="$(rpm -qf "$(which rustc)")"
rlJournalStart
@@ -59,6 +82,12 @@ rlJournalStart
rlDie "The package must be passed over PKG_TO_BUILD environment variable."
fi
+ if [[ -n "${MB_PER_CPU}" ]]; then
+ MAX_CPUS=$(get_memory_limited_cores "$MB_PER_CPU")
+ rlLog "Running rpmbuild with max cores: $MAX_CPUS"
+ export RPM_BUILD_NCPUS="$MAX_CPUS"
+ fi
+
# Log basic system resources. If we start seeing failures due to disk
# out of space, timeouts, or OOMs this will help identifying where
# the issue might be.
@@ -95,13 +124,13 @@ rlJournalStart
rlPhaseStartTest
set -o pipefail
LOGFILE="${SRPM}_rpmbuild.log"
- BUILD_CMD="rpmbuild -bb ${SPECDIR}/${SPECNAME}"
+ BUILD_CMD=(rpmbuild -bb "${SPECDIR}"/"${SPECNAME}")
# Log the command being executed (for visibility in test output)
- rlLog "Executing: $BUILD_CMD"
+ rlLog "Executing: ${BUILD_CMD[*]}"
# Execute rpmbuild silently, saving complete log to file
- if $BUILD_CMD &> "$LOGFILE"; then
+ if "${BUILD_CMD[@]}" &> "$LOGFILE"; then
rlPass "rpmbuild succeeded"
else
# Analyze cause of failure
diff --git a/tests/Sanity/rpm-rebuild/stratisd.fmf b/tests/Sanity/rpm-rebuild/stratisd.fmf
index b3698fe..e01d5b4 100644
--- a/tests/Sanity/rpm-rebuild/stratisd.fmf
+++ b/tests/Sanity/rpm-rebuild/stratisd.fmf
@@ -3,7 +3,8 @@ require+:
- stratisd
environment+:
PKG_TO_BUILD: "stratisd"
-duration: 2h
+ MB_PER_CPU: "4096"
+duration: 3h
tier: 1
tag:
@@ -15,3 +16,8 @@ adjust+:
- enabled: false
when: distro == rhel-8 and distro >= rhel-8.9
continue: false
+
+ # Older stratisd packages (RHEL 9 and older) are much less RAM demanding
+ - environment+:
+ MB_PER_CPU: 2048
+ when: distro < rhel-10
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2026-08-24 17:23 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-08-24 17:23 [tests/rust] main: rpm-rebuild/stratisd: limit paralellism Jesus Checa Hidalgo
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox