summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichał Górny <mgorny@gentoo.org>2022-04-28 12:44:02 +0200
committerMichał Górny <mgorny@gentoo.org>2022-05-01 09:30:36 +0200
commita00223eb88742885325b8863ba080e7d94202d8f (patch)
tree2b0f3c32ee47a52f3b1a0e51fa85350d53ac8686 /eclass/tests
parentninja-utils.eclass: Prepare for makeopts_jobs default inf change (diff)
downloadgentoo-a00223eb88742885325b8863ba080e7d94202d8f.tar.gz
gentoo-a00223eb88742885325b8863ba080e7d94202d8f.tar.bz2
gentoo-a00223eb88742885325b8863ba080e7d94202d8f.zip
multiprocessing.eclass: Default makeopts_jobs to inf=nproc+1
Change the default value for 'inf' argument to makeopts_jobs from 999 to $(get_nproc) + 1. This means that if MAKEOPTS specifies a `-j` argument without a specific value, nproc will be used rather than infinity-ish number of jobs. The old default made sense for ebuilds using both makeopts_jobs and makeopts_loadavg. However, these are very rare — only 4 packages and 3 eclass at this time. For the remaining ebuilds, they meant uncontrollably using up to 999 jobs. The new default is both safer and more correct for the vast majority of Gentoo packages, removing the necessity of repeating: $(makeopts_jobs "${MAKEOPTS}" "$(get_nproc)") The ebuilds and eclasses using makeopts_loadavg have been updated to pass the old default. Signed-off-by: Michał Górny <mgorny@gentoo.org>
Diffstat (limited to 'eclass/tests')
-rwxr-xr-xeclass/tests/multiprocessing_makeopts_jobs.sh15
1 files changed, 10 insertions, 5 deletions
diff --git a/eclass/tests/multiprocessing_makeopts_jobs.sh b/eclass/tests/multiprocessing_makeopts_jobs.sh
index 70a6085d5362..37d5a7257775 100755
--- a/eclass/tests/multiprocessing_makeopts_jobs.sh
+++ b/eclass/tests/multiprocessing_makeopts_jobs.sh
@@ -16,14 +16,19 @@ test-makeopts_jobs() {
tend 1 "Mismatch between MAKEOPTS/cli: '${indirect}' != '${direct}'"
else
[[ ${direct} == "${exp}" ]]
- tend $? "Got back: ${act}"
+ tend $? "Got back: ${direct}"
fi
}
+# override to avoid relying on a specific value
+get_nproc() {
+ echo 41
+}
+
tests=(
- 999 "-j"
- 999 "--jobs"
- 999 "-j -l9"
+ 42 "-j"
+ 42 "--jobs"
+ 42 "-j -l9"
1 ""
1 "-l9 -w"
1 "-l9 -w-j4"
@@ -37,7 +42,7 @@ tests=(
7 "-l3 --jobs 7 -w"
4 "-j1 -j 2 --jobs 3 --jobs=4"
8 " -j 8 "
- 999 "-kj"
+ 42 "-kj"
4 "-kj4"
5 "-kj 5"
)