summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichał Górny <mgorny@gentoo.org>2016-12-13 10:31:12 +0100
committerMichał Górny <mgorny@gentoo.org>2016-12-18 14:46:46 +0100
commit83e052c75fcfff084d1cd98ddb914c63926ece64 (patch)
tree6eeeea7da2417d0c6ac532906b6998f13e4351bc /eclass/tests
parentmultiprocessing.eclass: Introduce get_nproc() to get no of CPUs (diff)
downloadgentoo-83e052c75fcfff084d1cd98ddb914c63926ece64.tar.gz
gentoo-83e052c75fcfff084d1cd98ddb914c63926ece64.tar.bz2
gentoo-83e052c75fcfff084d1cd98ddb914c63926ece64.zip
multiprocessing.eclass: Support passing custom inf values for getters
Support passing custom values for 'infinity' in makeopts_jobs() and makeopts_loadavg(). This can be used e.g. when a build system does not support --loadavg, and therefore '--jobs 999' would most likely be a really bad idea. Combined with get_nproc(), this can be used to provide a sane replacement instead.
Diffstat (limited to 'eclass/tests')
-rwxr-xr-xeclass/tests/multiprocessing_makeopts_jobs.sh5
-rwxr-xr-xeclass/tests/multiprocessing_makeopts_loadavg.sh5
2 files changed, 8 insertions, 2 deletions
diff --git a/eclass/tests/multiprocessing_makeopts_jobs.sh b/eclass/tests/multiprocessing_makeopts_jobs.sh
index a1e43c8b91d7..ef477277ab3b 100755
--- a/eclass/tests/multiprocessing_makeopts_jobs.sh
+++ b/eclass/tests/multiprocessing_makeopts_jobs.sh
@@ -9,7 +9,7 @@ inherit multiprocessing
test-makeopts_jobs() {
local exp=$1; shift
- tbegin "makeopts_jobs($*) == ${exp}"
+ tbegin "makeopts_jobs($1${2+; inf=${2}}) == ${exp}"
local act=$(makeopts_jobs "$@")
[[ ${act} == "${exp}" ]]
tend $? "Got back: ${act}"
@@ -39,4 +39,7 @@ for (( i = 0; i < ${#tests[@]}; i += 2 )) ; do
test-makeopts_jobs "${tests[i]}" "${tests[i+1]}"
done
+# test custom inf value
+test-makeopts_jobs 645 "-j" 645
+
texit
diff --git a/eclass/tests/multiprocessing_makeopts_loadavg.sh b/eclass/tests/multiprocessing_makeopts_loadavg.sh
index 276b7e70d393..6b976beb1aef 100755
--- a/eclass/tests/multiprocessing_makeopts_loadavg.sh
+++ b/eclass/tests/multiprocessing_makeopts_loadavg.sh
@@ -9,7 +9,7 @@ inherit multiprocessing
test-makeopts_loadavg() {
local exp=$1; shift
- tbegin "makeopts_loadavg($*) == ${exp}"
+ tbegin "makeopts_loadavg($1${2+; inf=${2}}) == ${exp}"
local act=$(makeopts_loadavg "$@")
[[ ${act} == "${exp}" ]]
tend $? "Got back: ${act}"
@@ -36,4 +36,7 @@ for (( i = 0; i < ${#tests[@]}; i += 2 )) ; do
test-makeopts_loadavg "${tests[i]}" "${tests[i+1]}"
done
+# test custom inf value
+test-makeopts_loadavg 645 "-l" 645
+
texit