summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--eclass/multiprocessing.eclass4
-rwxr-xr-xeclass/tests/multiprocessing_makeopts_jobs.sh12
-rwxr-xr-xeclass/tests/multiprocessing_makeopts_loadavg.sh11
3 files changed, 19 insertions, 8 deletions
diff --git a/eclass/multiprocessing.eclass b/eclass/multiprocessing.eclass
index 67f7e2d65b42..73d852410b91 100644
--- a/eclass/multiprocessing.eclass
+++ b/eclass/multiprocessing.eclass
@@ -96,7 +96,7 @@ get_nproc() {
# no way to represent infinity, we return ${inf} (defaults to 999) if the user
# has -j without a number.
makeopts_jobs() {
- [[ $# -eq 0 ]] && set -- ${MAKEOPTS}
+ [[ $# -eq 0 ]] && set -- "${MAKEOPTS}"
# This assumes the first .* will be more greedy than the second .*
# since POSIX doesn't specify a non-greedy match (i.e. ".*?").
local jobs=$(echo " $* " | sed -r -n \
@@ -117,7 +117,7 @@ makeopts_jobs() {
# If no limit is specified or --load-average is used without a number, ${inf}
# (defaults to 999) is returned.
makeopts_loadavg() {
- [[ $# -eq 0 ]] && set -- ${MAKEOPTS}
+ [[ $# -eq 0 ]] && set -- "${MAKEOPTS}"
# This assumes the first .* will be more greedy than the second .*
# since POSIX doesn't specify a non-greedy match (i.e. ".*?").
local lavg=$(echo " $* " | sed -r -n \
diff --git a/eclass/tests/multiprocessing_makeopts_jobs.sh b/eclass/tests/multiprocessing_makeopts_jobs.sh
index ef477277ab3b..cc4f91b69436 100755
--- a/eclass/tests/multiprocessing_makeopts_jobs.sh
+++ b/eclass/tests/multiprocessing_makeopts_jobs.sh
@@ -10,14 +10,20 @@ inherit multiprocessing
test-makeopts_jobs() {
local exp=$1; shift
tbegin "makeopts_jobs($1${2+; inf=${2}}) == ${exp}"
- local act=$(makeopts_jobs "$@")
- [[ ${act} == "${exp}" ]]
- tend $? "Got back: ${act}"
+ local indirect=$(MAKEOPTS="$*" makeopts_jobs)
+ local direct=$(makeopts_jobs "$@")
+ if [[ "${direct}" != "${indirect}" ]] ; then
+ tend 1 "Mismatch between MAKEOPTS/cli: '${indirect}' != '${direct}'"
+ else
+ [[ ${direct} == "${exp}" ]]
+ tend $? "Got back: ${act}"
+ fi
}
tests=(
999 "-j"
999 "--jobs"
+ 999 "-j -l9"
1 ""
1 "-l9 -w"
1 "-l9 -w-j4"
diff --git a/eclass/tests/multiprocessing_makeopts_loadavg.sh b/eclass/tests/multiprocessing_makeopts_loadavg.sh
index 6b976beb1aef..ffa679d13e29 100755
--- a/eclass/tests/multiprocessing_makeopts_loadavg.sh
+++ b/eclass/tests/multiprocessing_makeopts_loadavg.sh
@@ -10,9 +10,14 @@ inherit multiprocessing
test-makeopts_loadavg() {
local exp=$1; shift
tbegin "makeopts_loadavg($1${2+; inf=${2}}) == ${exp}"
- local act=$(makeopts_loadavg "$@")
- [[ ${act} == "${exp}" ]]
- tend $? "Got back: ${act}"
+ local indirect=$(MAKEOPTS="$*" makeopts_loadavg)
+ local direct=$(makeopts_loadavg "$@")
+ if [[ "${direct}" != "${indirect}" ]] ; then
+ tend 1 "Mismatch between MAKEOPTS/cli: '${indirect}' != '${direct}'"
+ else
+ [[ ${direct} == "${exp}" ]]
+ tend $? "Got back: ${act}"
+ fi
}
tests=(